Prerequisites
Minimum hardware requirements:
256 MB of RAM
1 GB of drive space (although 10 GB is a recommended minimum if running Jenkins as a Docker container)
Recommended hardware configuration for a small team:
1 GB+ of RAM
50 GB+ of drive space
Sofware requirements:
Java 8 - either a Java Runtime Environment (JRE) or a Java Development Kit (JDK) is fine
Note: This is not a requirement if running Jenkins as a Docker container.
查看系统版本
[root@localhost logs]# uname -a
Linux localhost.localdomain 2.6.32-696.el6.i686 #1 SMP Tue Mar 21 18:53:30 UTC 2017 i686 i686 i386 GNU/Linux
[root@localhost logs]# getconf LONG_BIT
32
1、安装JDK运行环境
//下载JDK安装包(oracle官网下载最新jdk-8u162-linux-i586.tar.gz)
//解压JDK安装包
tar -zxvf jdk-8u162-linux-i586.tar.gz /usr/local/
//设置环境变量
vi /etc/profile
export JAVA_HOME=/usr/local/jdk1.8.0_162
export CLASSPATH=.:$JAVA_HOME/lib.tools.jar
export PATH=$JAVA_HOME/bin:$PATH
//更新环境变量
source /etc/profile
//检查java版本
[root@localhost ~]# java -version
java version "1.8.0_162"
Java(TM) SE Runtime Environment (build 1.8.0_162-b12)
Java HotSpot(TM) Server VM (build 25.162-b12, mixed mode)
2、安装Tomcat环境
//下载Tomcat安装包(apache官网下载最新apache-tomcat-9.0.6)
//解压Tomcat安装包
tar –zxvf apache-tomcat-9.0.6.tar.gz
//查看默认端口是否占用
netstat -antp
//修改Tomcat默认端口
vi /devops/apache-tomcat-9.0.6/conf/server.xml
#默认端口
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
#修改后端口
<Connector port="9080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
//其他端口根据实际情况修改
//启动Tomcat服务
cd /devops/apache-tomcat-9.0.6/bin
./startup.sh start
//停止Tomcat服务
./startup.sh stop
//重启Tomcat服务
./startup.sh restart
3、部署Jenkins程序
//复制jenkins war包到Tomcat webapps目录
cp jenkins.war /devops/apache-tomcat-9.0.6/webapps
//Jenkins hash密码值
cat /root/.jenkins/secrets/initialAdminPassword