How to install Gogs on CentOS 7
To install Gogs on CentOS 7
Gogs is a free, open source, and easy-to-use self-hosted Git service, and it is similar to GitLab. It is written using the Go language, hence it supports all platforms such as Linux, Windows, OS X and ARM. Installing Gogs is very simple and in this tutorial, you will be briefed about the method to install Gogs on CentOS 7.
In MariaDB (create database, user and privileges to user)
PHP > 5.6
Get into the html location by running the following command.
[root@linuxhelp ~]# cd /var/www/html/
From there, you can download the gogs packages with the help of wget command.
[root@linuxhelp 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)... 18.104.22.168 Connecting to dl.gogs.io (dl.gogs.io)|22.214.171.124|: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]
Once the file is downloaded, you can extract the downloaded file.
[root@linuxhelp html]# 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
After that, you need to change the ownership of gogs directory as follows.
[root@linuxhelp html]# chown -R apache.apache gogs/
Once it is done, you can create a .conf file for configuring the VirtualHost
[root@linuxhelp html]# vim /etc/httpd/conf.d/gogs.conf
Once the file is opened, add the following lines.
< VirtualHost *:80> ServerAdmin email@example.com DocumentRoot /var/www/html/gogs/ ServerName gogs.com ServerAlias www.gogs.com < Directory /var/www/html/gogs/> Options FollowSymLinks AllowOverride All Order allow,deny allow from all < /Directory> ErrorLog /var/log/httpd/gogs.com-error_log CustomLog /var/log/httpd/gogs.com-access_log common < /VirtualHost>
Later, you need to make an entry in the in hosts file as follows.
root@linuxhelpubnt:/var/www/html# nano /etc/hosts < < machine ip> domainname(give in virtualhost)
Now, enter into the gogs directory
[root@linuxhelp html]# cd gogs/
And then execute the gogs.
[root@linuxhelp gogs]# ./gogs web &  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 0.11.29.0727 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: http://0.0.0.0:3000
Once it is done, restart the Apache service.
[root@linuxhelp gogs]# systemctl restart httpd
Open your browser and give http://gogs.com:3000 as the URL, the installation page of gogs appears on your screen.
Fill all the needed details and click the install gogs option.
The login page gets opened. Click on Need an account? Sign up now option to open a new account in Gogs.
Fill the needed details and click Create.
Enter your newly created credentials and click on Sign in option
The home page of Gogs now appears on your screen.
You can go to the Admin Panel to make some modification in your account.
With this, the installation of Gogs comes to an end.