What is Gitea you ask. Gitea is a community managed lightweight code hosting solution written in Go. It is published under the MIT license. As well it is a self-hosted Git service, offering an interface much like Github for those who want to self-host their Git repositories but still want to be able to view them through a robust graphical interface.
The tutorial below will take you through all the steps to getting this set up.
I am running Ubuntu 22.4 on my Raspberry Pi 4 with 8GB of RAM. Before you start with installation of Gitea and all the configurations make sure you have installed and configured these packages:
- Maria-Server (MySql)
- your OS is up to date
Now let’s get to the Gitea setup on your Raspberry Pi 4:
- you will need to login to your MySQL (Maria-Server) and create user and database
GRANT ALL PRIVILEGES ON gitea.* TO 'gitea'@'localhost' IDENTIFIED BY 'ENTERPASSWORD';
Create an user that we will use to run Gitea on Raspberry Pi. This command will also create a folder for the user.
These to option we have used:
–disabled-login as we do not want users login to the Raspberry Pi as this user
–gecos this allows us to set a name for the user, in our case to “Gitea”
Once we have set this up, we can now move to installation and configuration Gitea server.
- You need to switch to user git
- Change to home directory
- Create a directory gitea
- Navigate to the new directory gitea
- Download Gitea
- Make the download file executable
- You can now exit the git user
wget https://dl.gitea.io/gitea/1.17.0/gitea-1.17.0-linux-arm-5 -O gitea
chmod a+x gitea
In next step we have to create a file gitea.service
Once you have the file opened juts copy this into the file, you can leave the file as it is, no editing required.
Description=Gitea (Git with a cup of tea)
# Modify these two values and uncomment them if you have
# repos with lots of files and get to HTTP error 500 because of that
Press X and Y to save and in next step run last 2 commends to restart the services for Gitea
sudo systemctl start gitea.service
These steps complete the installation and basic configuration of Gitea. If no errors and services are up and running, proceed to open your browser and enter IP address of the Raspberry Pi and port 3000 to complete the configuration of the Gitea server.
Open your browser and enter URL: https://RASPBERRYPI-IP:3000 — if your address 10.0.0.20 -> https:.//10.0.0.20:3000
You should see a configuration page for Gitea server where we will need to enter few details.
Under the Database setup you will need to enter the same password that you have setup for the gitea database for user gitea in beginning.
- Scroll down and under Domain, enter your IP address 10.0.0.20
- Application URL change to http://10.0.0.20:3000/
- Hit the Install Gitea button
- It will take short moment and you should be redirected to your Gitea login page
Once the installation process has completed, your web browser will be redirected to the login page as shown below. Now all you have to do is register an account, then you will have Gitea up and running perfectly. Take some time to explore its interface and learn the ropes. If you are familiar with GitHub, you should be familiar with this.
Last steps create your Gitea account by clicking Need and Account? Sign up now. Once created, you can now create your repos and start developing.