How to Install Gogs on CentOS 7

Gogs is a painless self-hosted Git Service written in Go. It aims to make the easiest, fastest and most painless way to set up a self-hosted Git service. With Go, this can be done in independent binary distribution across ALL platforms that Go supports, including Linux, Mac OS X, and Windows.

In this tutorial I will show you how to install Gogs on CentOS 7.

Install Gogs on CentOS 7

Prerequisites :

  • LAMP Stack should be installed on the system.
  • Create a database and user with sufficient privileges to user.
  • PHP 5.6+ needed.

Gogs Installation

First of all download the Gogs package using wget command in your web server document root directory in my case my web root directory is /var/www/html/.

# cd /var/www/html/
#  wget https://dl.gogs.io/0.11.29/linux_amd64.zip
--2017-11-11 16:06:06--  https://dl.gogs.io/0.11.29/linux_amd64.zip
Resolving dl.gogs.io (dl.gogs.io)...
Connecting to dl.gogs.io (dl.gogs.io)||:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 19075459 (18M) [application/zip]
Saving to: ‘linux_amd64.zip’

100%[======================================>] 1,90,75,459  589KB/s   in 39s    

2017-11-11 16:06:47 (480 KB/s) - ‘linux_amd64.zip’ saved [19075459/19075459]

After downloaded Gogs package now extract the tar file.

# unzip linux_amd64.zip 
Archive:  linux_amd64.zip
   creating: gogs/
   creating: gogs/public/
   creating: gogs/public/plugins/
   creating: gogs/public/plugins/highlight-9.6.0/
  inflating: gogs/public/plugins/highlight-9.6.0/github.css  
  inflating: gogs/public/plugins/highlight-9.6.0/highlight.pack.js  
  inflating: gogs/public/plugins/highlight-9.6.0/default.css  
   creating: gogs/public/plugins/jquery.datetimepicker-2.4.5/
  inflating: gogs/public/plugins/jquery.datetimepicker-2.4.5/jquery.datetimepicker.js  
inflating: gogs/scripts/init/centos/gogs  
   creating: gogs/scripts/init/freebsd/
  inflating: gogs/scripts/init/freebsd/gogs  
  inflating: gogs/scripts/mysql.sql  
  inflating: gogs/gogs               

Change the ownership of gogs directory using below command.

# chown -R apache.apache gogs/

Now create a Apache virtual host file called “gogs.conf” and add the following content.

# vim /etc/httpd/conf.d/gogs.conf  
ServerAdmin [email protected]
DocumentRoot /var/www/html/gogs/
ServerName gogs.com
ServerAlias www.gogs.com

Options FollowSymLinks
AllowOverride All
Order allow,deny
allow from all

ErrorLog /var/log/httpd/gogs.com-error_log
CustomLog /var/log/httpd/gogs.com-access_log common

Save and close file.

Edit the local hosts file and add the below line.

# vim /etc/hosts	  gogs.com   # My local machine IP and domain name

Save and close file. Now go to the gogs directory.

# cd gogs/

Now execute the below command:

# ./gogs web &
[1] 6398
2017/11/11 16:13:06 [TRACE] Custom path: /var/www/html/gogs/custom
2017/11/11 16:13:06 [TRACE] Log path: /var/www/html/gogs/log
2017/11/11 16:13:06 [TRACE] Log Mode: Console (Trace)
2017/11/11 16:13:06 [ INFO] Gogs
2017/11/11 16:13:06 [ INFO] Cache Service Enabled
2017/11/11 16:13:06 [ INFO] Session Service Enabled
2017/11/11 16:13:06 [ INFO] SQLite3 Supported
2017/11/11 16:13:06 [ INFO] Run Mode: Development
2017/11/11 16:13:06 [ INFO] Listen:

Restart Apache service.

# systemctl restart httpd

To complete the installation process go to your web brose and type the below URL.



Enter the all compulsory details and click on the Install Gogs button.




Next login page will open. Now Click on Need an account? to open a new account in Gogs.


Enter the all needed details and click on Create button.


Put your login credentials and click on Sign In button.


Gogs home page will appear.


Go to Admin Panel to make some changes in your account.



Congratulation! Gogs successfully installed on your CentOS machine.

Thank you! for visiting LookLinux.

If you find this tutorial helpful please share with your friends to keep it alive. For more helpful topic browse my website www.looklinux.com. To become an author at Look Linux Submit Article. Stay connected to Facebook.

About the author


Santosh Prasad

Hi! I'm Santosh and I'm here to post some cool article for you. If you have any query and suggestion please comment in comment section.

Leave a Comment