声明:本文仅为测试插件,无脚本附件,可用作参考
1.配置安装Jenkins
去jenkins官网https://jenkins.io/index.html下载jenkins安装包
jenkins安装包有两种,一种是LTS,一种是Weekly。LTS是稳定版,Weekly每周会更新一次,目前我选择了LTS
下载rpm包,并且安装Jenkins rpm包
rpm -ivh jenkins-2.107.3-1.1.noarch.rpm
(1)查看Jenkins安装包的位置
rpm -ql jenkins
(2)在下述文件中添加我的jdk目录
vim /etc/init.d/jenkins
添加对应jdk目录语句,其中红色语句为需要添加
/etc/alternatives/java
/usr/lib/jvm/java-1.8.0/bin/java
/usr/lib/jvm/jre-1.8.0/bin/java
/usr/lib/jvm/java-1.7.0/bin/java
/usr/lib/jvm/jre-1.7.0/bin/java
/usr/bin/java
/usr/local/jdk/jdk1.8.0_161/bin/java
(3)修改Jenkins端口
vim/etc/sysconfig/jenkins
JENKINS_PORT="8888"
(4)开启8888端口防火墙
firewall-cmd --zone=public --add-port=8888/tcp --permanent
firewall-cmd --reload
(5)启动Jenkins
service jenkins start
关闭Jenkins
service jenkins stop
重启Jenkins
service jenkins restart
注:在启动过程中遇到下述错误:
Starting jenkins (via systemctl): Warning: jenkins.service changed on disk. Run 'systemctl daemon-reload' to reload units.
解决方案
systemctl daemon-reload
(6)在浏览器键入ip+端口打开Jenkins网页,并出现下列图片
http://ip:8888
(7)获取本地管理员密码
cat /var/lib/jenkins/secrets/initialAdminPassword
选择安装推荐的插件
2.构建项目
新建任务-构建一个自由风格的软件项目