Tuesday, April 12, 2016

MySQL setup on Ubuntu 14.04

Thankfully for us installation of mysql on ubuntu 14.04 is pretty straightforward:

- First do an update :

sudo apt-get update

- Then execute the install :
sudo apt-get install mysql-server

You will be prompted to enter at some point the password , so do that on the screen.

You can check whether the service is running using the following command :
sudo netstat -tap | grep mysql

To create a database or execute any command you need to access mysql prompt and provide password:
mysql -u root -p


Friday, April 08, 2016

Tomcat 8 Docker install on Ubuntu 14.04

Below are the steps for installing Tomcat 8 within a Docker container on Ubuntu 14 , in my case on Amazon Ec2.

Docker Install

You need to first follow the instructions for setting up docker :

Tomcat Install

- identify your Ubuntu instance in my case I wanted to run it with JDK 8 so first navigate to Docker Hub :


- Then choose the correct docker image version :

So this is going to be version 8.0.33-jre8

- Login to your ubuntu
- Execute the following command

sudo docker run -it --rm -p 8080:8080 tomcat:8.0.33-jre8

This will download the Tomcat 8 with JDK 8 image and start it on port 8080 .

You will be able to access your tomcat instance http://public_id_address:8080

Docker Commands

- To check which docker containers are running execute the command

sudo docker ps

You should see something like this:

CONTAINER ID        IMAGE                COMMAND             CREATED             STATUS              PORTS                    NAMES
40586996cebe        tomcat:8.0.33-jre8   "catalina.sh run"   31 minutes ago      Up 31 minutes>8080/tcp   jolly_almeida

- To stop the docker container choose the docker container id , which you find when doing docker ps :

sudo docker stop 40586996cebe

- To restart the tomcat conatiner re-execute:

sudo docker run -it --rm -p 8080:8080 tomcat:8.0.33-jre8

Installing Jenkins 2.0 on Unbuntu 14 running on Amazon Ec2

This post is really a common set of instructions to have a Jenkins War installed on a Amazon EC2 instance .

Note that another option would be to use docker but right now I want to do it from scratch first.

So the first requirement is obviously to have a Ubuntu instance running , in my case its on Amazon's awesome EC2 service.

Once you have launched your instance follow the following instructions:

Tomcat Install

- Download Tomcat 8.0.33 ( not that there might be a later version so change URL accordingly)

wget http://mirrors.ibiblio.org/apache/tomcat/tomcat-8/v8.0.33/bin/apache-tomcat-8.0.33.tar.gz

- Extract the tar.gz file in your /home/ubuntu directory

tar xvzf apache-tomcat-8.0.33.tar.gz

Now that this has been done move the tar.gz to /opt/tomcat ( create directory if not avalailable)

sudo mkdir /opt/tomcat
sudo mv apache-tomcat-8.0.33 /opt/tomcat

OpenJDK 7 install

JDK 7 is not available by default on the ubuntu EC2 image ( at least the one am using ) so you might want to installing using:

apt-get install openjdk-7-jdk

Check that it installed using

java -version

Environment Variables

Set your environment variables by doing

nano ~/.bashrc

Then appending the following at the end of the file ( Remember to change to actual location of your tomcat install )

export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
export CATALINA_HOME=/opt/tomcat/apache-tomcat-8.0.33

Execute the following command to take effect:
. ~/.bashrc


To test that your tomcat install is working simply do :


EC2 security

You should be able to access your tomcat instance page by going to ;


Note that you get your my_public_ip_adress from your EC2 Instances page on the Public IP column .

If you cannot access the URL try clicking on the Security Groups link on the Instances page against your instance .

Then add a TCP rule on the Inbound tab :

That should be it , not re-start or whatever required.

Note that if you do not have an elastic ip address assigned to your ubuntu EC2 instance each time you shutdown and restart the server the Public Ip address will change dynamically .

Jenkins Install

We are going to install the WAR for Jenkins 2  so simply download the WAR

wget http://mirrors.jenkins-ci.org/war-rc/2.0/jenkins.war/

However do note that you need to check what is the current war from the Jenkins 2.0 site , always use the latest version !

Shutdown your tomcat it is up:


Ok now we have downloaded Jenkins lets copy it to /opt/tomcat/webapps

sudo mv jenkins.war $CATALINA_HOME/webapps

Restart your server

Now navigate to the following location to continue with the Jenkins install


I will create another post for what is in regards to configuration of Jenkins .

Thursday, April 07, 2016

Installing OpenJDK 8 on Ubuntu 14.04

Tried to install OpenJDK 8 on Ubuntu 14.04 thought it would be as simple as doing a :

sudo apt-get install openjdk-8-jdk
but that didn't work out instead you need to do add the following repository:

sudo apt-add-repository ppa:webupd8team/java
Then execute

sudo apt-get update 

sudo apt-get install oracle-java8-installer

Optionally if you have multiple versions of the JDK then you choose which JDK should be the default one:
sudo update-alternatives --config java
Basically you choose the number and thats it.

You verify by doing :

java -version