Jenkins Tomcat 环境搭建

1、安装Java环境

Java环境安装
yum install lrzsz vim -y
yum install java-1.8.0-openjdk java-1.8.0-openjdk-devel -y
java -version

 

 

 2、 安装和配置Tomcat

安装

tar -xzf apache-tomcat-8.5.57.tar.gz 
mv apache-tomcat-8.5.57 /usr/local/tomcat

 

 

 配置

Tomcat发布Jenkins,将Jenkins war拷贝至Tomcat默认发布目录,并使用jar工具解压,启动Tomcat服务即可,代码如下:

rm -rf /usr/local/tomcat/webapps/*
mkdir -p /usr/local/tomcat/webapps/ROOT/
mv jenkins.war /usr/local/tomcat/webapps/ROOT/
cd /usr/local/tomcat/webapps/ROOT/
jar –xvf jenkins.war;rm -rf Jenkins.war
sh /usr/local/tomcat/bin/startup.sh

 设置systemctl 启动

编辑/usr/lib/systemd/system/jenkins.service, 内容如下
[Unit]
Description=jenkins
After=network.target
[Service]
Type=simple
ExecStart=/usr/local/tomcat/bin/catalina.sh start
ExecReload=/usr/local/tomcat/bin/catalina.sh restart
ExecStop=/usr/local/tomcat/bin/catalina.sh stop

[Install]
WantedBy=multi-user.target

 测试

systemctl start jenkins
systemct status jenkins

 

 

 登录成功

 

posted @ 2020-08-26 11:16  JPinsz  阅读(513)  评论(0编辑  收藏  举报