This post is concerned with getting Jenkins going on your public server as quickly as possible whilst keeping things private.
$ sudo apt-get install jenkins
If we have a service running on port 8080 Jenkins won’t start.
$ sudo tail /var/log/jenkins/jenkins.log
In such a case, lets change the port, and we’ll do so in the config file.
$ sudo nano /etc/default/jenkins
If this is a public server, lets add in authentication, and we’ll take the quick route by adding the following to the end of the JENKINS_ARGS (naturally change the password to suit):
The configuration up to this point is not enough when it comes to a public web server, since the world at large can still see our main Jenkins page, but its a start, since at the very least we have administrative control. We would still want to run our service over https and add http basic authentication, with the latter entailing fronting Jenkins with Apache and configuring an AJP connector between Jenkins and Apache.
If you are in rush though, or just don’t want to install and administer Apache, you can use matrix-based security to disable read privileges for anonymous users, it is easy to lock out your sole admin user if you do this though, and if you do (as I did), you’ll have to shutdown Jenkins, edit /var/lib/jenkins/config.xml and in false in <useSecurity>true</useSecurity> and start it up again. All you’ll have to do is to follow the instructions on this page for matrix-based security exactly (the sign up step seems odd, but it seems necessary). After you have signed up, disable read access for the Anonymous user and you are good to go.
/usr/share/jenkins$ sudo service jenkins stop
/usr/share/jenkins$ sudo mv jenkins.war jenkins_old.war
/usr/share/jenkins$ sudo wget http://updates.jenkins-ci.org/download/war/1.480.3/jenkins.war
/usr/share/jenkins$ service jenkins start