Install Jenkins on Debian

How to install Jenkins on Debian?

This is the Debian package repository of Jenkins to automate installation and upgrade. To use this repository, first add the key to your system:

wget -q -O - | sudo apt-key add -

Then add the following entry in your /etc/apt/sources.list:

deb binary/

Update your local package index, then finally install Jenkins: 

sudo apt-get update
sudo apt-get install jenkins

Add the following config to your Nginx config, name it e.g:

It will contain content like this:

upstream app_server {
    server localhost:8080 fail_timeout=0;
server {
    listen 80;
    listen [::]:80 default ipv6only=on;
    rewrite ^ https://$server_name$request_uri? permanent;
server {
    listen 443 default ssl;
    access_log  /var/www/logs/;
    error_log  /var/www/logs/ error;
    ssl on;
    ssl_certificate     /etc/nginx/ssl/server.crt;
    ssl_certificate_key /etc/nginx/ssl/server.key;
    ssl_session_timeout 5m;
    ssl_protocols SSLv3 TLSv1;
    ssl_ciphers HIGH:!ADH:!MD5;
    ssl_prefer_server_ciphers on;
    location / {
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-Proto https;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_redirect http:// https://;
        add_header Pragma "no-cache";
        proxy_pass http://app_server;


Note that you also have to create a ssl key and certificate.

Now, you probably want to secure up your Jenkins.

Do this by going to: Configure Global Security.
Select enable security and choose: Jenkins’ own user database.

Important: select Allow users to sign up. This is needed to create your first user.
After you created that user, and logged in, you can update the security and deselect "Allow users to sign up".


Of course you will lock yourself out

Here you can undo this:

$ cd /var/lib/jenkins/
$ nano config.xml
$ set userSecurity to false: <userSecurity>false</userSecurity>Rep
$ sudo service jenkins restart