Running Jenkins in local, what I learned

Jenkins is an open source automation server written in Java and is highly valuable when it comes to Continuous Integration (CI) and Continuous Delivery (CD).

I started to explore more about Jenkins in the recent months, even though previously I was its end-user. It is quite amazing and there are many things to learn. Here, I summarized few things I have learned while I was running Jenkins in my local.

Installation

There are two options available when it comes to installing Jenkins in Linux, Ubuntu in my case.

  • Installing via apt, yum or zippy.
  • Download from Jenkins site (war file, deb file, etc.).

My advice if you don’t need have any restrictions, don’t even bother to go with the first option. Installing via package manager sometimes is troublesome.

Start/Stop/Restart Jenkins manually

Like any other services, Jenkins service is available at /etc/init.d/jenkins. So you can easily restart, start, stop it.

$ sudo /etc/init.d/jenkins stop/start/restart

If you got Not Configured to run standalone error, just edit the file at /etc/default/jenkins and set RUN_STANDALONE to true.

RUN_STANDALONE=true

Disable Jenkins autostart (Ubuntu)

Edit the file /etc/default/jenkins and revert RUN_STANDALONE to false 😀

RUN_STANDALONE=false

Change Jenkins default port

Just edit the file located at /etc/default/jenkins and then change HTTP_PORT. For instance,

HTTP_PORT=8888

Then restart Jenkins service.

Recovering admin password

If you have forgotten your initial Jenkins admin password, no worries with two commands you can recover it easily,

$ sudo su -
# xclip -sel clip < /var/lib/jenkins/secrets/initialAdminPassword

Then, the password should be copied in your clipboard.

Leave a Reply