Install Jenkins on Debian


First of all add the key of the Jenkins server to apt:

wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | apt-key add -

Then create the sources.list entry or better create a file in /etc/apt/sources.list.d/:

echo "deb http://pkg.jenkins-ci.org/debian binary/" > /etc/apt/sources.list.d/jenkins.list

Then install the package:

apt-get update
apt-get install jenkins

Jenkins will by default run on port 8080, in order to have it respond on port 80 you could for example run an apache server with mod_proxy:

apt-get install apache2
a2enmod proxy proxy_http vhost_alias
a2dissite default

Create the file /etc/apache2/sites-available/jenkins with the following content:

<VirtualHost *:80>
    ServerAdmin webmaster@jenkins.example.net
    ServerName jenkins.example.net
    ServerAlias ci
    ProxyRequests Off
    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>
    ProxyPreserveHost on
    ProxyPass / http://localhost:8080/
</VirtualHost>

Now activate the new VHost and restart apache:

a2ensite jenkins
/etc/init.d/apache2 restart