Installing and Configuring Gogs with MariaDB on a Linux Server
This guide walks through installing MariaDB, creating a Gogs database and user, setting up Git, extracting and launching Gogs, and configuring the application—including disabling registration—to complete a simple self‑hosted Git server on Linux.
First, install MariaDB on the server:
yum install mariadb mariadb-server -y
Enable and start the service:
systemctl enable mariadb
systemctl restart maridb
Run the security script to set the root password and secure the installation:
mysql_secure_installation
Log into MySQL as root:
mysql -uroot -p123456
Create the Gogs database and a dedicated user, then grant privileges:
create database gogs character set utf8 collate utf8_bin;
grant all privileges on gogs.* to 'gogs'@'127.0.0.1' identified by '123456';
flush privileges;
Test the new user login:
mysql -ugogs -p123456 -h 127.0.0.1 -A
Next, install Git and create a non‑login user for it:
yum -y install git
useradd git -s /sbin/nologin
Extract the Gogs binary package to /usr/local/ :
tar -zxvf gogs_0.11.86_linux_amd64.tar.gz -C /usr/local/
Verify the installation directory:
cd /usr/local/gogs
List the files to see the Gogs layout (LICENSE, public, README, scripts, templates, etc.).
Start Gogs:
/usr/local/gogs/gogs web
The console outputs initialization messages, confirming the version, enabled services, run mode, and listening address (http://0.0.0.0:3000).
Configure Gogs by editing /usr/local/gogs/custom/conf/app.ini . Set the database connection credentials and disable user registration for security by adding:
DISABLE_REGISTRATION = true
After saving the configuration, Gogs is ready for use as a lightweight Git server.
Related articles:
Jenkins Email Notification Practice
Jenkins + SVN File Retrieval and Distribution
Jenkins Batch Host Key Distribution
Jenkins Environment Installation
Practical DevOps Architecture
Hands‑on DevOps operations using Docker, K8s, Jenkins, and Ansible—empowering ops professionals to grow together through sharing, discussion, knowledge consolidation, and continuous improvement.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.