Gitea is a Github-like open-sourced version management software. It’s arguably the simplest, quickest, most peaceful way to get a self-hosted Git system up and running. Gitea is indeed a Gogs replica that is entirely available and free to use. This short guide will explain to students and young readers how to set up Gitea rapidly and effortlessly on Ubuntu 20.04. Follow the instructions underneath to deploy Gitea in Ubuntu.
Update Apt Package:
Open and log in from the Ubuntu 20.04 system first. Use “Ctrl+Alt+T” to launch the terminal. Make sure to update your apt package first. Add the sudo account passcode, to continue.
$ sudo apt update
Now, you have to first install git with certain more packages on your system. For this reason, try out the below installation apt command using the sudo privileges.
$ sudo apt install git unzip gnupg2
Now, the git has been installed, it’s time to generate a new Git user for the execution of Gitea facilities on your system. Hence you have to add the below query in the shell to do so:
$ sudo adduser –system –group –disabled-password –shell /bin/bash –home /home/git –gecos ‘Git Version Control’ git
The output is given below, showing the successful creation of a git user.
To keep its information, Gitea needs a database server. And if you’re searching for something like an open-source content management server, MariaDB is a wonderful opportunity to look. Execute the instruction underneath to set up MariaDB.
$ sudo apt-get install mariadb-server mariadb-client
Affirm the installation of MariaDB by tapping “Y” for yes in the shell as asked.
The instructions beneath could be used to quit, begin, and enable MariaDB to ever kickstart whenever the server starts up once it has been installed.
$ sudo systemctl enable mariadb.service
$ sudo systemctl start mariadb.service
$ sudo systemctl stop mariadb.service
Then, to protect the MariaDB server, use the instructions underneath to create a root password as well as disable global root access.
$ sudo mysql_secure_installation
As we don’t want to change the password for the root user, hence we pressed “n”.
To avoid removing anonymous users, press “n”.
To disable remote login from root user, tap “n”.
To avoid removing the test database, hit “n”.
To avoid reloading tables, tap “n”.
You are good to use MariaDB.
Set Up MariaDB:
Execute the instruction underneath to connect to the MariaDB database.
$ sudo mysql –u root –p
Now set the value of “innodeb_file_per_table” to “ON”.
SET GLOBAL innodeb_file_per_table = ON;
Make a new DB, named “giteadb”.
CREATE DATABASE giteadb;
Make a new user named “giteauser”.
REATE USER ‘giteauser’@’localhost’ IDENTIFIED BY ‘new_password’;
Give full privileges access to this user.
GRANT ALL ON giteadb.* TO ‘giteauser’@’localhost’ IDENTIFIED BY ‘new_password’ WITH GRANT OPTION;
You can modify the character set of your database “giteadb”.
ALTER DATABASE giteadb CHARACTER SET = utf8mb4 COLLATE utf8mb4_unicode_ci;
Save your updates and quit.
Now you have to open the configuration file of MariaDB to update it a little. Use the below sudo command to edit it in a nano editor.
$ sudo nano /etc/mysql.mariadb.conf.d/50-server.cnf
Now add the below appended script at the end of the configuration file. Press Ctrl+S to save the changes and leave the file via Ctrl+X.
Now, restart MariaDB once again.
$ sudo systemctl restart mariadb.service
$ sudo systemctl restart mysql.service
Move to the “tmp” folder, then use the wget command to download “Gitea”.
$ cd /tmp
$ wget https://dl.gitea.io/gitea/1.8.0/gitea-1.8.0-linux-amd64
Move the file to ‘/usr/local/bin’, and change it to executable using “Chmod”.
$ sudo mv gitea-1.8.0-linux-amd64 /usr/local/bin/gitea
$ sudo chmod +x /usr/local/bin/gitea
Open the “gitea.service” file.
$ sudo nano /etc/system/system/gitea.service
Add the below script, save and close it
Now you have to reload your system and enable GItea services.
$ sudo systemctl daemon-reload
$ sudo systemctl enable gitea
Start the Gitea service and check its status.
$ sudo systemctl start gitea
$ sudo systemctl status gitea
In this article, we have to get into detail about the process to install Gitea on Ubuntu 20.04 LTS. I hope, by following this step-by-step guide, you can easily install Gitea on Ubuntu 20.04 LTS.