15. DevOps: How to setup jenkins 2.9 on Ubuntu-16.04 with jdk8 with a trouble shoot video guidance

jenkins

In continuation of blog related to Jenkins installation on Win10 url :https://vskumar.blog/2017/11/25/1-devops-jenkins2-9-installation-with-java-9-on-windows-10/

In this blog I would like to demonstrate on Jenkins 2.9 installation using Ubuntu 16.04 OS with JDK8. I used Ubuntu 16.04 VM.  You can use your standalone Ubuntu machine also.

At the end  a video link is given for this entire exercise…. with a job run…

[Note: If you are a student and in need of  Ubuntu 16.04 VM copy, I can share it. You need to send a request through linkedin with your identity please. At the bottom of this blog you can get my details.]

If you want to install Jenkins you need to have JDK in the Ubuntu machine.

You need to install JDK8 as 1st instance for Jenkins setup:

How to install JDK8?:

Step 1:-
Download JDK 8 tar.gz file from official website

Step 2:-
Extract contents using tar command

$tar -xzvf filename.tar.gz

Step 3 :-
Move Extracted file to /usr/local/java Directory
=====CLI Screen output ===>
vskumar@ubuntu:~$ pwd
/home/vskumar
vskumar@ubuntu:~$ cd /usr/local
vskumar@ubuntu:/usr/local$ ls
bin etc games include lib man sbin share src
vskumar@ubuntu:/usr/local$ mkdir java
mkdir: cannot create directory ‘java’: Permission denied
vskumar@ubuntu:/usr/local$ sudo mkdir java
[sudo] password for vskumar:
vskumar@ubuntu:/usr/local$ ls
bin etc games include java lib man sbin share src
vskumar@ubuntu:/usr/local$
vskumar@ubuntu:/usr/local$ cd java
vskumar@ubuntu:/usr/local/java$

vskumar@ubuntu:~$
vskumar@ubuntu:~$ ls
data-volume1 Downloads jdk-9.0.4_linux-x64_bin.tar.gz Public
Desktop examples.desktop Music Templates
Documents flask-test Pictures Videos
vskumar@ubuntu:~$ pwd
/home/vskumar
vskumar@ubuntu:~$

vskumar@ubuntu:~/Downloads$ ls
firefox-57.0.tar.bz2 jdk1.8.0_161 jdk-8u161-linux-x64.tar.gz

vskumar@ubuntu:~/Downloads$ sudo mv jdk1.8.0_161 /usr/local/java
[sudo] password for vskumar:
vskumar@ubuntu:~/Downloads$ ls
firefox-57.0.tar.bz2 jdk-8u161-linux-x64.tar.gz
vskumar@ubuntu:~/Downloads$
vskumar@ubuntu:/usr/local/java$ pwd
/usr/local/java
vskumar@ubuntu:/usr/local/java$ ls -l
total 4
drwxr-xr-x 8 vskumar vskumar 4096 Dec 19 16:24 jdk1.8.0_161
vskumar@ubuntu:/usr/local/java$

==jdk8 unzipped files are moved into /usr/local/java ===>

Step 4: – Now,
Update Alternatives

$sudo update-alternatives –install “/usr/bin/java” “java” “/usr/local/java/jdk1.8.0_161/bin/java” 1

$sudo update-alternatives –install “/usr/bin/javac” “javac” “/usr/local/java/jdk1.8.0_161/bin/javac” 1

$sudo update-alternatives –install “/usr/bin/javaws” “javaws” “/usr/local/java/jdk1.8.0_161/bin/javaws” 1

=== Output===>

vskumar@ubuntu:/usr/local/java/jdk1.8.0_161$
vskumar@ubuntu:/usr/local/java/jdk1.8.0_161$ pwd
/usr/local/java/jdk1.8.0_161
vskumar@ubuntu:/usr/local/java/jdk1.8.0_161$ sudo update-alternatives –install “/usr/bin/java” “java” “/usr/local/java/jdk1.8.0_161/bin/java” 1
vskumar@ubuntu:/usr/local/java/jdk1.8.0_161$ sudo update-alternatives –install “/usr/bin/javac” “javac” “/usr/local/java/jdk1.8.0_161/bin/javac” 1
update-alternatives: using /usr/local/java/jdk1.8.0_161/bin/javac to provide /usr/bin/javac (javac) in auto mode
vskumar@ubuntu:/usr/local/java/jdk1.8.0_161$ sudo update-alternatives –install “/usr/bin/javaws” “javaws” “/usr/local/java/jdk1.8.0_161/bin/javaws” 1
update-alternatives: using /usr/local/java/jdk1.8.0_161/bin/javaws to provide /usr/bin/javaws (javaws) in auto mode
vskumar@ubuntu:/usr/local/java/jdk1.8.0_161$
==============>

Step 5 :-
Check Java version
$ java -version

======>
vskumar@ubuntu:/usr/local/java/jdk1.8.0_161$ java -version
java version “1.8.0_161”
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)
vskumar@ubuntu:/usr/local/java/jdk1.8.0_161$
====We have done JDKsetup ===>

Now, You can see “How to install Jenkins on Ubuntu 16.04?”:

For details Visit: https://wiki.jenkins.io/display/JENKINS/Installing+Jenkins+on+Ubuntu

Step1:
First, we need to add the jenkins repository key to the ubuntu system.

$ sudo wget -q -O – https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add –

When the key is added, the system will return ‘OK’

Step2:
Now, we need to append the Debian package repository
address to the server’s sources.list:

$echo deb https://pkg.jenkins.io/debian-stable binary/ | sudo tee /etc/apt/sources.list

The screen ouput for the above steps:
=== Screen output of Step1 and Step2====>
vskumar@ubuntu:~$ sudo wget -q -O – https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add –
OK
vskumar@ubuntu:~$ echo deb https://pkg.jenkins.io/debian-stable binary/ | sudo tee /etc/apt/sources.list
deb https://pkg.jenkins.io/debian-stable binary/
vskumar@ubuntu:~$ sudo apt-get update
===============>

When both of the above steps are executed, we’ll run update so that apt-get will use
the new repository:

Step3:
$sudo apt-get update

==== You will see the below screen output ===>
vskumar@ubuntu:~$ echo deb https://pkg.jenkins.io/debian-stable binary/ | sudo tee /etc/apt/sources.list
deb https://pkg.jenkins.io/debian-stable binary/
vskumar@ubuntu:~$ sudo apt-get update
Hit:1 https://download.docker.com/linux/ubuntu xenial InRelease
Ign:2 https://pkg.jenkins.io/debian-stable binary/ InRelease
Hit:3 https://pkg.jenkins.io/debian-stable binary/ Release
Reading package lists… Done
vskumar@ubuntu:~$
========================>

========>
vskumar@ubuntu:~$ sudo find . / jenkins | grep ‘jenkins’
find: ‘/run/user/1000/gvfs’: Permission denied
/var/lib/apt/lists/pkg.jenkins.io_debian-stable_binary_Packages
/var/lib/apt/lists/pkg.jenkins.io_debian-stable_binary_Release.gpg
/var/lib/apt/lists/pkg.jenkins.io_debian-stable_binary_Release
find: ‘jenkins’: No such file or directory
vskumar@ubuntu:~$
==============>

Step4:
Include JAVA_HOME = /usr/local/java/jdk1.8.0_161
in .shrc file.

Now, we will install Jenkins and its dependencies:

$sudo apt-get install jenkins
Whenyou run this command your might get the below error:
=== Dependecy issues ======>
vskumar@ubuntu:~$ sudo apt-get install jenkins
Reading package lists… Done
Building dependency tree
Reading state information… Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
jenkins : Depends: daemon but it is not installable
Depends: default-jre-headless (>= 2:1.8) or
java8-runtime-headless
E: Unable to correct problems, you have held broken packages.
vskumar@ubuntu:~$
======================>

To resolve this issued, Under Ubuntu Software tab, enable all the repositories.
The system updates all the packages/libs.

Visit for details:
https://askubuntu.com/questions/140246/how-do-i-resolve-unmet-dependencies-after-adding-a-ppa

After doing the repositories updates as mentioned above, I have re-executed the install command:

==== Screen Output of Jenkins installation ====
vskumar@ubuntu:~$ sudo apt-get install jenkins
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following additional packages will be installed:
ca-certificates-java daemon default-jre-headless java-common
openjdk-8-jre-headless
Suggested packages:
default-jre openjdk-8-jre-jamvm fonts-dejavu-extra fonts-ipafont-gothic
fonts-ipafont-mincho ttf-wqy-microhei | ttf-wqy-zenhei fonts-indic
The following NEW packages will be installed:
ca-certificates-java daemon default-jre-headless java-common jenkins
openjdk-8-jre-headless
0 upgraded, 6 newly installed, 0 to remove and 0 not upgraded.
Need to get 101 MB of archives.
After this operation, 174 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu xenial/main amd64 java-common all 0.56ubuntu2 [7,742 B]
Get:2 http://archive.ubuntu.com/ubuntu xenial/main amd64 default-jre-headless amd64 2:1.8-56ubuntu2 [4,380 B]
Get:3 http://archive.ubuntu.com/ubuntu xenial/main amd64 ca-certificates-java all 20160321 [12.9 kB]
Get:4 http://archive.ubuntu.com/ubuntu xenial/main amd64 openjdk-8-jre-headless amd64 8u77-b03-3ubuntu3 [26.9 MB]
Get:5 https://pkg.jenkins.io/debian-stable binary/ jenkins 2.89.4 [73.7 MB]
Get:6 http://archive.ubuntu.com/ubuntu xenial/universe amd64 daemon amd64 0.6.4-1 [98.2 kB]
Fetched 101 MB in 2min 9s (775 kB/s)
Selecting previously unselected package java-common.
(Reading database … 217445 files and directories currently installed.)
Preparing to unpack …/java-common_0.56ubuntu2_all.deb …
Unpacking java-common (0.56ubuntu2) …
Selecting previously unselected package default-jre-headless.
Preparing to unpack …/default-jre-headless_2%3a1.8-56ubuntu2_amd64.deb …
Unpacking default-jre-headless (2:1.8-56ubuntu2) …
Selecting previously unselected package ca-certificates-java.
Preparing to unpack …/ca-certificates-java_20160321_all.deb …
Unpacking ca-certificates-java (20160321) …
Selecting previously unselected package openjdk-8-jre-headless:amd64.
Preparing to unpack …/openjdk-8-jre-headless_8u77-b03-3ubuntu3_amd64.deb …
Unpacking openjdk-8-jre-headless:amd64 (8u77-b03-3ubuntu3) …
Selecting previously unselected package daemon.
Preparing to unpack …/daemon_0.6.4-1_amd64.deb …
Unpacking daemon (0.6.4-1) …
Selecting previously unselected package jenkins.
Preparing to unpack …/jenkins_2.89.4_all.deb …
Unpacking jenkins (2.89.4) …
Processing triggers for man-db (2.7.5-1) …
Processing triggers for ca-certificates (20170717~16.04.1) …
Updating certificates in /etc/ssl/certs…
0 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d…
done.
Processing triggers for systemd (229-4ubuntu21.1) …
Processing triggers for ureadahead (0.100.0-19) …
Setting up java-common (0.56ubuntu2) …
Setting up daemon (0.6.4-1) …
Setting up openjdk-8-jre-headless:amd64 (8u77-b03-3ubuntu3) …
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/rmid to provide /usr/bin/rmid (rmid) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java to provide /usr/bin/java (java) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/keytool to provide /usr/bin/keytool (keytool) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/jjs to provide /usr/bin/jjs (jjs) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/pack200 to provide /usr/bin/pack200 (pack200) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/rmiregistry to provide /usr/bin/rmiregistry (rmiregistry) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/unpack200 to provide /usr/bin/unpack200 (unpack200) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/orbd to provide /usr/bin/orbd (orbd) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/servertool to provide /usr/bin/servertool (servertool) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/tnameserv to provide /usr/bin/tnameserv (tnameserv) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/jexec to provide /usr/bin/jexec (jexec) in auto mode
Setting up ca-certificates-java (20160321) …
Adding debian:Chambers_of_Commerce_Root_-_2008.pem
Adding debian:GeoTrust_Primary_Certification_Authority_-_G3.pem
Adding debian:OISTE_WISeKey_Global_Root_GA_CA.pem
Adding debian:Deutsche_Telekom_Root_CA_2.pem
Adding debian:Izenpe.com.pem
Adding debian:Microsec_e-Szigno_Root_CA_2009.pem
Adding debian:EC-ACC.pem
Adding debian:DigiCert_Global_Root_G2.pem
Adding debian:QuoVadis_Root_CA_3.pem
Adding debian:ePKI_Root_Certification_Authority.pem
Adding debian:GeoTrust_Primary_Certification_Authority_-_G2.pem
Adding debian:Autoridad_de_Certificacion_Firmaprofesional_CIF_A62634068.pem
Adding debian:ACCVRAIZ1.pem
Adding debian:Cybertrust_Global_Root.pem
Adding debian:COMODO_ECC_Certification_Authority.pem
Adding debian:GeoTrust_Universal_CA_2.pem
Adding debian:Entrust_Root_Certification_Authority_-_EC1.pem
Adding debian:Sonera_Class_2_Root_CA.pem
Adding debian:Comodo_AAA_Services_root.pem
Adding debian:Security_Communication_EV_RootCA1.pem
Adding debian:AddTrust_Low-Value_Services_Root.pem
Adding debian:Amazon_Root_CA_1.pem
Adding debian:DST_Root_CA_X3.pem
Adding debian:OpenTrust_Root_CA_G1.pem
Adding debian:T-TeleSec_GlobalRoot_Class_3.pem
Adding debian:Camerfirma_Chambers_of_Commerce_Root.pem
Adding debian:Atos_TrustedRoot_2011.pem
Adding debian:Starfield_Class_2_CA.pem
Adding debian:Certigna.pem
Adding debian:Buypass_Class_3_Root_CA.pem
Adding debian:COMODO_Certification_Authority.pem
Adding debian:thawte_Primary_Root_CA_-_G3.pem
Adding debian:Swisscom_Root_EV_CA_2.pem
Adding debian:Go_Daddy_Class_2_CA.pem
Adding debian:VeriSign_Universal_Root_Certification_Authority.pem
Adding debian:Global_Chambersign_Root_-_2008.pem
Adding debian:CNNIC_ROOT.pem
Adding debian:AddTrust_External_Root.pem
Adding debian:SwissSign_Gold_CA_-_G2.pem
Adding debian:QuoVadis_Root_CA_1_G3.pem
Adding debian:GeoTrust_Primary_Certification_Authority.pem
Adding debian:Hongkong_Post_Root_CA_1.pem
Adding debian:TWCA_Global_Root_CA.pem
Adding debian:ACEDICOM_Root.pem
Adding debian:Go_Daddy_Root_Certificate_Authority_-_G2.pem
Adding debian:Staat_der_Nederlanden_EV_Root_CA.pem
Adding debian:GlobalSign_ECC_Root_CA_-_R4.pem
Adding debian:Entrust_Root_Certification_Authority_-_G2.pem
Adding debian:Taiwan_GRCA.pem
Adding debian:Verisign_Class_3_Public_Primary_Certification_Authority_-_G3.pem
Adding debian:COMODO_RSA_Certification_Authority.pem
Adding debian:ssl-cert-snakeoil.pem
Adding debian:DigiCert_High_Assurance_EV_Root_CA.pem
Adding debian:GeoTrust_Global_CA.pem
Adding debian:Security_Communication_RootCA2.pem
Adding debian:QuoVadis_Root_CA.pem
Adding debian:D-TRUST_Root_Class_3_CA_2_2009.pem
Adding debian:D-TRUST_Root_Class_3_CA_2_EV_2009.pem
Adding debian:UTN_USERFirst_Hardware_Root_CA.pem
Adding debian:DST_ACES_CA_X6.pem
Adding debian:Visa_eCommerce_Root.pem
Adding debian:Certinomis_-_Autorité_Racine.pem
Adding debian:thawte_Primary_Root_CA_-_G2.pem
Adding debian:Staat_der_Nederlanden_Root_CA_-_G2.pem
Adding debian:E-Tugra_Certification_Authority.pem
Adding debian:QuoVadis_Root_CA_2_G3.pem
Adding debian:Entrust.net_Premium_2048_Secure_Server_CA.pem
Adding debian:TURKTRUST_Certificate_Services_Provider_Root_2007.pem
Adding debian:SwissSign_Silver_CA_-_G2.pem
Adding debian:TWCA_Root_Certification_Authority.pem
Adding debian:Certum_Trusted_Network_CA_2.pem
Adding debian:T-TeleSec_GlobalRoot_Class_2.pem
Adding debian:GlobalSign_Root_CA_-_R2.pem
Adding debian:LuxTrust_Global_Root_2.pem
Adding debian:AddTrust_Public_Services_Root.pem
Adding debian:Staat_der_Nederlanden_Root_CA_-_G3.pem
Adding debian:USERTrust_ECC_Certification_Authority.pem
Adding debian:AffirmTrust_Networking.pem
Adding debian:Amazon_Root_CA_4.pem
Adding debian:Starfield_Services_Root_Certificate_Authority_-_G2.pem
Adding debian:TÜRKTRUST_Elektronik_Sertifika_Hizmet_Saglayicisi_H5.pem
Adding debian:ISRG_Root_X1.pem
Adding debian:AC_RAIZ_FNMT-RCM.pem
Adding debian:Swisscom_Root_CA_2.pem
Adding debian:DigiCert_Trusted_Root_G4.pem
Adding debian:GlobalSign_Root_CA.pem
Adding debian:CA_Disig_Root_R2.pem
Adding debian:OISTE_WISeKey_Global_Root_GB_CA.pem
Adding debian:TeliaSonera_Root_CA_v1.pem
Adding debian:Comodo_Trusted_Services_root.pem
Adding debian:Certum_Trusted_Network_CA.pem
Adding debian:NetLock_Arany_=Class_Gold=_Fotanúsítvány.pem
Adding debian:AffirmTrust_Premium.pem
Adding debian:AffirmTrust_Premium_ECC.pem
Adding debian:VeriSign_Class_3_Public_Primary_Certification_Authority_-_G5.pem
Adding debian:Secure_Global_CA.pem
Adding debian:Certinomis_-_Root_CA.pem
Adding debian:AddTrust_Qualified_Certificates_Root.pem
Adding debian:Certplus_Root_CA_G2.pem
Adding debian:Amazon_Root_CA_2.pem
Adding debian:Security_Communication_Root_CA.pem
Adding debian:GeoTrust_Global_CA_2.pem
Adding debian:DigiCert_Global_Root_CA.pem
Adding debian:Starfield_Root_Certificate_Authority_-_G2.pem
Adding debian:IdenTrust_Public_Sector_Root_CA_1.pem
Adding debian:VeriSign_Class_3_Public_Primary_Certification_Authority_-_G4.pem
Adding debian:SZAFIR_ROOT_CA2.pem
Adding debian:PSCProcert.pem
Adding debian:AffirmTrust_Commercial.pem
Adding debian:certSIGN_ROOT_CA.pem
Adding debian:Swisscom_Root_CA_1.pem
Adding debian:Hellenic_Academic_and_Research_Institutions_ECC_RootCA_2015.pem
Adding debian:Certplus_Class_2_Primary_CA.pem
Adding debian:XRamp_Global_CA_Root.pem
Adding debian:GeoTrust_Universal_CA.pem
Adding debian:QuoVadis_Root_CA_3_G3.pem
Adding debian:QuoVadis_Root_CA_2.pem
Adding debian:China_Internet_Network_Information_Center_EV_Certificates_Root.pem
Adding debian:CFCA_EV_ROOT.pem
Adding debian:OpenTrust_Root_CA_G2.pem
Adding debian:Network_Solutions_Certificate_Authority.pem
Adding debian:Amazon_Root_CA_3.pem
Adding debian:Certum_Root_CA.pem
Adding debian:EE_Certification_Centre_Root_CA.pem
Adding debian:Actalis_Authentication_Root_CA.pem
Adding debian:Hellenic_Academic_and_Research_Institutions_RootCA_2015.pem
Adding debian:DigiCert_Assured_ID_Root_G3.pem
Adding debian:SecureTrust_CA.pem
Adding debian:Entrust_Root_Certification_Authority.pem
Adding debian:DigiCert_Assured_ID_Root_G2.pem
Adding debian:Certplus_Root_CA_G1.pem
Adding debian:TUBITAK_Kamu_SM_SSL_Kok_Sertifikasi_-_Surum_1.pem
Adding debian:TÜBITAK_UEKAE_Kök_Sertifika_Hizmet_Saglayicisi_-_Sürüm_3.pem
Adding debian:GlobalSign_Root_CA_-_R3.pem
Adding debian:IdenTrust_Commercial_Root_CA_1.pem
Adding debian:OpenTrust_Root_CA_G3.pem
Adding debian:thawte_Primary_Root_CA.pem
Adding debian:USERTrust_RSA_Certification_Authority.pem
Adding debian:DigiCert_Assured_ID_Root_CA.pem
Adding debian:Buypass_Class_2_Root_CA.pem
Adding debian:CA_Disig_Root_R1.pem
Adding debian:Trustis_FPS_Root_CA.pem
Adding debian:Baltimore_CyberTrust_Root.pem
Adding debian:GlobalSign_ECC_Root_CA_-_R5.pem
Adding debian:Comodo_Secure_Services_root.pem
Adding debian:DigiCert_Global_Root_G3.pem
Adding debian:Hellenic_Academic_and_Research_Institutions_RootCA_2011.pem
Adding debian:Camerfirma_Global_Chambersign_Root.pem
Adding debian:SecureSign_RootCA11.pem
done.
Setting up default-jre-headless (2:1.8-56ubuntu2) …
Setting up jenkins (2.89.4) …
Processing triggers for ca-certificates (20170717~16.04.1) …
Updating certificates in /etc/ssl/certs…
0 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d…

done.
done.
Processing triggers for systemd (229-4ubuntu21.1) …
Processing triggers for ureadahead (0.100.0-19) …
vskumar@ubuntu:~$
== End of Jenkins intallation ========>

==== Updates ====>

vskumar@ubuntu:~$
vskumar@ubuntu:~$ sudo apt-get update
Hit:1 http://ppa.launchpad.net/webupd8team/java/ubuntu xenial InRelease
Hit:2 http://archive.ubuntu.com/ubuntu xenial InRelease
Hit:3 https://download.docker.com/linux/ubuntu xenial InRelease
Ign:4 https://pkg.jenkins.io/debian-stable binary/ InRelease
Hit:5 https://pkg.jenkins.io/debian-stable binary/ Release
Reading package lists… Done
vskumar@ubuntu:~$
=============>

Step5:

How to install apache2?:
If we need to use jenkins apache2 is required.
Now let us install apache2

=== Output for apache installation ===>
vskumar@ubuntu:~$
vskumar@ubuntu:~$ sudo apt install apache2
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following additional packages will be installed:
apache2-bin apache2-data apache2-utils libapr1 libaprutil1
libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.1-0
Suggested packages:
apache2-doc apache2-suexec-pristine | apache2-suexec-custom
The following NEW packages will be installed:
apache2 apache2-bin apache2-data apache2-utils libapr1 libaprutil1
libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.1-0
0 upgraded, 9 newly installed, 0 to remove and 0 not upgraded.
Need to get 1,532 kB of archives.
After this operation, 6,350 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu xenial/main amd64 libapr1 amd64 1.5.2-3 [86.0 kB]
Get:2 http://archive.ubuntu.com/ubuntu xenial/main amd64 libaprutil1 amd64 1.5.4-1build1 [77.1 kB]
Get:3 http://archive.ubuntu.com/ubuntu xenial/main amd64 libaprutil1-dbd-sqlite3 amd64 1.5.4-1build1 [10.6 kB]
Get:4 http://archive.ubuntu.com/ubuntu xenial/main amd64 libaprutil1-ldap amd64 1.5.4-1build1 [8,720 B]
Get:5 http://archive.ubuntu.com/ubuntu xenial/main amd64 liblua5.1-0 amd64 5.1.5-8ubuntu1 [102 kB]
Get:6 http://archive.ubuntu.com/ubuntu xenial/main amd64 apache2-bin amd64 2.4.18-2ubuntu3 [918 kB]
Get:7 http://archive.ubuntu.com/ubuntu xenial/main amd64 apache2-utils amd64 2.4.18-2ubuntu3 [81.1 kB]
Get:8 http://archive.ubuntu.com/ubuntu xenial/main amd64 apache2-data all 2.4.18-2ubuntu3 [162 kB]
Get:9 http://archive.ubuntu.com/ubuntu xenial/main amd64 apache2 amd64 2.4.18-2ubuntu3 [86.6 kB]
Fetched 1,532 kB in 5s (270 kB/s)
Selecting previously unselected package libapr1:amd64.
(Reading database … 217703 files and directories currently installed.)
Preparing to unpack …/libapr1_1.5.2-3_amd64.deb …
Unpacking libapr1:amd64 (1.5.2-3) …
Selecting previously unselected package libaprutil1:amd64.
Preparing to unpack …/libaprutil1_1.5.4-1build1_amd64.deb …
Unpacking libaprutil1:amd64 (1.5.4-1build1) …
Selecting previously unselected package libaprutil1-dbd-sqlite3:amd64.
Preparing to unpack …/libaprutil1-dbd-sqlite3_1.5.4-1build1_amd64.deb …
Unpacking libaprutil1-dbd-sqlite3:amd64 (1.5.4-1build1) …
Selecting previously unselected package libaprutil1-ldap:amd64.
Preparing to unpack …/libaprutil1-ldap_1.5.4-1build1_amd64.deb …
Unpacking libaprutil1-ldap:amd64 (1.5.4-1build1) …
Selecting previously unselected package liblua5.1-0:amd64.
Preparing to unpack …/liblua5.1-0_5.1.5-8ubuntu1_amd64.deb …
Unpacking liblua5.1-0:amd64 (5.1.5-8ubuntu1) …
Selecting previously unselected package apache2-bin.
Preparing to unpack …/apache2-bin_2.4.18-2ubuntu3_amd64.deb …
Unpacking apache2-bin (2.4.18-2ubuntu3) …
Selecting previously unselected package apache2-utils.
Preparing to unpack …/apache2-utils_2.4.18-2ubuntu3_amd64.deb …
Unpacking apache2-utils (2.4.18-2ubuntu3) …
Selecting previously unselected package apache2-data.
Preparing to unpack …/apache2-data_2.4.18-2ubuntu3_all.deb …
Unpacking apache2-data (2.4.18-2ubuntu3) …
Selecting previously unselected package apache2.
Preparing to unpack …/apache2_2.4.18-2ubuntu3_amd64.deb …
Unpacking apache2 (2.4.18-2ubuntu3) …
Processing triggers for libc-bin (2.23-0ubuntu10) …
Processing triggers for man-db (2.7.5-1) …
Processing triggers for systemd (229-4ubuntu21.1) …
Processing triggers for ureadahead (0.100.0-19) …
Processing triggers for ufw (0.35-0ubuntu2) …
Setting up libapr1:amd64 (1.5.2-3) …
Setting up libaprutil1:amd64 (1.5.4-1build1) …
Setting up libaprutil1-dbd-sqlite3:amd64 (1.5.4-1build1) …
Setting up libaprutil1-ldap:amd64 (1.5.4-1build1) …
Setting up liblua5.1-0:amd64 (5.1.5-8ubuntu1) …
Setting up apache2-bin (2.4.18-2ubuntu3) …
Setting up apache2-utils (2.4.18-2ubuntu3) …
Setting up apache2-data (2.4.18-2ubuntu3) …
Setting up apache2 (2.4.18-2ubuntu3) …
Enabling module mpm_event.
Enabling module authz_core.
Enabling module authz_host.
Enabling module authn_core.
Enabling module auth_basic.
Enabling module access_compat.
Enabling module authn_file.
Enabling module authz_user.
Enabling module alias.
Enabling module dir.
Enabling module autoindex.
Enabling module env.
Enabling module mime.
Enabling module negotiation.
Enabling module setenvif.
Enabling module filter.
Enabling module deflate.
Enabling module status.
Enabling conf charset.
Enabling conf localized-error-pages.
Enabling conf other-vhosts-access-log.
Enabling conf security.
Enabling conf serve-cgi-bin.
Enabling site 000-default.
Processing triggers for libc-bin (2.23-0ubuntu10) …
Processing triggers for systemd (229-4ubuntu21.1) …
Processing triggers for ureadahead (0.100.0-19) …
Processing triggers for ufw (0.35-0ubuntu2) …
vskumar@ubuntu:~$
=== Apaches is installed ===>

Let us check its status:

== Status of apache2 ===>
vskumar@ubuntu:~$
vskumar@ubuntu:~$ service status apache2
status: unrecognized service
vskumar@ubuntu:~$ service apache2 status
? apache2.service – LSB: Apache2 web server
Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
+-apache2-systemd.conf
Active: active (running) since Thu 2018-02-22 02:30:24 PST; 1min 6s ago
Docs: man:systemd-sysv-generator(8)
CGroup: /system.slice/apache2.service
+-12680 /usr/sbin/apache2 -k start
+-12683 /usr/sbin/apache2 -k start
+-12684 /usr/sbin/apache2 -k start

Feb 22 02:30:22 ubuntu systemd[1]: Starting LSB: Apache2 web server…
Feb 22 02:30:22 ubuntu apache2[12651]: * Starting Apache httpd web server apach
Feb 22 02:30:23 ubuntu apache2[12651]: AH00558: apache2: Could not reliably dete
Feb 22 02:30:24 ubuntu apache2[12651]: *
Feb 22 02:30:24 ubuntu systemd[1]: Started LSB: Apache2 web server.
lines 1-16/16 (END)
================>

Now, let us check the status for Jenkins:

===== Jenkins status ===>

vskumar@ubuntu:~$ service jenkins status
? jenkins.service – LSB: Start Jenkins at boot time
Loaded: loaded (/etc/init.d/jenkins; bad; vendor preset: enabled)
Active: active (exited) since Thu 2018-02-22 02:13:57 PST; 23min ago
Docs: man:systemd-sysv-generator(8)

Feb 22 02:13:51 ubuntu systemd[1]: Starting LSB: Start Jenkins at boot time…
Feb 22 02:13:51 ubuntu jenkins[10140]: * Starting Jenkins Automation Server jen
Feb 22 02:13:52 ubuntu su[10168]: Successful su for jenkins by root
Feb 22 02:13:52 ubuntu su[10168]: + ??? root:jenkins
Feb 22 02:13:52 ubuntu su[10168]: pam_unix(su:session): session opened for user
Feb 22 02:13:57 ubuntu jenkins[10140]: …done.
Feb 22 02:13:57 ubuntu systemd[1]: Started LSB: Start Jenkins at boot time.
lines 1-12/12 (END)
==== Jenkins is running ======>

How to check on browser in Ubuntu for Jenkins web page ?:

You can also check the ubuntu browser with the below
url:http://localhost:8080/login?from=%2F
There should be a web page displayed with the message:
“Unlock Jenkins”.

It means Jenkins is available to use.

Step6:
Now, we need to setup the admin password.
Read the content on the web page.
You are advised to use the initial password from:
/var/lib/jenkins/secrets/initialAdminPassword

Let us go to that directory to get copy and paste it on
web page.

In my case I got the below:
==== PWD display ===>
vskumar@ubuntu:~$ sudo cat /var/lib/jenkins/secrets/initialAdminPassword
711a4d7d01244651a490cfd4a61439e2
vskumar@ubuntu:~$
========>

I have pasted it on web page.
Till you change the pwd, this will be the default one.

==== List of the files in jenkins dir ===>
vskumar@ubuntu:/var/lib/jenkins$ ls -l
total 60
-rw-r–r– 1 jenkins jenkins 1820 Feb 22 02:17 config.xml
-rw-r–r– 1 jenkins jenkins 156 Feb 22 02:15 hudson.model.UpdateCenter.xml
-rw——- 1 jenkins jenkins 1712 Feb 22 02:15 identity.key.enc
-rw-r–r– 1 jenkins jenkins 94 Feb 22 02:16 jenkins.CLI.xml
-rw-r–r– 1 jenkins jenkins 6 Feb 22 02:16 jenkins.install.UpgradeWizard.state
drwxr-xr-x 2 jenkins jenkins 4096 Feb 22 02:15 jobs
drwxr-xr-x 3 jenkins jenkins 4096 Feb 22 02:16 logs
-rw-r–r– 1 jenkins jenkins 907 Feb 22 02:16 nodeMonitors.xml
drwxr-xr-x 2 jenkins jenkins 4096 Feb 22 02:15 nodes
drwxr-xr-x 2 jenkins jenkins 4096 Feb 22 02:15 plugins
-rw-r–r– 1 jenkins jenkins 64 Feb 22 02:15 secret.key
-rw-r–r– 1 jenkins jenkins 0 Feb 22 02:15 secret.key.not-so-secret
drwx—— 4 jenkins jenkins 4096 Feb 22 02:16 secrets
drwxr-xr-x 2 jenkins jenkins 4096 Feb 22 02:18 updates
drwxr-xr-x 2 jenkins jenkins 4096 Feb 22 02:16 userContent
drwxr-xr-x 3 jenkins jenkins 4096 Feb 22 02:16 users
vskumar@ubuntu:/var/lib/jenkins$ cd jobs
vskumar@ubuntu:/var/lib/jenkins/jobs$ ls
vskumar@ubuntu:/var/lib/jenkins/jobs$ pwd
/var/lib/jenkins/jobs
vskumar@ubuntu:/var/lib/jenkins/jobs$
==================>
We need to remember the above directories.

By default we can install ‘suggested plugins’ for now.
It shows the plugins updates.
Once they are installed, you will be prompted for a uid/pwd/name/e-mail.
You can fill them, and start using jenkins.

That is all the installation of Jenkins 2.9.

 

This video is made to motivate the new DevOps engineers to learn and do a kind of trouble shooting, while doing Jenkins installation on a Virtual machine of Ubuntu.

To try one job build you can go through my another blog:

https://vskumar.blog/2017/11/26/2-devops-jenkins2-9-how-to-create-and-build-the-job/

Good luck!! and you can start practicing Jenkins.

 

Vcard-Shanthi Kumar V-v3

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s