1. Home
  2. Docs
  3. GCP Marketplace
  4. GCP Jenkins on Ubuntu 20.04

GCP Jenkins on Ubuntu 20.04

This documentation describes Classmethod Canada’s Jenkins product listed on the Google Cloud Marketplace.

This product provides a single node Jenkins 2.222 server running on the Ubuntu 20.04 LTS with Nginx 1.12.

Setup wizard

Once you open the top page with your browser (http://{your-jenkins-address}:8080), you will see the Jenkins setup wizard as below.

Make sure you allow HTTP / HTTPS access when you launch the VM instance.

Jenkins initial password

You can find Jenkins initial password from EC2 management console System Log.

  • You can also SSH into your instance and find the login credential using the following command.
$ cat /home/ubuntu/credentials
////////////////////credentials info////////////////////
--- Jenkins
----- User: admin
----- Password : kuQuai0aiQu2ohjohxai2Phe8pohyach
////////////////////////////////////////////////////////

Jenkins setup wizard

Input initial password, "kuQuai0aiQu2ohjohxai2Phe8pohyach" in this case, and click “Continue”.

You will see plugin selection page as below.

For simplicity, click “Install suggested plugins”, and Jenkins will automatically install recommended plugins. This may take a few minutes.

Once plugin installation is done, setup wizard will ask you to create admin user. Specify your admin account detail, and click “Save and Continue”.

If you have setup a specific domain and fixed IP address for Jenkins, you can setup Jenkins URL here. If not, you can proceed with the default URL. NOTES: This default address is AWS assigned automatically. AWS will release this public IP address when the instance is stopped or terminated.

Finally, Jenkins is ready, click “Start using Jenkins”.

If the page doesn’t automatically refresh after a minute, open http://{your-jenkins-address}:8080/restart and click “Yes” to restart Jenkins.

After Jenkins restart, you will see login page as below. Fill out admin account you have setup above and login.

Reset Jenkins Admin users Password

If you receive an error when initializing Jenkins, it maybe due to skipping the user-creation step in the setup wizard. In this case, you can disable Jenkins Security and reset the password.

  1. Login to the Jenkins server using gcloud command.
  2. Install VIM text editor if it’s not available.
  3. Search for vim packages run: sudo apt search vim
  4. Update package sudo apt update
  5. Install vim sudo apt install vim
  6. Verify vim installation vim --version
  7. Disable Jenkins Security sudo vi /var/lib/jenkins/config.xml
  8. Edit the useSecurity line to false
<useSecurity>true</useSecurity>

Press i to start edit mode, and set the true value to false

<useSecurity>false</useSecurity>

Save change and quit vim by typing :wq!

Restart the Jenkins server to take effect of this change

sudo systemctl restart jenkins

Retrieve new password sudo cat /var/lib/jenkins/secrets/initialAdminPassword

Access http://{your-jenkins-address}:8080 again and use this password to setup Jenkins.

Click Continue and continue setup following the setup wizard.

Reference

For more details about Jenkins, please refer to Jenkins User Documentation

  1. Tutorial: Install a LAMP Web Server on Amazon Linux 2
  2. Tutorial: Configure SSL/TLS on Amazon Linux 2
  3. Amazon EC2 Instance IP Addressing
  4. Jenkins User Documentation
  5. How to Reset Jenkins Admin users Password
Tags

How can we help?