chwnpp 2018-11-17
1. 检查服务器包配置[可选]
一般不需要apt的额外配置, 如果有删除配置或者移动到别处, 使其不生效:
sudo rm /etc/apt/apt.conf sudo apt-get update
2. 安装JDK
jenkins依赖java, 安装java8+版本,并且配置java_home:
sudo apt search openjdk sudo apt-get install openjdk-8-jdk sudo vim /etc/bash.bashrc export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/
3. 安装jenkins
在ubuntu环境下安装:
wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add - sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list' sudo apt-get update sudo apt-get install jenkins
一些默认文件位置: |路径|描述| |---|---| |/etc/default/jenkins|jenkins运行配置| |jenkins|默认文件用户| |/var/log/jenkins/jenkins.log|日志路径| |/var/lib/jenkins/|jenkins home|
4. 高级设置
5. 遇到问题
sudo easy_install supervisor echo_supervisord_conf > supervisord.conf sudo mv supervisord.conf /etc/supervisord.conf sudo vim /etc/supervisord.conf # 修改include为files = /etc/supervisor/*.conf sudo mkdir -p /etc/supervisor sudo vim /etc/supervisor/jenkins-slave-agent.conf
[program:jsa] directory = /var/lib/jenkins/ command = java -jar agent.jar -jnlpUrl http://slave.server.ip:8080/computer/slave-01/slave-agent.jnlp -secret 2a99268dbfc5d5f4c517d237d48078b1163f -workDir "/var/lib/jenkins/" autostart = true autorestart = true user = jenkins redirect_stderr = true stdout_logfile = /var/lib/jenkins/jenkins-slave-agent.log
sudo supervisorctl reread # 读取新配置 sudo supervisorctl update # 启动更新 sudo supervisorctl status # 查看状态 sudo supervisorctl stop jsa # 停止一个子进程 sudo supervisorctl start jsa # 启动一个子进程 sudo supervisorctl restart jsa # 重启一个子进程