【前置条件】系统centos6.8
1、创建cis用户
useradd 22
passwd 22 ——设置密码
2、准备jenkins运行环境
mkdir -p /disk1/jenkins
mkdir -p /disk1/jenkins-config/config/
mkdir /disk1/PackageServerForIflytek/
mkdir -p /disk2/PackageServe{}
chown -R cis. /disk1
chown -R cis. /disk2
mount -t cifs //url/IFLY_CI /disk1/PackageServerForIflytek -o username=USERNAME,password='PASSWORD',rw,user,uid=UID
3、安装JDK
mkdir /usr/local/jdk/
tar xf jdk-1.8.0_65.tar.gz -C /usr/local/jdk/
ln -s /usr/local/jdk/jdk1.8.0_65/bin/java /usr/bin/java
cat >> /etc/profile.d/env.sh << EOF
修改软连接export LANG=en_US.UTF-8
export JAVA_HOME=/usr/local/jdk/jdk1.8.0_65
export PATH=$JAVA_HOME/bin:$PATH
EOF
rm -rf /usr/bin/java
ln -s /usr/local/jdk
4、安装jenkins
rpm -ivh jenkins-2.89.4-1.1.noarch.rpm
5、修改jenkins配置以及部分权限
chown cis. -R /var/cache/jenkins/
chown cis. -R /var/log/jenkins/
修改配置:
/etc/sysconfig/jenkins
JENKINS_HOME
JENKINS_USER
JENKINS_PORT
JENKINS_JAVA_OPTIONS ——此选项可咨询开发进行配置
6、安装git、expect、maven
yum -y install expect
git需要使用源码进行安装
yum -y install curl-devel openssl-devel zlib-devel zlib perl-ExtUtils-MakeMaker package gettext-devel
wget --user=22--password=22http://ip/slave-env/git-1.9.0.tar.gz
tar xf git-1.9.0.tar.gz
cd git-1.9.0
./configure --prefix=/usr/local/git && make && make install
ln -s /usr/local/git/bin/git /usr/bin/git
修改/etc/profile.d/env.sh
export PATH=$JAVA_HOME/bin:$PATH
to
export PATH=$JAVA_HOME/bin:/usr/local/git/bin:$PATH
source /etc/profile.d/env.sh
git --version
git version 1.9.0
wget --user=cis --password=cishttp://ip/slave-env/apache-maven-3.3.9-bin.tar.gz
tar xf apache-maven-3.3.9-bin.tar.gz -C /disk1
ln -s /disk1/apache-maven-3.3.9/bin/mvn /usr/bin/mvn
7、配置smb共享服务(临时包共享)
yum -y install samba
修改配置文件
/etc/samba/smb.conf
[global]
workgroup = CIS-Workgroup
netbios name = CIS-Samba
server string = CIS-Samba-Server
security = share
[PackageServer]
path = /disk2/PackageServer
writeable = no
browseable = yes
guest ok = yes
启动Samba服务
smbd -D
chkconfig smb on --开机自启动
以上完成jenkins ci安装。
如果是jenkins升级,需要将低版本的jenkins的JENKINS_HOME完整的拷贝到新版本的JENKINS_HOME中,拷贝完成需要修改:
1、系统配置中的jenkins url
2、所有节点中的slave.jar或者agent.jar需要更新
3、涉及到jdk版本变化时,需要将对应的jdk版本升级(就是安装jdk,配置默认或者使用绝对路径执行)
4、涉及到其他变化,如插件更新等,咨询开发进行处理
Jenkins升级步骤:
service jenkins stop
wgethttp://pkg.jenkins-ci.org/redhat/jenkins-2.147-1.1.noarch.rpm
rpm -Uvh jenkins-2.147-1.1.noarch.rpm
service jenkins start
以上完成Jenkins升级
网友评论