CentOS7.4 build git repository with Gogs

Source: Internet
Author: User
Tags create directory install go mysql version ssh server nginx reverse proxy


Gogs (Go git service) is an easy-to-build, self-help git services. Using go language development enables Gogs to be distributed through standalone binaries and supports all platforms supported by the go language, including Linux, Mac OS X, Windows, and ARM platforms.

I. Gogs dependent environment

Before installing Gogs, you need to configure the appropriate dependent environment, the following environment is covered by the website:

1. Database (select one of the following):
MySQL: Version >= 5.5.3
PostgreSQL
Or nothing is installed directly using SQLite3 or TIDB

2. Git (bash):
Both server and client need version >= 1.7.1
Windows system recommends using the latest version

3. SSH Server:
If you only use Http/https or the built-in SSH server, ignore this
Recommended Windows systems use Cygwin OpenSSH or copssh

4, Nginx reverse proxy (optional)

Second, installation environment

The environment is two servers:

1. Git local repository

ip:192.168.152.162
System: centos7-3.10.0-514.el7.x86_64
Git version: git-1.8.3.1-13.el7.x86_64
Golang version: Golang.x86_64 0:1.9.4-1.el7 (Go Language installation package)

2. Git server repository

ip:192.168.152.163
System: centos7-3.10.0-514.el7.x86_64
Git version: git-1.8.3.1-13.el7.x86_64
Golang version: Golang.x86_64 0:1.9.4-1.el7 (Go Language installation package)
Gogs Version: gogs_0.11.53_linux_amd64.tar.gz
MySQL version: Mysql-community-server.x86_64:5.7.21-1.el7

Note: Both servers need to shut down the firewall and SELinux
1) Turn off firewall systemctl stop Firewalld.service
2) prohibit firewall from starting systemctl disable Firewalld.service
3) Turn off SELINUX sed-i ' s/selinux=enforcing/selinux=disabled/g '
/etc/sysconfig/selinux

Third, build a git server warehouse

May see this some children's shoes will ask the first server? Because the local git warehouse is too simple to set up here, there is no need to demonstrate, if there are no children's shoes, you can see the previous article Centos7-git installation and use, and then we started to build a git server warehouse.

1. Install go language dependency and git service yum-y install go git

2. Install MySQL Database

(There is no mysql-server on the Yum source.) Therefore must go to the official website to download, here we use the wget command, directly obtains the MySQL community source)

Wget-i-C http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm

3. Install the MySQL database dependency package First

Yum-y Install mysql57-community-release-el7-10.noarch.rpm

4. Install MySQL Database

Yum-y Install Mysql-community-server

Note: Installed installed dependency as a dependency is installed replaced override

5. Start MySQL Database

1) Start the database systemctl start mysqld

2) database boot Systemctl enable mysqld

3) Check to see if the database is up and listening on 3306 Port Netstat-anutpl | grep MySQL

6. Log in to MySQL database

This version of the database first login has a default password, so we need to check the default password, and then log in and modify the database password.

1) View database default password grep "password"/var/log/mysqld.log

Note: The default password for MySQL database is sgwnecq4in:r

2) Login Database mysql-uroot-p password

3) Modify the database login password (the new password must be set according to the password complex requirements of the database)
ALTER USER ' root ' @ ' localhost ' identified by ' Wangfeiyu123 ... ';

4) Initialize MySQL database mysql_secure_installation


Note: After executing the initialization command, you need to enter the database root user password, and then the default as a return. (The above questions can also be selected according to their actual situation)

5) Create Gogs library (using UTF8 character set and InnoDB engine, mysql5.7 default is InnoDB engine)

6) root user has all privileges permissions for all tables under Gogs library (this step can be omitted)

7) Refresh database data

7. Create user

1) Create git system user AddUser git

2) Change git user password to 123

3) switch git user login to create directory mkdir ~/.SSH

Note: This directory is a directory for common user upload Code public key authentication

8. Download the tar package and unzip it

TAR-ZXF gogs_0.11.53_linux_amd64.tar.gz

Move Gogs directory to git user home directory MV gogs/home/git/

Modify the genus Chown-r git:git/home/git/gogs/of the Gogs directory

Toggle git user Su-git

Start the Gogs service with a git user gogs/gogs web &

9, access the Gogs Web installation interface and install Gogs

Access Address: http://192.168.152.163:3000

Database Configuration Connection

Basic settings for your app

Settings can be selected automatically

Re-use Web Access to this URL http://192.168.152.163:3000/

Note: The above operation completed the self-help git warehouse service build! This simple self-service git repository is used in a very similar way to GitHub, so there's not much to say here.


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.