参考
http://zlrzlm7454.iteye.com/blog/2322307
http://www.cnblogs.com/h--d/p/5673085.html
安装之前请确保你已经安装好JDK,Tomcat,Maven。
1、导入Jenkins key,安装
sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
yum install jenkins
2、修改配置
[root@iZ94zsv4mnfZ ~]# vim /etc/sysconfig/jenkins
修改如下配置:
#避免执行脚本时权限不足
JENKINS_USER="root"
#默认为8080 与tomcat的端口冲突了这里我修改为8888,如你的8080端口未被占用,可以不改
JENKINS_PORT="8888"
JENKINS_USER我这里设置了root需要为root赋予访问jenkins的权限
[root@iZ94zsv4mnfZ ~]# chown -R root /var/log/jenkins
[root@iZ94zsv4mnfZ ~]# chgrp -R root /var/log/jenkins
[root@iZ94zsv4mnfZ ~]# chown -R root /var/lib/jenkins
[root@iZ94zsv4mnfZ ~]# chgrp -R root /var/lib/jenkins
[root@iZ94zsv4mnfZ ~]# chown -R root /var/cache/jenkins
[root@iZ94zsv4mnfZ ~]# chgrp -R root /var/cache/jenkins
再修改另一处配置
[root@iZ94zsv4mnfZ ~]# vim /etc/init.d/jenkins
找到
candidates="
/etc/alternatives/java
/usr/lib/jvm/java-1.6.0/bin/java
/usr/lib/jvm/jre-1.6.0/bin/java
/usr/lib/jvm/java-1.7.0/bin/java
/usr/lib/jvm/jre-1.7.0/bin/java
/usr/lib/jvm/java-1.8.0/bin/java
/usr/lib/jvm/jre-1.8.0/bin/java
/usr/bin/java
在/usr/bin/java上面添加一行:/usr/java/jdk1.8.0_102/bin/java 前面是你的java安装路径。
最终如下
candidates="
/etc/alternatives/java
/usr/lib/jvm/java-1.6.0/bin/java
/usr/lib/jvm/jre-1.6.0/bin/java
/usr/lib/jvm/java-1.7.0/bin/java
/usr/lib/jvm/jre-1.7.0/bin/java
/usr/lib/jvm/java-1.8.0/bin/java
/usr/lib/jvm/jre-1.8.0/bin/java
/usr/java/jdk1.8.0_102/bin/java
/usr/bin/java
3启动
[root@iZ94zsv4mnfZ ~]# service jenkins start
启动完成后即可登录http://IP:8888/访问Jenkins
第一次登录Jenkins 会要求解锁
404-1410337228.png">
[root@iZ94zsv4mnfZ ~]# cat /var/lib/jenkins/secrets/initialAdminPassword
957fef857878401497edeed960c01b0d
输入上面的字符串
输入完成后会提示安装自定义插件还是推荐插件,此处我们选择推荐插件:
图片" width="700" height="464" style="border:0px;" src="http://dl2.iteye.com/upload/attachment/0119/7858/4c525f87-4bde-37a6-b4ac-94b42d538ec5.png">
然后等待安装完成后
图片" width="700" height="483" style="border:0px;" src="http://dl2.iteye.com/upload/attachment/0119/7860/d9f733aa-ace8-339b-84fd-77aa1a570756.png">
图片" width="700" height="469" style="border:0px;" src="http://dl2.iteye.com/upload/attachment/0119/7865/09472625-bde3-3412-bc4e-bf5e27087991.png">
图片" width="700" height="512" style="border:0px;" src="http://dl2.iteye.com/upload/attachment/0119/7867/dd00f3f3-ef0e-3126-83d3-e7894bd0e50a.png">
图片" width="699" height="506" style="border:0px;" src="http://dl2.iteye.com/upload/attachment/0119/7873/cf3350c2-b93f-301d-bc53-f718b1aab76a.png">
安装maven插件
依次进入 系统管理->管理插件 点击可选插件,搜索 Maven Integration plugin 勾选上 点击直接安装
4、配置环境
进入 系统管理->Global Tool Configuration
JDK
图片" width="700" height="194" style="border:0px;" src="http://dl2.iteye.com/upload/attachment/0119/7884/7255e032-0a95-3a9a-a4b1-34ba5686ef9d.png">
MAVEN
图片" width="700" height="236" style="border:0px;" src="http://dl2.iteye.com/upload/attachment/0119/7888/dfe6662d-b128-300d-b7c6-5ae45dc4ec94.png">
点击save
原文链接:https://www.f2er.com/centos/377258.html