搭建jenkins
1.wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo
2.rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key
3.yum install jenkins
4.yum install java-1.8.0-openjdk
配置
vim /etc/sysconfig/jenkins
JENKINS_PORT="8080"
JENKINS_JAVA_CMD="$candidate"
JENKINS_USER="root"
下载java
去官方下载jdk包(https://www.oracle.com/java/technologies/javase-downloads.html)
解压到/usr/bin/java里面
vim /etc/profile
#java environment
export JAVA_HOME=/usr/bin/java/jdk-15.0.1
export CLASSPATH=.:${JAVA_HOME}/jre/lib/rt.jar:${JAVA_HOME}/lib/dt.jar:${JAVA_HOME}/lib/tools.jar
export PATH=$PATH:${JAVA_HOME}/bin
source /etc/profile
vim /etc/init.d/jenkins
/setup/tools/jdk1.8.0_144/bin/java #此处为加入的java路径
/etc/alternatives/java
/usr/lib/jvm/java-1.8.0/bin/java
/usr/lib/jvm/jre-1.8.0/bin/java
/usr/lib/jvm/java-1.7.0/bin/java
/usr/lib/jvm/jre-1.7.0/bin/java
/usr/bin/java/jdk-15.0.1/bin/java
systemctl daemon-reload
service jenkins start
登录并加载
初次的密码
cat /var/lib/jenkins/secrets/initialAdminPassword
添加秘钥
其中一个比较重要的点就是你的git仓库的ssh的秘钥要添加一个环境代码仓库的对应的JENKINS_USER的秘钥
jenkins配置项目
在jenkins中新建项目,绑定git,
也可以自己追加相关构建脚本,
像是composer update之类的
然后把目录cp到真正的项目目录
或者推送到其他的代码服务器等操作