虚拟就Ubuntu 14.0.4 安装配置jenkins
安装java,配置环境变量
● 下载jdk8 gz包到用户目录
● /usr/lib/下创建jvm目录,将jdk解压到此目录 sudo tar xvf jdk-8u25-linux-x64.tar.gz /usr/lib/jvm
● sudo vim ~/.profile 在尾部添加
export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_151 export JRE_HOME=${JAVA_HOME}/jre export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib export PATH=${JAVA_HOME}/bin:$PATH
安装配置Tomcat
● sudo apt-get install tomcat7 ● sudo apt-get install tomcat7-docs tomcat7-admin tomcat7-examples ● sudo nano /etc/tomcat7/tomcat-users.xml 设置管理员账户密码
<tomcat-users> <user username="admin" password="password" roles="manager-gui,admin-gui"/> </tomcat-users>
安装jenkins
● wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add - ● sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list' ● sudo apt-get update -y ● sudo apt-get install jenkins -y
升级jdk7到jdk8
● sudo add-apt-repository ppa:openjdk-r/ppa ● sudo apt-get update ● sudo apt-get install openjdk-8-jdk ● sudo update-alternatives --config java, 调整使用的jdk版本
安装文件位置
● 安装目录:/var/lib/jenkins
● 日志目录:/var/log/jenkins/jenkins.log
修改jenkins运行端口(Tomcat也使用8080端口,jenkins可更新为8082)
● 修改/etc/default/jenkins文件,将端口8080改成8082
启动/停止
● sudo /etc/init.d/jenkins start ● sudo /etc/init.d/jenkins stop
访问(当前IP,外部访问取虚拟机IP即可)
● http://192.168.1.100:8082/