Install Gogs on Ubuntu 16.04In this guide we will show you how to install Gogs on Ubuntu 16.04. Gogs is a free and open source self-hosted Git service, made in the Go programming language, it’s similar to GitLab and it’s goal is to be the simplest and most painless way to have a self-hosted Git service in your development environment. IT’s installation is kind of fast and easy.
RequirementsGogs has a couple of requirements that you will need to install so that Gogs runs on your Ubuntu server.
- SSH server
- Database server: – MySQL: Version 5.5.3 or newer – PostgreSQL – MSSQL – TiDB – SQLite3
- Git version 1.7.1 or newer
Updating the SystemBegin by logging into your Ubuntu 16.04 server via SSH as user root:
ssh [email protected]_AddressEnsure that every system package is up-to-date by executing the command below:
apt-get update && apt-get upgradeInstall the MYSQL server and then create the database: Execute the command below so the MySQL server is installed on your server.
apt-get install mysql-serverAfter it’s installed, we will execute the mysql_secure_installation script so the MySQL is secured, and then we will set a password for the root user.
Remove anonymous users? (Press y|Y for Yes, any other key for No) : Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Remove test database and access to it? (Press y|Y for Yes, any other key for No) : Reload privilege tables now? (Press y|Y for Yes, any other key for No) :Once we’ve done that, we may login to the MySQL server as root and create a database for Gogs:
CREATE DATABASE gogs; GRANT ALL PRIVILEGES ON gogs.* TO 'gogs'@'localhost' IDENTIFIED BY 'YOUR_PASSWORD'; FLUSH PRIVILEGES; \q
Install and Configure GogsCreate a new system user which will run Gogs
useradd --system --create-home gitSwitch the user
Su git cd ~Download the latest Gogs version which matches your system (32 bit or 64 bit)
wget https://dl.gogs.io/0.11.29/linux_amd64.zipNow unpack the downloaded zip archive
apt-get install unzip unzip linux_amd64.zipExecute the command below to initiate Gogs:
cd gogs && ./gogs web &By default Gogs will be running on port 3000. So, open your web browser of choice and point it to http://IP_Address:3000 . Gogs is going to automatically detect that this is the first time its running and redirect to the setup screen. With the information below, you may configure Gogs: Database Settings:
- Database Type: MySQL
- Host: 127.0.0.1:3306
- User: gogs
- Password: YOUR_PASSWORD
- Database Name: gogs
- Application Name: Gogs
- Repository Root Path: /home/git/gogs-repositories
- Run User: git
- Domain: domain.com
- SSH Port: 22 // use your SSH port number
- HTTP Port: 3000
- Application URL: http://domain.com
Updated on 06 Mar 2018
Add a comment