Daily Archives: November 25, 2017

2. DevOps: How to install Docker 17.03.0 community edition and start working with it on Ubuntu 16.x VM

Docker-logo.png

In this blog, I would like to demonstrate the Docker 17.03.0  CE edition installation on Ubuntu 16.0.4 VM machine. And later on little practice can be shown  using containers in a series of blogs. Please keep visiting for weekly new blogs or subscribe it. If you are interested to follow this site blogs, please send e-mail [with your linkedin message ] to approve with authentication.

Assume you have an unbuntu machine or a Virtual machine [VM] configured. And in this blog you can see on how to install the Docker 17.03.0  CE [as on this blog’s date] with screen display outputs:

$ sudo service docker restart

However, if the Active column shows inactive or maintenance as the status, your Docker service is not running. In such cases, restart the Docker service, as shown here:

$ sudo service docker restart 
 
Install Docker on Unbuntu:

1.Add the Docker package repository path for Ubuntu 16.04 to your APT sources, as shown below:
 $ sudo sh -c "echo deb https://apt.dockerproject.org/repo \
 ubuntu-xenial main > /etc/apt/sources.list.d/docker.list"

2.Add the GNU Privacy Guard (GPG) key by  running the following command:
 $ sudo apt-key adv --keyserver \
 hkp://p80.pool.sks-keyservers.net:80 --recv-keys \ 
 
If the above format is expired; you can try as below:
==== Alternate method with screen output ====>
$sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D

Executing: /tmp/apt-key-gpghome.YU0Rk7y5kX/gpg.1.sh --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
gpg: key F76221572C52609D: 7 signatures not checked due to missing keys
gpg: key F76221572C52609D: public key "Docker Release Tool (releasedocker) <docker@docker.com>" imported
gpg: Total number processed: 1
gpg:               imported: 1
=========================================>
The above format should work. Even if that is not working, please google the same keys for the latest validated keys.

3.Resynchronize with the package repository using the below command:
 $ sudo apt-get update
Now docker software is in your unbuntu machine.

4. Now, you can Install Docker and start  Docker service:
 $ sudo apt-get install -y docker-engine

5.Now you have  installed the Docker Engine, we need to  verify our installation by running docker --version as shown below:
 $ docker --version

We have successfully installed Docker version 17.03.0 community edition.
Other options is; in a single script by avoiding the above steps you can install it:

If you are working on Ubuntu, follow the below command:

==================== Screen output ==========>
vskumar@ubuntu:/var/log$ sudo wget -qO- https://get.docker.io/ | sh |more
[sudo] password for vskumar: 
# Executing docker install script, commit: 11aa13e
Warning: the "docker" command appears to already exist on this system.
If you already have  installed Docker, this script can cause trouble, which is
why we're displaying this warning and provide the opportunity to cancel the
installation.
If you installed the current Docker package using this script and are using it
again to update Docker, you can safely ignore this message.
You may press Ctrl+C now to abort this script.
+ sleep 20
+ sudo -E sh -c apt-get update -qq >/dev/null
============== Since I have already installed, I have breaked this process ====>
But, if you try this script; it takes some time to download and install docker for the whole process. 
Be patient to see the final result.  Later check the docker version to reconfirm. Using the below command.
$docker --version

It is very easy to install docker with the above step(s) in your Ubuntu machine.

Assuming you have studied the theory part of docker usage I am moving forward to lab practice.

Now, let us do some practice with docker images/containers.

We will do the below steps:

1. Downloading the first Docker image:
we will download a sample hello-world docker image using the following command:
$ sudo docker pull hello-world

2. Once the image is downloaded, 
they can be verified using the docker images subcommand, as given below:
To check the image run the below command:
$sudo docker run hello-world
It displays the message “Hello from Docker!”
You have set up your first Docker container and it is running now.

3. How to Troubleshoot with Docker containers?:
If you want to troubleshoot with container, the first step is  to check the Docker's running status by using the below command:
$ sudo service docker status 
It displays the status and shows as Docker 'Active running' message on the screen along with other messages.
Press ctrl+C to come out from the display.

=========== Partial content from the above command =====>
vskumar@ubuntu:/var/log$ sudo service docker status 
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2017-11-25 02:54:42 PST; 3h 56min ago
Docs: https://docs.docker.com
Main PID: 3769 (dockerd)
Tasks: 19
Memory: 43.6M
CPU: 1min 21.184s
CGroup: /system.slice/docker.service
├─3769 /usr/bin/dockerd -H fd://
└─3778 docker-containerd --config /var/run/docker/containerd/containerd.toml
===============================>
For some reasons, if the Active column shows inactive or maintenance as the status, it means your Docker service is not running. 
In that case to restart the Docker service, use the below command:

$ sudo service docker restart

We will see in the next blog, some more exercises on Docker containers and images.

Vcard-Shanthi Kumar V-v3

 

 

 

 

 

 

 

 

 

 

1. DevOps – Jenkins[2.9] Installation with Java 9 on Windows 10

 

 

 

 

 

 

 

jenkins

I am publishing  series of blogs on DevOps tools  practice. The interested people can keep watching this site or you can subscribe/follow.

In this blog we will see what are the pre-requisites for Jenkins 2.9 to install and how to install Jenkins.

 =====================================>

Visit my current running facebook groups for IT Professionals with my valuable discussions/videos/blogs posted:

 DevOps Practices Group:

https://www.facebook.com/groups/1911594275816833/about/

Cloud Practices Group:

https://www.facebook.com/groups/585147288612549/about/

Build Cloud Solution Architects [With some videos of the live students classes/feedback]

https://www.facebook.com/vskumarcloud/

 =====================================>

 

MicroServices and Docker [For learning concepts of Microservices and Docker containers]

https://www.facebook.com/MicroServices-and-Docker-328906801086961/

To setup Jenkins, you need to have Java 9 in your local machine.

Hence in the Step1 to setup Java, you need to follow the below steps:

STEP1: How to download and install JDK SE Development kit 9.0.1 ?:

go to URL:

http://www.oracle.com/technetwork/java/javase/downloads/jdk9-downloads-3848520.html

You will see the below page [as on today’s display]

Java Kit SE 9 download

From this web page, Click on Windows file jdk-9.0.1_windows-x64_bin

It will download.

Double click on the file.

You will see the series of screens, while it is doing installation. I have copied some of them here.Java SE 9 install scrn-2.png

Java SE 9 install scrn-1

Java SE 9 install scrn-3.png

 

Java SE 9 install scrn-4.png

You can change the directory if you want, in the above screen.

 

Java SE 9 install scrn-4-Oracle 3 billion.png

 

Finally you should get the below screen as installed it successfully.

Java SE 9 install scrn-5-complete

Now, you need to set the Java environment and path variable in Windows setting.

Java SE 9 install scrn-7-windows env setup2Java SE 9 install scrn-8-windows env setup3

 

My Java directory path is:

Java SE 9 install scrn-9-windows env setup4

 

Java SE 9 install scrn-10-windows env setup5.png

You  need to edit the below path variables also for the latest path:

Java SE 9 install scrn-11-windows env setup6Java SE 9 install scrn-12-windows env setup7.png

After you have done the settings, you can check the java version as below in a command prompt:

Java SE 9 install scrn-13-CMD-1

You should get the same version.

Now, You need a simple java program to run and check your compiler and runtime environment.

Please goto google search and check for “Java Hello wordl program”.

Follow the below URL:
https://en.wikiversity.org/wiki/Java_Tutorial/Hello_World!

Copy the program into a text file named as hellowworld.java

Then compile and run the program as below:

Java SE 9 install scrn-14-CMD-Javacompile&run-1.png

If you are getting the above, then your installed java software is working fine.

You need to remember the below:
To compile this program you need to use the below command in command prompt of that program directory:

D:\JavaSamples\Javatest>javac HellowWorld.java

To run the java program you need to use the below command:

D:\JavaSamples\Javatest>java HellowWorld
Hello World

Now, you can plan for setting up Jenkins.

STEP2: How to setup Jenkins on Windows ?:

Follow the below link to download Jenkins for Windows-x64
https://jenkins.io/download/thank-you-downloading-windows-installer/

It downloads the installer as below:
You can see the downloaded installer file for Jenkins.

Jenkins-installer-file1.png

 

How to install Jenkins?:
Now you can copy this file into a new directory as Jenkins.

I have copied into the below directory.

Jenkins-installer-file-copy1.png

You need to unzip this file.

Jenkins-installer-file-unzip1.png

You can see the new directory is created with its unzipped files:

 

Jenkins-installer-file-unziped-new Dir

You can double click on it and can see the below screen:

 

Jenkins-installer-file-double-click.png

I have changed the path as below:

Jenkins-installer-file-path.png

Click on install and say “Yes” in windows confirmation screen.

 

Jenkins-installer-file-path-install.png

You can see the below screen:

Jenkins-installer-install-complete1.png

Once you click on finish, it will take you to a browser:

Jenkins-initial browser1.png

Jenkins will have a default user id as “admin” and the password.
The password is available from the given path.

Jenkins-admin-initial-pwd-file

You can open this file in notepad as below:

Jenkins-admin-initial-pwd-file-open-notepad

Now, copy this password as below into windows clipboard.

Now you goto the Jenkins browser and paste this password.

Close your notepad.

Now, on browser press continue.

You can see the Jenkins initial  screen as below for plugins selection:

 

Jenkins-initial screen for plugins

Jenkins will have 100s of plugins. But there are default plugins those can be used initially to save you disk space and time. Hence now, you click on “Install suggested plugins”.

It will show the below screen as it is working for this activity:

Jenkins-default-plugins-install-screen1.png

You can see in the right side window the tasks what Jenkins is doing:Jenkins-initial screen for plugins-tasks1.png

You can also watch as it is doing one by one the plugins installation and the tasks on right side.
It might take more than 30 mts depends on your internet speed and the RAM.

I am copying some of the screens as it is moving on …

 

Jenkins-initial screen for plugins-tasks2.png

Once the plugins are installed, you can see the 1st screen to setup your 1st admin user id and password as below:

Jenkins-create-first-UID &amp; PWD

You can enter the details and click on “Save and Finish” button.

Now, it shows the below screen with Jenkins readyness to use:

Jenkins-is-Ready.png

When you click on “Start using Jenkins” button,
You can see the below screen as in the beginning of the Jenkins usage:

Jenkins-welcome-1st time.png

Please observe the right corner and verify your created user id.

Now, let us do some login and logout operations to make sure it is working.

When you logout you can see the below screen:

Jenkins-initial-logout-test

Now let us understand the url of Jenkins server which we are using:

When we install Jenkins in any machine either Windows or Linux.
By default its url should be : http://localhost:8080/
Your local host is your current machine Ip address.
You can see the screen now with the above url:

Jenkins-URL-test

Now, you can try one more option, check your ip address from command prompt as below:

Check-IPs-CMD.png

You can pickup the 1st IP address which displays from the command prompt screen.

And key-inn the below url in your browser:
http://192.168.137.1:8080/login?from=%2F

Your ip need to be used in place of 192.168.137.1

Now, let us see What is 8080?:
Every server software creates a port address to access its web pages from the installed machine. In our case Jenkins has been configured on 8080 port as default. The 8080 is a default port for Jenkins. Similarly other server softwares also will have their specific ports.

Now, I have used a different browser using the above url to access Jenkins web page as below:

Jenkins-using-IP & 8080-Port.png

Using the login screen I am logging into my admin user id: vskumar2017 , which was created earlier.

Login-UID-vskumar2017.png

You can also check in your windows services on Jenkins running status.
Please note on this setup, you have made a standalone Jenkins by using your PC or Laptop.

Now, you can restart your windows machine. You need to start Jenkins as fresh service.

To start Jenkins from command line
  1. Open command prompt.
  2. Go to the directory where your war file is placed and run the following command: java -jar jenkins.war
  3. OR One more  option is; go to your Jenkins directory in CMD window and execute: jenkins.exe start

 

Restart-Jenkins-CMD

Open browser and Use you can check the Jenkins access. It should be showing the login page.

How to remove Jenkins from your system?:

If you want to remove Jenkins from your system, you can find the  Jenkins Windows installer file from the Jenkins directory and double click on it. You can see the below window to choose your action:

Remove-repair-Jenkins.png

So far we have seen the installation of Java 9 and Jenkins.

Some times, you might need to configure other servers [Ex:Tomcat, etc,]. They might also use 8080 port. Hence there will be conflict. We need to change the port# in that case.

Now, How to change your 8080 port to other port#?:

Please find Jenkins.xml in Jenkins dir:

Ex:

In my system I have the URL:D:\Jenkins\Jenkins 2.9

You need to replace 8080 with the  required port# in the below line:

<arguments>-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar “%BASE%\jenkins.war” –httpPort=8080 –webroot=”%BASE%\war”</arguments>

In the next blog we can see some simple exercise with Jenkins by creating and running the project into different builds.

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

 

https://vskumar.blog/2018/02/26/15-devops-how-to-setup-jenkins-2-9-on-ubuntu-16-04-with-jdk8/

Note to the reader/user of this blog:

If you are not a student of my class, and looking for it please contact me by mail with your LinkedIn identity. And send a connection request with a message on your need. You can use the below contacts. Please note; I teach globally.

Vcard-Shanthi Kumar V-v3

If you want to learn for Ubuntu installation you can visit:

https://vskumar.blog/2018/02/26/15-devops-how-to-setup-jenkins-2-9-on-ubuntu-16-04-with-jdk8/