Tuesday, February 25, 2020

Setup Java and Maven on Ubuntu on Microsoft Azure Cloud - Install Java and Maven on Ubuntu on Azure Cloud

Please follow steps to install Java, Maven on Ubuntu EC2 in Azure Cloud.

Java Setup on Ubuntu
sudo apt-get update

Install Java Open JDK 11 package
sudo apt-get install default-jdk -y

Once install java, enter the below command

Verify Java Version
java -version

Maven Setup

sudo apt install maven -y

you can type mvn --version
you should see the below output.


That's it. You have setup Java and Maven successfully!!

Sunday, February 23, 2020

How to push a code change into GitHub remote repository? - Code push into GitHub using Git bash

Let us see how to push a code change using Git bash or iTerm on your local machine into GitHub.

After configuring a freestyle job or pipeline using Jenkins for building and deployment, you would like to make a code change to make sure Jenkins have started automated builds/deployments.

Pre-requistes:
SSH keys set up and uploaded into GitHub.

Implementation steps:
1. Go to GitHub, select repository which you already have setup MyWebApp.
If you already cloned, move to step # 6.
2. Click on clone
3. copy SSH clone url
4. go to git bash window
5. paste the url and enter
git clone git@github.com:user_name/myFebBatchRepo.git
type yes to connect. now perform to list the repo, perform below command:

ls -al

you should see the repo name. once you see the repo name, copy the repo name and

6. cd myFebBatchRepo

change repo_name per your name of the repo you created in GitHub.

7. cd MyWebApp/src/main/webapp
8. sudo vi index.jsp

Change Hello world into below yellow highlighted:
<html>
<body>
<h2>Howdy Folks !!! Welcome to DevOps!</h2>
</body>
</html>

9. press escape, enter :wq!
10. git add index.jsp
11. git commit -m "made change to jsp"
12. git push

Now refresh the browser and click on Source to see code changes you made in your git bash window.

Friday, February 21, 2020

How to upload Docker images into Nexus docker Registry - Upload Docker images to Nexus Decker Registry

How to upload Docker images into Nexus docker Registry - Upload Docker images to Nexus Decker Registry.

Pre-Requistes:

Docker is installed and up and running.
Nexus is up and running and Docker registry is already configured. If you have not configured yet, click here to setup Nexus 3 to configure as Docker Registry.

Steps to configure in Docker to upload Docker images to Nexus
login to EC2 instance where you have installed Docker, try to perform below commands:
Configure Docker service to use insecure registry with http. Create Docker daemon file if it does not exist.

sudo vi /etc/docker/daemon.json
Add entries like below:
Enter Nexus URL along with port number used for Docker registry.


{
    "insecure-registries" : ["nexus_public_dns_name:8085"]
}


Restart Docker daemon after above configuration changes.

sudo systemctl restart docker

sudo systemctl status docker
Make sure Docker was able to restart successfully. Press q to come out of above window.


Login to Docker Registry hosted in Nexus 3

Make sure you are able to login to Docker Registry hosted in Nexus by executing below command:
sudo docker login -u admin -p admin123 nexus_public_dns_name:8085




Download Dockerized code

git clone https://bitbucket.org/ananthkannan/mydockerrepo; cd mydockerrepo/pythonApp

Create a Docker image and tag the image per Nexus Registry

sudo docker build . -t nexus_public_dns_name:8085/mypythonapp




Push the image into Docker Registry
sudo docker push nexus_public_dns_name:8085/mypythonapp



Verify in Nexus if images are uploaded successfully
Login to Nexus, click on Browse, choose Docker registry

Please watch in YouTube channel for the demo:

How to configure Nexus 3 as Docker private Registry | How to configure Docker private Registry in Nexus 3

Nexus 3 is one of the popular binary repository managers. It can be also used to store Docker images as well besides storing binaries such as WARs, EARs, Jars, DLLs and Exes.

Let us see how to configure Nexus 3 to host as Docker registry.

Pre-requistes:
  • Make sure Nexus is successfully configured, it is up and running.
  • Also do open port 8085 as well besides port 8081 for Nexus.
Steps to configure Nexus 3 as Docker Registry:

1. Login to Nexus and click on Server Administration link at the top of the window. Click on Repositories.







2. Now click on create repository



3. Choose docker hosted repository


4. Choose the value as mentioned:


5. Click on Create repository.

Configure Realm
6. Go to Security. Click on Realms

Move Docker Bearer Token realm to right by clicking on >

This settings allows docker repository to have anonymous read enabled.


7. after moving save it.

Wednesday, February 19, 2020

Install Java using Puppet on Agent - Create Puppet Manifest to Install Java on Ubuntu

Puppet is a software configuration management tool, used for managing software stack on servers. Java also can be managed using Puppet.

Here below are the steps for installing Java using Puppet on Ubuntu:

First install Java modules on Puppet Master using sudo command.

Step 1
sudo /opt/puppetlabs/bin/puppet module install puppetlabs-java --version 2.2.0

The above command will install Java module on Puppet Master.

Step 2
After that change the manifest in site.pp file in Puppet Master by executing the below command:

sudo vi /etc/puppetlabs/code/environments/production/manifests/site.pp


node 'target_node_ip_address' {
class { 

    'java':
   distribution => 'jre',
  }
}


Step 3
Now go to Puppet Agent node and apply the changes by executing the below command:

sudo /opt/puppetlabs/bin/puppet agent --test

Monday, February 3, 2020

Install Docker Ubuntu - How to install Docker in Ubuntu 16.0.4? setup Docker on Ubuntu

Please find the steps needed for installing Docker in Ubuntu 16.0.4 instance.

sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-cache policy docker-ce
sudo apt-get install -y docker-ce
sudo systemctl status docker

now press q to come out this.
ps -ef | grep docker

docker --version

sudo docker run hello-world

the above command should display the below message..

you should see below message 
Hello from Docker!
This message shows that your installation appears to be working correctly.

Also, create an account(keep all lowercase in your username)  in the below website for storing docker images in public docker registry..