Once installed like this, you can update to the later version of Jenkins (when it comes out) by running the following commands:
1 2 3 4
sudo apt-get update sudo apt-get install jenkins
(aptitude or apt-get doesn’t make any difference.)
Jenkins will be launched as a daemon up on start. See /etc/init.d/jenkins for more details.
The 'jenkins' user is created to run this service.
Log file will be placed in /var/log/jenkins/jenkins.log. Check this file if you are troubleshooting Jenkins.
/etc/default/jenkins will capture configuration parameters for the launch like e.g JENKINS_HOME
By default, Jenkins listen on port 8080. Access this port with your browser to start configuration.
安装后的配置
Setting up an Apache Proxy for port 80 -> 8080
This configuration will setup Apache2 to proxy port 80 to 8080 so that you can keep Jenkins on 8080.
Create a file called jenkins.conf in /etc/apache2/sites-available
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
<VirtualHost *:80> ServerAdmin webmaster@localhost ServerName ci.company.com ServerAlias ci ProxyRequests Off <Proxy *> Order deny,allow Allow from all </Proxy> ProxyPreserveHost on ProxyPass / http://localhost:8080/ nocanon AllowEncodedSlashes NoDecode </VirtualHost>
重启
1 2
sudo a2ensite jenkins sudo apache2ctl restart
设置apache的反向代理,可以把8080端口重定向到80端口
主要是添加下面三行
1 2 3
ProxyPreserveHost on ProxyPass / http://localhost:8080/ nocanon AllowEncodedSlashes NoDecode
import jenkins.model.*; for (slave in Jenkins.instance.slaves) { def comp=slave.computer; if(comp.name.contains("bf-")){ println comp.name comp.connect(true) } } import jenkins.model.*; for (slave in Jenkins.instance.slaves) { def comp=slave.computer; if(comp.name.contains("bf-")){ println comp.name comp.disconnect() } }
1 2 3 4 5 6 7 8 9 10
for (aSlave in hudson.model.Hudson.instance.slaves) { if(aSlave.name.contains("xxx-xx")){ println aSlave.name computer = aSlave.getComputer(); computer.disconnect(null) //computer.setTemporarilyOffline(true) // To Disable all Nodes // computer.setTemporarilyOffline(false) -- To Enable all nodes. } }