jenkins安装部署

一、安装启动jenkins

 1、sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo --no-check-certificate
 2、rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
 3、yum install jenkins
 4、systemctl start jenkins

二、修改jenkins默认工作空间

vim /etc/sysconfig/jenkins

将参数修改为JENKINS_HOME="/data/jenkins/workspace"

重新启动jenkins

三、使用脚本定时备份清理日志保留30天

脚本内容

#!/bin/bash

date=`date +"%Y%m%d"`
cat /var/log/jenkins/jenkins.log > /data/wwwlogs/jenkins_log/jenkins.log_$date
echo /dev/null >/var/log/jenkins/jenkins.log
find /data/wwwlogs/jenkins_log -mtime +29 -exec rm -f {} \;

四、设置开机自启动

jenkins:systemctl enable jenkins

nginx:在rc.local执行nginx

posted @ 2021-12-07 16:03  白小纯123  阅读(61)  评论(0编辑  收藏  举报