How to install Gogs on OpenSUSE leap 42.3

To install Gogs on OpenSUSE leap 42.3

Gogs is a free, open source and easy-to-use self-hosted Git service written in the Go programming language. It is very similar to GitLab and aims to be the easiest and most painless way to set up self-hosted Git service in your development environment. Gogs also supports all platforms such as Linux, Windows, OS X and ARM. It is so simple to install Gogs and in this tutorial, you will learn about the method to install Gogs on OpenSUSE Leap 42.3

Installing Gogs

If you want to download the installation package for Gogs, make sure you get the latest stable version, for which the link is available in Gogs official website. Run the wget command in the following way to fetch the installation package.

linuxhelp:~ # wget https://dl.gogs.io/0.11.29/linux_amd64.zip
--2017-11-15 11:25:30--  https://dl.gogs.io/0.11.29/linux_amd64.zip
Resolving dl.gogs.io (dl.gogs.io)... 138.68.27.161
Connecting to dl.gogs.io (dl.gogs.io)|138.68.27.161|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 19075459 (18M) [application/zip]
Saving to: ‘ linux_amd64.zip’ 

100%[=========================================================================================================================================================================> ] 19,075,459  1.01MB/s   in 88s    

2017-11-15 11:27:01 (212 KB/s) - ‘ linux_amd64.zip’  saved [19075459/19075459]

Once the package is downloaded, extract the package in apache document root as follows.

linuxhelp:~ # unzip linux_amd64.zip -d /srv/www/htdocs/
Archive:  linux_amd64.zip
   creating: /srv/www/htdocs/gogs/
   creating: /srv/www/htdocs/gogs/public/
   creating: /srv/www/htdocs/gogs/public/plugins/
   creating: /srv/www/htdocs/gogs/public/plugins/highlight-9.6.0/
  inflating: /srv/www/htdocs/gogs/public/plugins/highlight-9.6.0/github.css  
  inflating: /srv/www/htdocs/gogs/public/plugins/highlight-9.6.0/highlight.pack.js  
  inflating: /srv/www/htdocs/gogs/public/plugins/highlight-9.6.0/default.css  
   creating: /srv/www/htdocs/gogs/public/plugins/jquery.datetimepicker-2.4.5/
  inflating: /srv/www/htdocs/gogs/public/plugins/jquery.datetimepicker-2.4.5/jquery.datetimepicker.js  
  inflating: /srv/www/htdocs/gogs/public/plugins/jquery.datetimepicker-2.4.5/jquery.datetimepicker.css  
   creating: /srv/www/htdocs/gogs/public/plugins/dropzone-4.2.0/
  inflating: /srv/www/htdocs/gogs/public/plugins/dropzone-4.2.0/dropzone.js  
.
.
.
.
inflating: /srv/www/htdocs/gogs/scripts/init/openbsd/gogs  
   creating: /srv/www/htdocs/gogs/scripts/init/centos/
  inflating: /srv/www/htdocs/gogs/scripts/init/centos/gogs  
   creating: /srv/www/htdocs/gogs/scripts/init/freebsd/
  inflating: /srv/www/htdocs/gogs/scripts/init/freebsd/gogs  
  inflating: /srv/www/htdocs/gogs/scripts/mysql.sql  
  inflating: /srv/www/htdocs/gogs/gogs  

And then move to your Apache document root by running the following command.

linuxhelp:~ # cd /srv/www/htdocs/
linuxhelp:/srv/www/htdocs # ls -l
total 16
drwxrwxrwx 2 wwwrun www  4096 Oct  9 23:15 gif
drwxr-xr-x 5 root   root 4096 Aug 15 22:48 gogs
-rwxrwxrwx 1 wwwrun www  2356 Mar 18  2017 info2html.css

After that, you should provide appropriate owner and file execution permissions with the help of the following commands.

linuxhelp:/srv/www/htdocs/gogs # chown -R wwwrun:www /srv/www/htdocs/
linuxhelp:/srv/www/htdocs/gogs # chmod -R 775 /srv/www/htdocs/

Once it is done, you need to configure the Apache VirtualHost for Gogs, and for that you need to open the .conf file. So run the following command for the same purpose.

linuxhelp:/srv/www/htdocs/gogs # vim /etc/apache2/conf.d/gogs.conf

Once the .conf file is opened, you should make the following configuration.

< VirtualHost *:80> 
DocumentRoot " /srv/www/htdocs" 
ServerName www.linuxhelp1.com
< Directory " /srv/www/htdocs/" > 
DirectoryIndex index.php
Options FollowSymLinks
AllowOverride All
Require all granted
< /Directory> 
< /VirtualHost> 

And when it is done, you shall restart your Apache service as follows.

linuxhelp:/srv/www/htdocs/gogs # systemctl restart apache

You should also install Git which is very essential for the installation of Gogs.

linuxhelp:/srv/www/htdocs/www:~ # zypper in git
Retrieving repository ' openSUSE-Leap-42.3-Update'  metadata ............................................................................[done]
Building repository ' openSUSE-Leap-42.3-Update'  cache .................................................................................[done]
Retrieving repository ' openSUSE-Leap-42.3-Update-Non-Oss'  metadata ....................................................................[done]
Building repository ' openSUSE-Leap-42.3-Update-Non-Oss'  cache .........................................................................[done]
Loading repository data...
Reading installed packages...
Resolving package dependencies...

The following 18 NEW packages are going to be installed:
  cvs cvsps git git-core git-cvs git-email git-gui git-svn git-web gitk libserf-1-1 libsvn_auth_gnome_keyring-1-0 perl-Authen-SASL perl-Error
  perl-Net-SMTP-SSL subversion subversion-bash-completion subversion-perl
.
.
.
.
(15/18) Installing: subversion-perl-1.9.7-8.1.x86_64 ........................................................................................................................................................[done]
(16/18) Installing: subversion-bash-completion-1.9.7-8.1.noarch .............................................................................................................................................[done]
(17/18) Installing: libsvn_auth_gnome_keyring-1-0-1.9.7-8.1.x86_64 ..........................................................................................................................................[done]
(18/18) Installing: git-svn-2.13.6-7.1.x86_64 ...............................................................................................................................................................[done]

Once the Git is installed, find its location by running the following command. Run the following command for the same process.

linuxhelp:/srv/www/htdocs  # which git
/usr/bin/git

Add the git path in environment variable by running the following command.

linuxhelp:/srv/www/htdocs # export PATH=" /usr/bin/git:$PATH" 

Now, get into the gogs directory and check your default port number.

root@linuxhelpubnt:/var/www/html/gogs# ./gogs web & 
[1] 43213
root@linuxhelpubnt:/var/www/html/gogs# 2017/11/11 12:37:36 [ WARN] Custom config ' /var/www/html/gogs/custom/conf/app.ini'  not found, ignore this if you' re running first time
2017/11/11 12:37:36 [TRACE] Custom path: /var/www/html/gogs/custom
2017/11/11 12:37:36 [TRACE] Log path: /var/www/html/gogs/log
2017/11/11 12:37:36 [TRACE] Log Mode: Console (Trace)
2017/11/11 12:37:36 [ INFO] Gogs 0.11.29.0727
2017/11/11 12:37:36 [ INFO] Cache Service Enabled
2017/11/11 12:37:36 [ INFO] Session Service Enabled
2017/11/11 12:37:36 [ INFO] SQLite3 Supported
2017/11/11 12:37:36 [ INFO] Run Mode: Development
2017/11/11 12:37:36 [ INFO] Listen: http://0.0.0.0:3000


Switch to your browser and type http://yourdomainnamefollowedbyportnumber. When the installation page appears, enter all the requireddetails and proceed.

Also, give the general settings details in the required fields and proceed.

And click on the Install Gogs option.

Once it is done, you shall give in all your login details and click on Create New Account.

And now, sign in with your credentials.

You' ll be taken to the Gogs dashboard.

With this, the installation of Gogs on OpenSUSE Leap comes to an end.

FAQ
Q
is there any Configuration Cheat Sheet?
A
yes, check it here https://gogs.io/docs/advanced/configuration_cheat_sheet
Q
While installing Gogs in OpenSUSE leap 42.3 in web console I got exec: "git": executable file not found in $PATH. How to solve this?
A
First make sure you have installed git in your machine, else install it by zypper in git. Then type which git to attain the installed location and export it by export PATH="installed location
Q
How can I become an administrator?
A
The first registered user with ID = 1 is an administrator. No e-mail confirmation is required for this (if enabled). The default administrator can log into Admin > Users and authorize another
Q
What do I do if I’m running another service on port 3000?
A
Change the listening port of Gogs the first time you run it with:



./gogs web -port 3001

This flag also changes the port number in the install page for you, so pick a number you want to assign for Gogs.
Q
What do I do if I’m running another service on port 3000?
A
Change the listening port of Gogs the first time you run it with:

./gogs web -port 3001
This flag also changes the port number in the install page for you, so pick a number you want to assig