标签:
On Debian-based distributions, such as Ubuntu, you can install Jenkins through apt-get.
Recent versions are available in an apt repository. Older but stable LTS versions are in this apt repository.
You need to have a JDK and JRE installed. openjdk-7-jre and openjdk-7-jdk are suggested. As of 2011-08 gcj is known to be problematic - see https://issues.jenkins-ci.org/browse/JENKINS-743.
Please make sure to back up any current Hudson or Jenkins files you may have.
wget -q -O - https://jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add - sudo sh -c ‘echo deb http://pkg.jenkins-ci.org/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list‘ sudo apt-get update sudo apt-get install jenkins
Once installed like this, you can update to the later version of Jenkins (when it comes out) by running the following commands:
sudo apt-get update sudo apt-get install jenkins
(aptitude or apt-get doesn‘t make any difference.)
If your /etc/init.d/jenkins file fails to start jenkins, edit the /etc/default/jenkins to replace the line
HTTP_PORT=8080 by HTTP_PORT=8081 Here, 8081 was chosen but you can put another port available. |
The Ubuntu Jenkins maintainer also maintains the Juju charm deployment/management script for deployment in clouds. It‘s designed to make it easy to deploy a master with multiple slaves:
juju deploy jenkins juju deploy -n 5 jenkins-slave juju add-relation jenkins jenkins-slave
The default password for the ‘admin‘ account will be auto-generated. You can set it using:
juju set jenkins password=mypassword
Always change it this way - this account is used by the charm to manage slave configuration. Then feel free to expose your jenkins master:
juju expose jenkins
#Requests from outside iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8080 #Requests from localhost iptables -t nat -I OUTPUT -p tcp -d 127.0.0.1 --dport 80 -j REDIRECT --to-ports 8080
Now reboot or run sudo /etc/rc.local to enable port forwarding. Additional info: https://gist.github.com/m5m1th/6870a54717c0387468c3
do not do this next command if you already have virtual hosting setup that depends on the default site. See my comment below - danapsimer |
If you get ERROR: Site default does not exist! then try this instead:
And if all else fails just have a look if there is a default site set up at all:
|
<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>
This configuration will setup Nginx to proxy port 80 to 8080 so that you can keep Jenkins on 8080. Instructions originally found in a GitHub Gist from rdegges: https://gist.github.com/913102
sudo aptitude -y install nginx
cd /etc/nginx/sites-available
sudo rm default ../sites-enabled/default
sudo cat > jenkins
upstream app_server {
server 127.0.0.1:8080 fail_timeout=0;
}
server {
listen 80;
listen [::]:80 default ipv6only=on;
server_name ci.yourcompany.com;
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
if (!-f $request_filename) {
proxy_pass http://app_server;
break;
}
}
}
^D # Hit CTRL + D to finish writing the file
sudo ln -s /etc/nginx/sites-available/jenkins /etc/nginx/sites-enabled/
sudo service nginx restart
标签:
原文地址:http://www.cnblogs.com/ruiy/p/5600345.html