jenkins yum 安装
jenkins 用过yum的方式安装:服务的启动和关闭等管理会很方便,版本升级也会变的很容易。
参考官方的说明:https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+on+Red+Hat+distributions
- jenkins安装
#将jenkins的稳定版加入到yum 库中
sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo
sudo rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key
#安装jenkins
sudo yum install jenkins
#jenkins 需要jdk1.8,如果低于1.8,启动jenkins会报错。
#安装jdk1.8
yum remove java
rpm -ivh jdk-8u144-linux-x64.rpm
- 启动或停止jenkins
sudo service jenkins start/stop/restart
sudo chkconfig jenkins on
- 修改jenkins默认的端口和启动用户
sudo vi /etc/sysconfig/jenkins
## Type: string
## Default: "jenkins"
## ServiceRestart: jenkins
#
# Unix user account that runs the Jenkins daemon
# Be careful when you change this, as you need to update
# permissions of $JENKINS_HOME and /var/log/jenkins.
#
JENKINS_USER="hadoop"
## Type: integer(0:65535)
## Default: 8080
## ServiceRestart: jenkins
#
# Port Jenkins is listening on.
# Set to -1 to disable
#
JENKINS_PORT="8099"
- 修改jenkins默认的java的启动参数:
sudo vi /etc/sysconfig/jenkins
#支持设置邮件发送starttls和信任列表
JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true -Dmail.smtp.starttls.enable=true -Dmail.smtp.auth=true -Dmail.smtp.ssl.trust=mail.service.mtime.com"
- 如果修改默认启动用户,需要修改如下几个目录的权限
sudo rm -rf /var/cache/jenkins/*
sudo rm -rf /var/lib/jenkins/*
sudo chown -R hadoop:hadoop /var/log/jenkins
sudo chown -R hadoop:hadoop /var/cache/jenkins/
sudo chown -R hadoop:hadoop /var/lib/jenkins
- 原有的jenkins配置拷贝到jenkins默认的目录下
cp -R .jenkins/* /var/lib/jenkins/
- 启动jenkins
sudo service jenkins start
sudo service jenkins status
历史任务配置迁移后的异常:
WARNING: Could not create Trilead support class. Using legacy Trilead features
java.lang.ClassNotFoundException: hudson.plugins.sshslaves.verifiers.JenkinsTrilead9VersionSupport
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:450)
at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:403)
at hudson.plugins.sshslaves.verifiers.TrileadVersionSupportManager.createVersion9Instance(TrileadVersionSupportManager.java:51)
at hudson.plugins.sshslaves.verifiers.TrileadVersionSupportManager.getTrileadSupport(TrileadVersionSupportManager.java:32)
at hudson.plugins.sshslaves.verifiers.SshHostKeyVerificationStrategy.getPreferredKeyAlgorithms(SshHostKeyVerificationStrategy.java:68)
at hudson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:797)
at hudson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:793)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
jenkin --> 系统配置 --> 节点管理:
Host Key Verification Strategy 选择:non verifying verification Strategay.
重启之后就没了。