目录
安装jdk
安装maven
安装Jenkins
SpringBoot部署
VUE部署
安装Apache Tomcat
查看已安装版本
rpm -qa | grep java
卸载已安装jdk
rpm -e --nodeps java-1.8.0-openjdk-1.8.0.352.b08-2.el7_9.x86_64
yum命令查找JDK11软件包(最新jenkins最低要求11版本)
yum -y list java-*
安装列表中的JDK11软件包
yum -y install java-11-openjdk-devel.x86_64
java -version
wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo
yum -y install apache-maven
wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo
rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
修改用户和分组
vim /usr/lib/systemd/system/jenkins.service
更改所有权
chown -R root:root /var/lib/jenkins
chown -R root:root /var/cache/jenkins
chown -R root:root /var/log/jenkins
启动服务
systemctl daemon-reload
systemctl start jenkins.service
或者
/etc/init.d/jenkins restart
添加安全组策略
远程访问
查看密码
cat /var/lib/jenkins/secrets/initialAdminPassword
创建用户
修改密码
安装需要插件
新建任务
源码管理
构建触发器
clean install -Dmaven.test.skip=true
保存
添加执行后操作
mv /var/lib/jenkins/workspace/boot/ruoyi-admin/target/ruoyi-admin.jar /usr/local/springboot-apps/ruoyi-admin.jar
cd /usr/local/springboot-apps
sh ruoyi-admin.sh
重新构建
下载node
curl -sL https://rpm.nodesource.com/setup_16.x | bash -
安装node
yum install -y nodejs
node -v
npm -v
安装插件
添加git地址,然后添加shell
node -v
npm -v
cd /var/lib/jenkins/workspace/RuoYi-Vue3
npm install
npm run build:stage
cd /usr/local/springboot-apps
rm -rf ruoyi-ui
mv /var/lib/jenkins/workspace/RuoYi-Vue3/ruoyi-ui ruoyi-ui
执行构建
下载Tomcat 8安装包
wget --no-check-certificate https://labfileapp.oss-cn-hangzhou.aliyuncs.com/apache-tomcat-8.5.72.tar.gz
解压Tomcat 8安装包
tar -zxvf apache-tomcat-8.5.72.tar.gz
mv apache-tomcat-8.5.72 /usr/local/tomcat/
将文件的所属用户设置为www
chown -R www.www /usr/local/tomcat/
修改端口
vim /usr/local/tomcat/conf/server.xml
启动tocmat
/usr/local/tomcat/bin/startup.sh
添加安全组规则
远程访问