Press "Enter" to skip to content

Having your own personal Github (hosting Gitea)

Hey all, in this short post I’m going to walk you through how to set up your very own Gitea instance, which is essentially like a self-hosted Github. You can host Gitea in a Docker container, virtual machine, or anywhere that can run Golang. You can even host it on a Raspberry Pi!

 

First, on any debian-based Linux machine (Ubuntu, Mint, Debian, etc.), run the following command to update your apt cache:

sudo apt update

 

We are then going to have install Golang, which Gitea utilizes. Run the following command to install Golang on your system:

sudo apt install golang

 

Once Golang has been installed, go ahead and download the latest release version of Gitea, which can be found here. You are going to look for a file that has the name structure: gitea-<version>-linux-amd64. This is a precompiled Go binary, that you can use to run on any x64 architecture CPUs (which is the vast majority of CPUs out there at this point). The following command can be used to download the current version’s precompiled binary:

wget https://github.com/go-gitea/gitea/releases/download/v1.15.3/gitea-1.15.3-linux-amd64 -O gitea

If you are going to be running this on a Raspberry Pi, which utilizes ARM architecture for its CPUs, you are going to want to download the file that runs on this architecture. As of this post, the latest version of Gitea is 1.15.3. You are going to need to download the file that has a naming structure similar to the following: gitea-<version>-linux-arm64. To download the latest version of the Gitea precompiled binary, use the following command:

wget https://github.com/go-gitea/gitea/releases/download/v1.15.3/gitea-1.15.3-linux-arm64 -O gitea

 

After the Gitea binary has been downloaded, you can then run the following command to run Gitea, which will be accessible on port 3000 of the machine you launch this command from.  You can find the IP address of the machine that you are running Gitea from by opening another terminal and typing:

ip addr show ens33 | awk '$1 == "inet" {gsub(/\/.*$/, "", $2); print $2}'

or

ip addr show eth0 | awk '$1 == "inet" {gsub(/\/.*$/, "", $2); print $2}'

 

If you want Gitea to run on port numbers that are < 1000 (which can be configured in the /etc/gitea/app.ini), you will need to run the following command:

sudo setcap cap_net_bind_service=+ep /usr/local/bin/gitea