Install Jenkins on Amazon EC2 (Ubuntu Server 14.04 LTS)

Jenkins is a powerful application that allows continuous integration and helps in the continuous delivery of projects, regardless of the platform you are working on. It is an open source tool that can handle any kind of build or continuous integration. You can integrate Jenkins with a number of testing and deployment technologies. In this post, we will explain how you can install Jenkins on an Amazon EC2 (Ubuntu Server 14.04 LTS) Instance.

Assuming that you have already completed the below three steps. If not then you can follow our below posts to complete these prerequisites.

  1. First, create a new Amazon EC2 Instance(Ubuntu Server 14.04 LTS) and setup Security Groups and open up ports 22, 80 and 443.  See Blog: Create a new Instance (Ubuntu 14.04) on AWS EC2 and setup Security Groups
  2. Then connect to your EC2 Instance via SSH. See Blog: Connect to AWS EC2 Instance via Putty/SSH
  3. For Jenkins first, you have Install Java on your Instance.  See Blog: Install OpenJDK 8 on Ubuntu 14.04 LTS

Step 1: Fixing Locales in Ubuntu 14.04 LTS on Amazon EC2

Once, we run the above command you should be able to see the below message on the command interface.

Install Jenkins on Amazon EC2 (Ubuntu Server 14.04 LTS)1

Step 2: The Installation

Now, we’re going to add the repository for the Jenkins package. So, we need to install the public key for the Jenkins repository to tell Ubuntu that this is a trusted repository:

Once, we run the above command you should be able to see the below message on the command interface.

Install Jenkins on Amazon EC2 (Ubuntu Server 14.04 LTS)2

Then, we need to tell Ubuntu where the package repository is. We just add the package repository to the list of repositories:

Once, we run the above command you should be able to see the below message on the command interface.

Install Jenkins on Amazon EC2 (Ubuntu Server 14.04 LTS)3

The best practice is to Update packages first:

Once, we run the above command you should be able to see the below message on the command interface.

Install Jenkins on Amazon EC2 (Ubuntu Server 14.04 LTS)4

Finally, we install Jenkins:

Once, we run the above command you should be able to see the below message on the command interface.

Install Jenkins on Amazon EC2 (Ubuntu Server 14.04 LTS)5

Step 3: Verify Installation

Once, we run the above command you should be able to see the below message on the command interface.

Install Jenkins on Amazon EC2 (Ubuntu Server 14.04 LTS)6

This verifies that Jenkins service has been installed is actually running on httpPort=8080.

The reason for that is that Jenkins package actually created a user called Jenkins on the system that allows Jenkins to be run as an unprivileged user.

We don’t want to run it as a root user for security reasons. Now the unprivileged user can’t start the server on privilege port like HTTP port 80 so, it runs on 8080, on the other hand, we don’t have to specify the port 8080 every time to connect to Jenkins server from a web browser.

So, for what we are going to do is to setup an apache server to send proxy requests from port 80 to our Jenkins server port 8080 for that we have to install and configure Apache web server.

Now, to install and configure Apache Web Server we need to follow the below steps.

Step 4: Installing and Configuring Apache

Install apache2 server

Once, we run the above command you should be able to see the below message on the command interface.

Install Jenkins on Amazon EC2 (Ubuntu Server 14.04 LTS)7

Next command is to enable module proxy

Once, we run the above command you should be able to see the below message on the command interface.

Install Jenkins on Amazon EC2 (Ubuntu Server 14.04 LTS)8

After the above, we need to run the next command to enable module proxy_http

Once, we run the above command you should be able to see the below message on the command interface.

Install Jenkins on Amazon EC2 (Ubuntu Server 14.04 LTS)9

Now configure Apache to proxy the request from port 80 to 8080 to Jenkins server for that you have to paste below configuration in the file. Don’t forget to change your EC2 hostname.

For open ‘jenkins.conf’ file type below command and paste above configuration *Don’t forget to change your EC2 hostname*

Once, we run the above command you should be able to see the below message on the command interface.

Install Jenkins on Amazon EC2 (Ubuntu Server 14.04 LTS)10

Step 5: Enabling jenkins.conf

Once the installation is complete we move on to the configuration of the files.We need to enable our new site that we’ve set up in Apache and reload the apache2 service.

Once, we run the above command you should be able to see the below message on the command interface.

Install Jenkins on Amazon EC2 (Ubuntu Server 14.04 LTS)11

Next command is to restart Apache service

Once, we run the above command you should be able to see the below message on the command interface.

Install Jenkins on Amazon EC2 (Ubuntu Server 14.04 LTS)12

Step 6 : Unlock Jenkins

Access the Jenkins server by web browser then you will see below screen which means you have configured Jenkins properly.

Install Jenkins on Amazon EC2 (Ubuntu Server 14.04 LTS)13

Then the next step is to unlock your Jenkins, for that we need to copy the administrator password from “/var/lib/jenkins/secrets/initialAdminPassword” file we could do that by executing the below command on your EC2 server to copy the password and unlock your Jenkins.

Then you will see the Jenkins dashboard.

Install Jenkins on Amazon EC2 (Ubuntu Server 14.04 LTS)14

Install OpenJDK 8 on Ubuntu 14.04 LTS

Step 1: Add the OpenJDK Team Personal Package Archive (PPA)

Add the PPA:

Once, we run the above command you should be able to see the below message on the command interface.

Install OpenJDK 8 on Ubuntu1

Step 2: The Installation

The best practice is first to update our packages

Once, we run the above command you should be able to see the below message on the command interface.

Install OpenJDK 8 on Ubuntu2

Then install Open JDK 8 with the PPA installer:

Once, we run the above command you should be able to see the below message on the command interface.

Install OpenJDK 8 on Ubuntu3

Step 3: Verify Installation

Now verify that Java is installed by typing:

You will see result similar to:

Once, we run the above command you should be able to see the below message on the command interface.

Install OpenJDK 8 on Ubuntu4

Install Moodle

In this post I am going to explain How To Install Moodle.
Its a very simple process. Just follow the following steps.

Step-1: Download Moodle which ever version you would like to install, we will install Moodle-2.4

Step-2: Extract and place it in server’s root directory. We are using WAMP server so root directory is www in our case.

Step-3: Run WAMP server and Create a database (we have created the database with name moodle2.4 and db_collation is utf8_general_ci)

create_db

Step-4: Open the moodle that you have just extracted.

Step-5: Choose language then hit Next

Step-6: Confirm paths then hit Next

Step-7: Choose Database Driver.

choose database driver

Step-8: Database settings. Fill the fields then hit Next

database settings

Step-9: Installation. Press Continue

Step-10: Installation – Moodle 2.4.4+
If every thing is correct you will see Continue button.

continue

Hit Continue. It will get installed.

Step-10: Once it get installed a form will appear, fill the necessary fields and click update profile.

Step-11: Front page settings
If you want to do some changes then do it and click Save changes.

moodle

How to Install WordPress on Localhost

WordPress is a CMS (Content Management System) that is written in PHP language. It is free and open source.
Official website: http://wordpress.org/
Download latest WordPress: http://wordpress.org/download/

You can install the wordpress on your local system.

Requirements:

1. You need a server to run wordpress as wordpress is written in php and it is a server-side scripting language.(Download Wamp)
2. You need WordPress (Download WordPress)

WordPress Installation:

1. Extract the wordpress in the www folder of wamp server (in my case location is C:\wamp\www)

2. search for file “wp-config-sample.php” in wordpress folder (in my case location is C:\wamp\www\wordpress) and change the name of the file to “wp-config.php”

3. Now open the file and change the following

3. Now start Wamp server

4. Once the Wamp server and database is started and running you will see the green wamp symbol

5. Open phpMyAdmin
phpmyadmin

6. Create a database with name “wordpress”
create database

7. Click on Localhost
Wamp server green symbol

8. Click on WordPress
click wordpress

9. Fill the details and click on Install WordPress

10.wordpress succesfully installed

11. Click on login to login into the control panel

12. open http://localhost/wordpress/ to see front end that will be seen by the user. To open control panel type http://localhost/wordpress/wp-admin in the url

Installation of PHP + Apache

In this post i am going to describe the procedure of installation of PHP and Apache on your own computer.

Step-1 Download PHP , I am using “php-5.2.5-Win32.zip”

Step-2 Download Apache, I am using “httpd-2.0.64-win32-x86-no_ssl.msi”

Step-3 Once you download , first install Apache server
           write localhost in the first two fields and put any email id in the last field.
           If you want Apache to automatically start with the operating system, which is recommended, then
          choose to install Apache as a service for all users. When you’re finished, click Next.
          You are prompted for a Setup Type: Typical or Custom. choose Typical and click Next

          Destination folder. By default, this is C:\Program Files\Apache Group. Consider changing this
          to C:\,which will create an installation directory C:\Apache2\. Now click install to complete the installation

Step-4 Unzip the PHP package, placing the contents into C:\php5\.

Step-5 Now add PHP installation directory path to the Windows Path.
           for this click start > settings > control panel > system > click on advanced tab click the
           Environment Variables button. In the Environment Variables dialog box, scroll through
           the System variables pane until you find Path. Double-click this line and, in the Edit
           System Variable dialog box, append C:\php5 to the path.

Step-6 Navigate to C:\apache2\conf and open httpd.conf for editing.

Step-7 Add the following three lines to the httpd.conf file. Consider adding them directly
           below the block of LoadModule entries located in the bottom of the Global Environment section.

Step-8 Rename the php.ini-dist file php.ini and save it to the C:\php5 directory.

step-9 navigate to Start > Settings > Control Panel > Administrative Tools > Services.
          Locate Apache in the list, and make sure that it is started. if already started then click on restart.

Testing Your Installation
The best way to verify your PHP installation is by attempting to execute a PHP script. Open a
text editor and add the following lines to a new file. Then save that file within Apache’s htdocs
directory as phpinfo.php:
phpinfo();
?>
Now open a browser and access this file by typing the appropriate URL:
http://localhost/phpinfo.php

now you can start coding in php .ENJOY!