TAR-ZXVF linux_amd64.tar.gz
In the previous articles have built mysql,jdk,git and Tomcat and other environments, this time need to build a gogs this self-service git service.
First, about Gogs
In order to synchronize the code we generally need to use the version control system, the current popular is git and svn two kinds. This time I'm going to build the Yes Git version control system.
At present, the better git service has two, Gitlab and Gogs,gitlab as GitHub's cottage version, the function is very comprehensive, but also very bloated server requirements are relatively high. The gogs developed by the Chinese people are very light, and it is said that a raspberry pie can be run on it. As a personal code hosting platform, Gogs is more suitable for me.
Gogs's official website address is: https://gogs.io/
Second, the preparation before installation
1, install git software, this can refer to the previous articles.
2, download Software installation package: https://dl.gogs.io/0.11.4/linux_amd64.tar.gz, here I use decompression install binary installation mode.
3, create Git account, Gogs recommended to use Git user run
sudo adduser git
4, the MySQL database to increase the Gogs account and Gogs database
Iii. installation of Gogs
1, switch to git user, create SSH directory
Su git
mkdir ~/.ssh
2, unpack the installation package, I put the compression package in Git's home directory/home/git below, to operate
TAR-ZXVF linux_amd64.tar.gz
Go to the installation directory CD gogs, enter the command./gogs Web boot gogs, this time enter http://ip:3000, you can go to the installation configuration interface
PS: Optional configuration mail server, server and other service settings, Administrator account settings can be more than their own configuration, later also through the configuration file to customize changes. Where the administrator defaults to the automatic get administrator right with ID 1.
Configuration file Address: Custom/conf/app.ini
Configuration Note Address: Https://gogs.io/docs/advanced/configuration_cheat_sheet
Four, configure Linux,
At this point we can only run gogs, if we use the terminal connection to boot, the service will also be turned off after the terminal is exited. This time we need to add gogs to the system service. There are service scripts for multiple systems under the Scripts folder. Where init, SYSTEMD and Windows directories are Linux, Windows service scripts, respectively. Here we take CentOS as an example, into the script below Init to see the CentOS
1, copy scrpits/init/centos/gogs to/etc/init.d/directory below
sudo cp/home/git/gogs/scripts/init/centos/gogs/etc/init.d/
2, under the/ETC/INIT.D directory for the script to give executable permissions
sudo chmod +x gogs
3, the use of Service Management Command Management Services
sudo service gogs start/stop/restart/status
4, configure the Gogs boot from start
sudo chkconfig--add gogs
V. Problems that have been encountered
In the implementation of the above installation process, encountered a problem, the system prompts: "Fail to test git" command:exec: "git": Executable file not found in $PATH (forgotten install? ", this is mainly gogs request git command in the/bin/git, here can make a soft connection. Ln-s/usr/local/git/bin/git/bin/git this way can be.
Reference articles:
Http://yzone.net/blog/98
https://segmentfault.com/a/1190000007764934
Https://imjad.cn/archives/lab/using-gogs-to-build-your-own-git-server-on-centos
https://www.xiaoz.me/archives/8379
Gogs start error resolution after joining service
Http://m.codes51.com/itwd/1373803.html