服务器信息:


centos7.4  8C 8G 50G

部署过程

部署jdk
部署tomcat
部署maven
部署jenkins

安装jdk

下载地址

https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

下载包上传到服务器/opt下

执行如下命令

tar -zxvf /opt/jdk-8u191-linux-x64.tar.gz -C /usr/local
echo  'export JAVA_HOME=/usr/local/jdk1.8.0_191' >> /etc/profile
echo 'export PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/sbin' >> /etc/profile
source /etc/profile
java -veriosn

部署tomcat

下载地址

http://tomcat.apache.org/download-80.cgi

下载包上传到服务器/opt下

执行如下命令

tar -xvf /opt/apache-tomcat-9.0.30.tar.gz -C /usr/local
cd /usr/local
mv apache-tomcat-9.0.30 tomcat

修改启动端口,默认8080 vim /usr/local/tomcat/conf/server.xml

69     <Connector port="8087" protocol="HTTP/1.1"
70                connectionTimeout="20000"
71                redirectPort="8443" />

启动服务

/usr/local/tomcat/bin/startup.sh

部署maven

下载地址

https://mirror.bit.edu.cn/apache/maven/maven-3/3.1.1/binaries/

下载包上传到服务器/opt下

执行如下命令

tar -zxvf /opt/apache-maven-3.6.3-bin.tar.gz
mv apache-maven-3.6.3 /usr/local/maven3.6
echo 'export MAVEN_HOME=/usr/local/maven3.6' >> /etc/profile
echo 'export PATH=$PATH:$JAVA_HOME/bin:$MAVEN_HOME/bin' >> /etc/profile
source /etc/profile
mvn -v

部署jenkins

下载地址

pkg.jenkins.io/redhat-stable/

下载包上传到服务器/opt下

执行如下命令

rpm -ivh /opt/jenkins-2.222.3-1.1.noarch.rpm

添加jdk路径

vim /etc/rc.d/init.d/jenkins

 75 /etc/alternatives/java
 76 /usr/lib/jvm/java-1.8.0/bin/java
 77 /usr/lib/jvm/jre-1.8.0/bin/java
 78 /usr/lib/jvm/java-1.7.0/bin/java
 79 /usr/lib/jvm/jre-1.7.0/bin/java
 80 /usr/lib/jvm/java-11.0/bin/java
 81 /usr/lib/jvm/jre-11.0/bin/java
 82 /usr/lib/jvm/java-11-openjdk-amd64
 83 /usr/local/jdk1.8.0_191/bin/java
 84 /usr/bin/java

修改启动端口

vim /etc/sysconfig/jenkins

 56 JENKINS_PORT="8088"

启动服务 systemctl daemon-reload systemctl restart jenkins systemctl enable jenkins