1、系统环境和安装java环境
[root@devops ~]# cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
安装java环境
tar xf jdk1.8.0_121.tar.gz -C /usr/local
配置环境变量
export JAVA_HOME=/usr/local/jdk1..0_121
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
2、安装jenkins
cd /etc/yum.repos.d/
wget http://pkg.jenkins.io/redhat/jenkins.repo
rpm --import http://pkg.jenkins.io/redhat/jenkins.io.key
yum install -y jenkins
systemctl start jenkins
3、访问jenkins
在浏览器中输入http://IP:8080,查看密码 cat /var/lib/jenkins/secrets/initialAdminPassword
选择推荐
安装插件
创建管理员用户
成功登陆后的主页面
jenkins无法启动的小插曲
如果你是解压安装的jdk环境,启动jenkins会出现如下报错:
Apr 01 10:33:10 devops jenkins[27326]: Starting Jenkins bash: /usr/bin/java: No such file or directory
解决办法
修改/etc/init.d/jenkins,增加截图所示这行: