How to run Jenkins as war file installation on Ubuntu 18.04

How to run Jenkins as war file installation on Ubuntu 18.04

Overview:

One of the alternate ways of installing Jenkins on server is to use WAR (Web Application Archive) file. Remember that is not recommended to use this way of installation for production environment

Run Jenkins as war file installation:

  1. Install Java JDK 8 dependency library:
    sudo apt install -y openjdk-8-jre
    
  2. Check if Java was installed properly:
    java -version
    
  3. Download Jenkins war file:
    wget http://mirrors.jenkins.io/war-stable/latest/jenkins.war
    
  4. Run Jenkins war file (--prefix flag specifies the URL path to access Jenkins dashboard):
    sudo java -jar jenkins.war --httpPort=80 --prefix=/dashboard
    
  5. After running the previous command you will get an output with initialAdmin password to configure Jenkins: jenkins
  6. Copy the password and unlock Jenkins server at /dashboard path: unlock

Notes:

  1. This way of running Jenkins server is not recommended to run in production environment
  2. WAR (Web application archive) file can be run on any platform where Java is installed

Reference:

  1. Jenkins war file download
  2. Difference between jar and war in Java