Project extension-deployment of Git version control system

1 Case 1: Deploy Git version control system
1.1 problem

Deploy the Git version control system, manage the website code, and achieve the following effects:
Server
based on SSH protocol Server based on Git protocol Server
based on HTTP protocol
Upload the code to the version warehouse
1.2 Scheme

The production environment should have an independent Git server. In order to save host resources, we use the database host to complete the Git server at the same time, as shown in Figure-1.
Insert picture description herefigure 1

The host configuration is shown in Table-1.
Table-1
Insert picture description here
1.3 Steps

To implement this case, you need to follow the steps below.
Step 1: Deploy the version control server of the SSH protocol

1) Install the software package and create an empty warehouse.
[root@database ~]# yum -y install git
[root@database ~]# mkdir /var/git/
[root@database ~]# git init --bare /var/git/wordpress.git #Create empty warehouse
2 ) Log in to the web1 server to clone the git repository and upload the website code to the git server.
[root@web1 var]# git config --global push.default simple
[root@web1 var]# git config --global user.email [email protected]
[root@web1 var]# git config --global user. name “Your Name”
[root@web1 var]# cd /var/
[root@web1 var]# git clone [email protected]:/var/git/wordpress.git
[root@web1 var]# cd /var/ wordpress
[root@web1 wordpress]# cp -a /usr/local/nginx/html/* ./
[root@web1 wordpress]# git add.
[root@web1 wordpress]# git commit -m “wordpress code”
[root@web1 wordpress]# git push
[email protected]'s password:<Enter the password of 192.168.2.21 host root>
Step 2: Deploy the version control server of the Git protocol

1) Install the software package (operation on 192.168.2.21)
[root@database ~]# yum -y install git-daemon
2) Modify the configuration file and start the Git service
[root@database ~]# vim /usr/lib/systemd/system The contents of /[email protected]
before modification are as follows:
ExecStart=-/usr/libexec/git-core/git-daemon --base-path=/var/lib/git --export-all --user-path=public_git- -syslog --inetd –verbose The
modified content is as follows:
ExecStart=-/usr/libexec/git-core/git-daemon --base-path=/var/git --export-all --user-path=public_git- -syslog --inetd –verbose
[root@database ~]# systemctl start git.socket
[root@database ~]# systemctl status git.socket
3) Client test (use web2 to complete the client host, 192.168.2.12)
in Executing clone on web2 is equivalent to backing up the code again.
[root@web2 ~]# cd /var/
[root@web2 var]# git clone git://192.168.2.21/wordpress.git
Step 3: Deploy the version control server of HTTP protocol

1) Install the software package (operation on 192.168.2.21)
[root@database ~]# yum -y install httpd gitweb
2) Modify the configuration file
[root@database ~]# vim /etc/gitweb.conf
$projectroot = “/var/ git”; #Add a line
3) Start the service
[root@database ~]# systemctl start httpd
4) Client verification
[root@room9pc01 ~]# firefox http://192.168.2.21/git

Guess you like

Origin blog.csdn.net/weixin_45942735/article/details/104256646