table of Contents
Four, create a task associated with the shell
Five, create a task associated with gitlab
One, install jenkins
- Turn off firewall
- Close selinux
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# setenforce 0
[root@localhost ~]# systemctl disable firewalld
[root@localhost ~]# sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
Deploy java
[root@localhost ~]# yum -y install java-1.8.0
Deploy jenkins (here I install through rpm package due to slow network)
[root@localhost ~]# rpm -ivh jenkins-2.222.4-1.1.noarch.rpm
[root@localhost ~]# systemctl start jenkins
[root@localhost ~]# systemctl enable jenkins
Update jenkins configuration
[root@localhost ~]# vim /var/lib/jenkins/hudson.model.UpdateCenter.xml
<?xml version='1.1' encoding='UTF-8'?>
<sites>
<site>
<id>default</id>
<url>https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json</url> #改为国内的网站
</site>
</sites>
Restart jenkins
[root@localhost ~]# systemctl restart jenkins
Configure download plugin acceleration (if there is no such file, please start jenkins and wait for a while)
[root@localhost ~]# cd /var/lib/jenkins/updates/
[root@localhost updates]# sed -i 's/http:\/\/updates.jenkinsci.org\/download/https:\/\/mirrors.tuna.tsinghua.edu.cn\/jenkins/g' default.json
[root@localhost updates]# sed -i 's/http:\/\/www.google.com/https:\/\/www.baidu.com/g' default.json
Log in to jenkins
2. Chinese display jenkins
First install two plugins
- chinese
- locale
Three, install the plug-in
- git
- gitlab
Four, create a task associated with the shell
- When this task is executed, the specified shell script will be executed
Five, create a task associated with gitlab
- When this task is executed, the code will be pulled from gitlab
First install the git component on the gitlab node
# yum install git -y
It is best to conduct a pull code test
git clone http://192.168.31.64/root/zxhk.git
note
- Install git and gitlab plugins in jenkis
- Install git on the node where jenkins is located