Centos builds git service gogs

gogs introduction

Gogs is an open source file/code management system (based on Git) similar to GitHub. The goal of Gogs is to create the easiest, fastest and easiest way to build a self-service Git service. Developed in Go language, Gogs can be distributed through independent binary and supports all platforms supported by Go language, including Linux, Mac OS X, Windows and ARM platforms.

How the git service works

work process

deployment steps

Install go language dependencies and git services:

yum -y install go git

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-MjEQkEML-1575269517833)(https://www.showdoc.cc/server/api/common/visitfile/sign/2d8e77b8683e5faa19b40e31697efa08?showdoc=.jpg)]

Install the MySQL database

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

Install the dependencies of the MySQL database

yum -y install mysql57-community-release-el7-10.noarch.rpm

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-MmyLzBvQ-1575269517834)(https://www.showdoc.cc/server/api/common/visitfile/sign/0e41920237807c94cf082473c6dc72a0?showdoc=.jpg)]

Install the MySQL database

yum -y install mysql-community-server

Start the MySQL database
  • 1. Start the database
    systemctl start mysqld

  • 2. The database starts automatically
    systemctl enable mysqld

  • 3. Check whether the database is started and listening on port 3306
    netstat -anutpl | grep mysql

Login to the MySQL database

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

  • 1. View the database default password:
    grep "password" /var/log/mysqld.log

    MySQL数据库的默认密码是 P7cIn8:rh+ht

  • 2. Log in to the database mysql -uroot -p password

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-4JjfjyB8-1575269517837)(https://www.showdoc.cc/server/api/common/visitfile/sign/6c2f88f0e7c7911795bb62a758599c01?showdoc=.jpg)]

  • 3. Initialize the MySQL database mysql_secure_installation

[External link picture transfer failed, the source site may have an anti-theft link mechanism, it is recommended to save the picture and upload it directly (img-Nl7vR3Tf-1575269517837)(https://www.showdoc.cc/server/api/common/visitfile/sign/77bcce70d3644251b274d8409975aeab?showdoc=.jpg)]

  • 4. Create gogs library (use utf8 character set and InnoDB engine, mysql5.7 defaults to InnoDB engine)

CREATE DATABASE gogs CHARACTER SET utf8 COLLATE utf8_bin;

9) Authorize the gogs user to log in

grant all privileges on gogs.* to "gogs"@"%" identified by "csdsj2019";

10) Refresh database data

flush privileges;

7. Create a user
1) Create a git system user

adduser git
2) View the directory:

3) Modify the git user password to 123

4) Switch git user login to create directory mkdir ~/.ssh


8. Download the gogs installation package

wget https://dl.gogs.io/0.11.53/gogs_0.11.53_linux_amd64.tar.gz

9. Unzip

tar -zxf gogs_0.11.53_linux_amd64.tar.gz chown -R git:git gogs

10. Start
1). Background running process mode

gogs/gogs web &

2). System startup method:

Switch to the root account, and then copy to the /etc/init.d/ directory:

su root
sudo cp /home/git/gogs/scripts/init/centos/gogs /etc/init.d/
sudo chmod +x /etc/init.d/gogs
cp /home/git/gogs/scripts/systemd/gogs.service /etc/systemd/system/

Start the service and run:

service gogs start
或者 systemctl start gogs

11. Access the configuration and use it:

Access address: http://XXX:13000/

insert image description here

Guess you like

Origin blog.csdn.net/quanqxj/article/details/103348847