This tutorial will walk you through the steps necessary to install the Gogs self-hosted Git service on an RockyLinux 8 server. The Gogs project, written in Go, aims to create a simple, stable, and extensible self-hosted Git service with a simple setup process.
Gogs performs admirably and is extremely light. It uses very little RAM and CPU power.
Checkout the Gogs Project at https://gogs.io/ for more information.
- Full SSH root access or a user with sudo privileges is required.
- Gogs supports the following databases.
Let's update software packages first. To perform updates, run the following command:
Use the below command to install MariaDB.
dnf install mariadb-server
Now, start the MariaDB service
systemctl start mariadb systemctl enable mariadb systemctl status mariadb
Check the status of MariaDB service.
[root@vps ~]# systemctl start mariadb [root@vps ~]# systemctl status mariadb ● mariadb.service - MariaDB 10.5 database server Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor > Active: active (running) since Sat 2023-03-11 19:45:39 UTC; 17min ago Docs: man:mariadbd(8) https://mariadb.com/kb/en/library/systemd/ Process: 31681 ExecStartPre=/usr/libexec/mariadb-check-socket (code=exited,> Process: 31703 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir mariadb.ser> Process: 31807 ExecStartPost=/usr/libexec/mariadb-check-upgrade (code=exite> Main PID: 31790 (mariadbd) Status: "Taking your SQL requests now..." Tasks: 8 (limit: 17516) Memory: 75.3M CPU: 842ms CGroup: /system.slice/mariadb.service └─31790 /usr/libexec/mariadbd --basedir=/usr Mar 11 19:45:39 vps.server.com mariadb-prepare-db-dir: you need to be th> Mar 11 19:45:39 vps.server.com mariadb-prepare-db-dir: After connecting > Mar 11 19:45:39 vps.server.com mariadb-prepare-db-dir: able to connect a> Mar 11 19:45:39 vps.server.com mariadb-prepare-db-dir: See the MariaDB K> Mar 11 19:45:39 vps.server.com mariadb-prepare-db-dir: Please report any> Mar 11 19:45:39 vps.server.com mariadb-prepare-db-dir: The latest inform> Mar 11 19:45:39 vps.server.com mariadb-prepare-db-dir: Consider joining
Secure the Mysql Installation with the below command,
Enter current password for root (enter for none): OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MariaDB root user without the proper authorisation. Set root password? [Y/n] y New password: Re-enter new password: Password updated successfully! Reloading privilege tables.. ... Success!
Login to Mysql as
mysql -u root -p
Enable global variables as shown below,
SET GLOBAL innodb_file_per_table = ON;
Create a database called
gogs which will be used for this project,
CREATE DATABASE IF NOT EXISTS gogs CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
Create a user and grant all the privileges of the gogs database,
GRANT ALL PRIVILEGES ON gogs.* TO 'gogs'@'localhost' IDENTIFIED BY "StrongPassword";
Replace "StrongPassword" with an actual password that is long and strong.
FLUSH PRIVILEGES; EXIT
curl to download the
Gogs file from their official github repository.
curl -s https://api.github.com/repos/gogs/gogs/releases/latest | grep browser_download_url | grep '\linux_amd64.zip' | cut -d '"' -f 4 | wget -i -
Unzip the downloaded
Install the packages of
dnf install git
Create a new user called
Create a dedicated logs directory for it's user,
Permit created directory access to the added user,
chown -R git:git /var/log/gogs/
Move the Gogs binary file to
mv gogs /home/git/
Change the permission of the site directory.
chown -R git:git /home/git/
Next, Enable the firewalld for Port 3001
firewall-cmd --zone=public --add-port=3001/tcp --permanent firewall-cmd --reload
git user that was created earlier,
su -i git
Then change the directory to where gogs is located,
Then, run the
gogs with the
./gogs web -port 3001
Navigate to your browser and load the server's IP address or the domain name with
http://server-ip-address:3001 and you will see the
Gogs installation screen.
In Database Settings we'll first enter the Database information that was created earlier.
Next, In Application General Settings
- Application Name - enter the Project name of your choice.
- Run User - will be the new user that was added earlier,
- Domain - enter the Domain name that should be associated with the application. If you do not have any domain, use
- Application URL - enter the IP address of the server or the Domain name with the port to be used.
Do not use localhost in Application URL.
- Log Path - enter the directory path that was created earlier,
In Optional Settings,
- Enable or Disable the required settings that goes with your application usage.
- Create an Admin Account which you will be using as first user with Admin privileges.
Now click on Install Gogs button to start the installation. Once the installation is complete, you will be redirected to login screen.
Login with the Admin user that was just created in the last step.
This concludes the Installation and Gogs on Rockylinux 9