Jenkins 2.103

wget http://download.oracle.com/otn-pub/java/jdk/8u161-b12/2f38c3b165be4555a1fa6e98c45e0808/jdk-8u161-linux-x64.tar.gz
tar -zxvf jdk-8u161-linux-x64.tar.gz
mv jdk1.8.0_161 /usr/local/

vi /etc/profile
#在文件末尾追加如下内容:
export JRE_HOME=/usr/local/jdk1.8.0_161/jre
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:/lib/tools.jar:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$PATH

使用生效
source /etc/profile

安装java
alternatives --install /usr/bin/java java /usr/local/jdk1.8.0_161/bin/java 300
选择java版本
[root@master ~]# alternatives --config java

共有 3 个程序提供“java”。

选择 命令

*+ 1 /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java
2 /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java
3 /usr/local/jdk-9.0.4/bin/java

按 Enter 来保存当前选择[+],或键入选择号码:3

wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat/jenkins.repo
rpm --import https://pkg.jenkins.io/redhat/jenkins.io.key
yum clean all
yum makecache
yum install -y jenkins
service jenkins start
访问http://192.168.56.20:8080
提示查看密码
more /var/lib/jenkins/secrets/initialAdminPassword

输入密码后进行安装
安装社区推荐的插件

然后进行用admin登录

然后安装maven
wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo
yum -y install apache-maven


第二种安装方法直接安装jenkins

wget http://mirrors.jenkins.io/war-stable/latest/jenkins.war
java -jar jenkins.war --httpPort=8080.
http://localhost:8080.