后续教程都是以Centos + Java + spring boot + svn + git + maven + angular4 + nodeJs + mysql 为例
Centos7上安装Jenkins
安装
sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat/jenkins.repo
sudo rpm --import https://pkg.jenkins.io/redhat/jenkins.io.key
yum install jenkins
修改默认配置
vi /etc/sysconfig/jenkins
JENKINS_USER="jenkins" Jenkins 会自动创建一个jenkins用户, 为了方便学习可以设置为root
JENKINS_PORT="8080" Jenkins 服务启动默认端口
配置Java路径
vi /etc/init.d/jenkins
找到如下配置, 检查本机的Java路径是否包含在里面,如果不存在则在最后加上
candidates="
/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
"
打开和关闭防火墙
firewall-cmd --zone=public --add-port=8080/tcp --permanent
firewall-cmd --zone=public --add-service=http --permanent
firewall-cmd --reload
firewall-cmd --list-all
启动
sudo service jenkins start
在浏览器输入 服务器IP地址:8080 => 192.168.74.74:8080 浏览会自动跳转到Jenkins初始化页面
获取初始化密码
vim /var/lib/jenkins/secrets/initialAdminPassword