Jenkins的安装及中文展示、安装插件创建一个关联shell的任务

目录

                      一、安装jenkins

                      二、中文展示jenkins

                      三、安装插件

                      四、创建一个关联shell的任务

                      五、创建一个关联gitlab的任务

 

一、安装jenkins

  • 关闭防火墙
  • 关闭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

 部署java

[root@localhost ~]# yum -y install java-1.8.0

部署jenkins(在这里我通过rpm包安装由于网络慢的缘由)

[root@localhost ~]# rpm -ivh jenkins-2.222.4-1.1.noarch.rpm 
[root@localhost ~]# systemctl  start jenkins
[root@localhost ~]# systemctl  enable jenkins

更新jenkins配置

[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>

重启jenkins

[root@localhost ~]# systemctl  restart jenkins

配置下载插件加速(如果没有这个文件,请启动jenkins稍等片刻)

[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

登录jenkins

二、中文展示jenkins

首先安装两个插件

  • chinese
  • locale

三、安装插件

  • git
  • gitlab

 四、创建一个关联shell的任务

  • 当执行这个任务的时候,指定的shell脚本就会被执行

五、创建一个关联gitlab的任务

  • 当执行这个任务的时候,就会从gitlab中拉取代码

首先在gitlab节点安装上git组件

# yum install git -y

最好进行一次拉取代码测试

git clone http://192.168.31.64/root/zxhk.git

注意

  • 在jenkis中安装git和gitlab插件
  • 在jenkins所在节点要安装git

猜你喜欢

转载自blog.csdn.net/yeyslspi59/article/details/107345085
今日推荐