Jenkins
Jenkins是一个开源软件项目,是基于Java开发的一种持续集成工具,用于监控持续重复的工作,旨在提供一个开放易用的软件平台,使软件的持续集成变成可能。
参照资料:
http://www.cnblogs.com/itech/archive/2011/11/23/2260009.html
http://www.cnblogs.com/shilin000/p/5244667.html
http://www.linuxidc.com/Linux/2017-06/144637.htm
https://www.liaoxuefeng.com/article/001463233913442cdb2d1bd1b1b42e3b0b29eb1ba736c5e000
jenkins软件下载地址:
https://pkg.jenkins.io/redhat-stable/
https://jenkins.io/download/ (推荐下载jenlins.war包)
安装java环境:CentOS-7-64
1、
######安装JDK######
jdk-8u65-linux-x64.rpm
安装前先卸载系统自动安装的:
#yum remove java -y
上传本地rpm包。
rpm安装Java运行环境:
#rpm -ivh jdk-8u65-linux-x64.rpm
查看安装版本:
#java -version
java version "1.8.0_65"
Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode)
修改环境变量:
#vim /etc/profile
JAVA_HOME=/usr/java/latest
PATH=$PATH:$JAVA_HOME/bin
export PATH JAVA_HOME USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL
#source /etc/profile
2、上传本地tar.gz包。
# tar zxf apache-tomcat-8.0.32.tar.gz
拷贝:
#mv apache-tomcat-8.0.32 /usr/local/tomcat-8.0.32
#cd /usr/local/tomcat-8.0.32
tomcat的配置文件:conf/server.xml
tomcat的日志文件:logs/
tomcat的网站与网页数据目录:webapps/
定义环境变量:
#vim /etc/profile
添加以下内容:(在之前行下添加以下三行)
CATALINA_HOME=/usr/local/tomcat-8.0.32
PATH=$PATH:$JAVA_HOME/bin:$CATALINA_HOME/bin
export PATH JAVA_HOME CATALINA_HOME USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL
#source /etc/profile
#####tomcat启动文件
#vim /etc/init.d/tomcat
#!/bin/sh
# Tomcat init script for Linux.
#
# chkconfig: 2345 77 88
# description: The Apache Tomcat servlet/JSP container.
case $2 in
start)
/usr/local/tomcat-8.0.32/bin/catalina.sh start ;;
stop)
/usr/local/tomcat-8.0.32/bin/catalina.sh stop ;;
restart)
/usr/local/tomcat-8.0.32/bin/catalina.sh stop
sleep 2
/usr/local/tomcat-8.0.32/bin/catalina.sh start ;;
*)
echo "the usage service tomcat {start|stop|restart}"
esac
#chmod +x /etc/init.d/tomcat
#添加至服务管理列表,并让其开机自动启动
#systemctl enable tomcat
#systemctl start tomcat
#netstat -antup|grep :80
管理端口号都应开启:8080、8005、8009
浏览器:http://本机IP:8080
出现tomcat界面、部署成功!!!
###部署jenkins###
# cp jenkins.war /usr/local/tomcat-8.0.32/webapps/
#vim /usr/local/tomcat-8.0.32/conf/server.xml
<Host name="jenkins.test.vip" appBase="webapps"
unpackWARs="true" autoDeploy="true">
<Context path="" docBase="jenkins" />
#/usr/local/tomcat-8.0.32/bin/catalina.sh stop
#/usr/local/tomcat-8.0.32/bin/catalina.sh start
浏览器:http://jenkins.test.vip:8080
出现jenkins界面
#vim /etc/nginx/conf.d/jenkins.conf
server {
listen 80;
server_name jenkins.test.vip;
location ~* / {
proxy_pass http://jenkins.test.vip:8080;
}
}
#vim /etc/hosts
本机IP jenkins.test.vip
#/usr/local/nginx/sbin/nginx -t
#/usr/local/nginx/sbin/nginx -s reload