环境配置
jenkins
java环境
yum install -y java
安装jenkins
wget -O /etc/yum.repos.d/jenkins.repo http:
//pkg.jenkins-ci.org/redhat/jenkins.repo
rpm --
import
http:
//pkg.jenkins-ci.org/redhat/jenkins-ci.org.key
yum install jenkins
配置jenkins端口
vi /etc/sysconfig/jenkins
启动
service jenkins start
管理员密码
vi /var/lib/jenkins/secrets/initialAdminPassword
gitlab
yum install curl policycoreutils openssh-server openssh-clients postfix
service postfix start
service sshd start
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash
sudo EXTERNAL_URL=”ip:port” yum -y install gitlab-ee
sudo mkdir -p /etc/gitlab
sudo touch /etc/gitlab/gitlab.rb
sudo chmod 600 /etc/gitlab/gitlab.rb
sudo gedit /etc/gitlab/gitlab.rb
配置
sudo vim /etc/gitlab/gitlab.rb
启动
sudo gitlab-ctl reconfigure
sudo gitlab-ctl status
Node
cd /usr/local/src
wget https://nodejs.org/dist/v6.11.1/node-v6.11.1-linux-x64.tar.xz
tar xvf node-v6.11.1-linux-x64.tar.xz
ln -s /usr/local/src/node-v6.11.1-linux-x64/bin/node /usr/local/bin/node
ln -s /usr/local/src/node-v6.11.1-linux-x64/bin/npm /usr/local/bin/npm
Pm2
npm install pm2 -g
ln -s /usr/local/src/node-v6.11.1-linux-x64/bin/pm2 /usr/local/bin/pm2
Nginx
yum install nginx
nginx -t
service nginx start
Rsync
rsync --daemon --config=/app/rsync/rsync.conf
# configuration example:
uid = root
gid = root
use chroot = yes
max connections = 4
read only = false
pid file = /var/run/rsyncd.pid
exclude = lost+found/
transfer logging = yes
timeout = 900
ignore nonreadable = yes
dont compress = *.gz *.tgz *.zip *.z *.Z *.rpm *.deb *.bz2
auth users=root
secrets file = /etc/rsync.password
[ftp]
path = /data
创建rsync.password jenkins服务器写密码 目标服务器写用户名:密码
chmod 600 /etc/rsync.password
配置服务器间免密登陆
ssh-keygen -t rsa
ssh-copy-id -i ~/.ssh/id_rsa.pub root@master
jenkins部署的shell脚本 jenkins需要root权限
WEB_SERVER_IP=
PROJECT=ftp/webserver/$JOB_NAME (rsync需要配置ftp模块)
rsync -rtav --password-file=/etc/rsync.password --delete-before $WORKSPACE/ root@$WEB_SERVER_IP::$PROJECT --exclude ".git"