This series of articles try to use Github and Ali cloud server to practice CI/CD software continuous integration and continuous development scheme. Goal: Github uses Webhook technology to notify Ali cloud server to deploy the system automatically once the developer pushes the code.

Centos5.8 update source

Ali cloud OS is centos5.8, because centos5 ali cloud source no longer provides updates, the following is a solution. Update the /etc/yum.repos. D/centos-base. repo file

[base] name = CentOS - 5.8 - base failovermethod = priority baseurl=http://vault.centos.org/5.8/os/$basearch/ gpgcheck = 1 gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-5 
#released updates[updates] name = CentOS - 5.8 - updates failovermethod = priority baseurl=http://vault.centos.org/5.8/updates/$basearch/ gpgcheck=1 gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-5 
#additional packages that may be useful[extras] name = CentOS - 5.8 - extras failovermethod = priority baseurl=http://vault.centos.org/5.8/extras/$basearch/ gpgcheck=1 gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-5 
#additional packages that extend functionality of existing packages[centosplus] name = CentOS - 5.8 - Plus failovermethod = priority baseurl=http://vault.centos.org/5.8/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-5 
#contrib - packages by Centos Users[contrib] name = CentOS - 5.8 - contrib failovermethod = priority baseurl=http://vault.centos.org/5.8/contrib/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-5Copy the code

Make sure there is only one repos ending file in /etc/yum.repos.

Install Git with source code:

cd  /usr/local/src yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-devel wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.16.3.tar.gz tar XZVF git - 2.16.3. Tar. Gz autoconf. / configure --with-curl=/usr/local 
make
make install 
Copy the code

Update OpenSSL and OpenSSH

The default openssl and openssh in centos5.8 are too old to be supported on github. Note The OpenSSH installation depends on OpenSSL.

1. Update the centos OpenSSL

1. Check the source version [root@zj ~]# openssl version -aOpenSSL 0.9.8e-fips-rhel5 01 Jul 2008 download openSSL-1.0.2n.tar. gz wget https://www.openssl.org/source/openssl-1.0.2n.tar.gz 3, update zlib yum install -y zlib 4, decompress tar ZXF openssl-1.0.2h.tar.gzcd/config shared zlib make make install mv /usr/bin/openssl /usr/bin/openssl.bak mv /usr/include/openssl /usr/include/openssl.bak ln-s /usr/local/ssl/bin/openssl /usr/bin/openssl
ln -s /usr/local/ssl/include/openssl /usr/include/openssl
echo"/ usr /localConf ldconfig -v 5. Check whether the upgrade is successful. [root@zj ~]# openssl version -a
OpenSSL 1.0.2n  7 Dec 2017
Copy the code

2. Update the openssh

The tar XZVF openssh - 7.6 - p1. Tar. GzcdOpenssh - 7.6 - p1. / configure -- prefix = / usr /local/openssh --sysconfdir=/etc/ssh --with-pam --with-ssl-dir=/usr/local/openssl --with-md5-passwords --mandir=/usr/share/man --with-zlib=/usr/local/zlib
make && make install
mv /usr/bin/ssh /usr/bin/ssh.bak  
ln -sf /usr/local/openssh/bin/ssh /usr/bin/ssh  
echo"/ usr /local/etc/ld.so.conf ldconfig -v SSH -v [root@iZ28hp47sfjZ openssh-7.6p1]# ssh -V
OpenSSH_7.6p1, OpenSSL 1.0.2n  7 Dec 2017
Copy the code

Clone the Github repository

Install the Github SSH key in Linux. For details, see Github SSH Generation configuration in Windows

cd ~/.ssh/
git config --global user.name ""   
git config --global user.email ""  
ssh-keygen -t rsa -C "[email protected]"  
Enter file in which to save the key (/c/Users/Administrator/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/Administrator/.ssh/id_rsa.
Your public key has been saved in /c/Users/Administrator/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:qwBTVNKO8e+15UUgyHEwP+BqjFN+d1aNZSWzQvfWrBM [email protected]
The key's randomart image is: +---[RSA 2048]----+ | oo.. = +... + = | |... o=.... @.| | .=. . o... E *| | .. =o. . o.+ | | o o =.S . o.o | | o o .. o.o. .. | |...... +. | |... . . | | . | +----[SHA256]-----+Copy the code

Open id_rsa.pub, copy the contents and add them to your Github SSH key. Continue trying the Clone github library

[root@iZ28hp47sfjZ site-src]# git clone --bare [email protected]:jake1036/myvue.git
Cloning into bare repository 'myvue.git'. /etc/ssh/ssh_config line 44: Unsupported option"gssapiauthentication"
The authenticity of host 'github.com (13.250.177.223)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'Github.com, 13.250.177.223' (RSA) to the list of known hosts.
Enter passphrase for key '/root/.ssh/id_rsa': remote: Counting objects: 27, done. remote: Compressing objects: 100% (22/22), done. remote: Total 27 (delta 8), reused 23 (delta 4), pack-reused 0 Receiving objects: 100% (27/27) and 86.28 KiB | 35.00 KiB/s, done. Resolving deltas: 100% (8/8), done. [root @ iZ28hp47sfjZ site - SRC] #Copy the code

Automatic deployment using Webhook and Github

See follow-up article

In this paper, the reference

https://blog.csdn.net/xuxiuning/article/details/51088840

https://www.cnblogs.com/songqingbo/p/5464620.html