一、安装包下载:
1. jdk-8u152-linux-x64.tar.gz下载:
wget http://download.oracle.com/otn-pub/java/jdk/8u152-b16/aa0333dd3019491ca4f6ddbe78cdb6d0/jdk-8u152-linux-x64.tar.gz?AuthParam=1510049032_894becb76e01031b3099aafc33c5a06c
2. maven-3/3.3.9下载:
wget http://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
3. jenkins-2.88-1.1下载:
wget https://prodjenkinsreleases.blob.core.windows.net/redhat/jenkins-2.88-1.1.noarch.rpm
二、安装
1. jdk安装:
tar -zxvf jdk-8u152-linux-x64.tar.gz
然后拷贝至自己安装软件的地方(我的是:/home/work/zach/soft/jdk1.8.0_152)
2. maven安装:
tar -zxvf apache-maven-3.3.9-bin.tar.gz
然后拷贝至自己安装软件的地方(我的是:/home/work/zach/soft/maven)
3. jenkins安装:
rpm -ivh jenkins-2.88-1.1.noarch.rpm
jenkins默认安装至 /var/lib/jenkins
三、配置:
1. jdk与maven:
vim /etc/profile
unset i
unset -f pathmunge
export JAVA_HOME=/home/work/zach/soft/jdk1.8.0_152
export MAVEN_HOME=/home/work/zach/soft/maven
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=$JAVA_HOME/bin:$MAVEN_HOME/bin:$PATH
保存后执行:source /etc/profile
2. 启动jenkins前需修改 /etc/rc.d/init.d/jenkins:
vim /etc/rc.d/init.d/jenkins
注:蓝色字体为修改部分。
四、权限问题
1. Open up the this script (using VIM or other editor):
vim /etc/sysconfig/jenkins
2. Find this $JENKINS_USER and change to “root”:
$JENKINS_USER="root"
3. Then change the ownership of Jenkins home, webroot and logs:
chown -R root:root /var/lib/jenkins
chown -R root:root /var/cache/jenkins
chown -R root:root /var/log/jenkins
4) Restart Jenkins and check the user has been changed:
service jenkins restart