How to Install Jenkins (Deploying, Upgrade, Apache, Nginx Proxy) in Ubuntu Server 15.04 - 64bit - Cloud Network

Networking | Support | Tricks | Troubleshoot | Tips

Buymecoffe

Buy Me A Coffee

Wednesday, July 1, 2015

How to Install Jenkins (Deploying, Upgrade, Apache, Nginx Proxy) in Ubuntu Server 15.04 - 64bit


Hello Everyone,

In this tutorial,

Let Us Install Jenkins 1.617 in Ubuntu 15.04

Download Jenkins
Website :- https://www.jenkins-ci.org

Install the Oracle Java 8 JDK(JRE/JDK)

Type 'su' and the update "sudo apt-get update" then below steps follow :-
Step1 :- sudo apt-get install openjdk-8-jre
Step2 :- sudo apt-get install openjdk-8-jdk
Step3 :- java  -version

Download Java JDK 8 From Oracle Website
Website :- http://www.oracle.com/technetwork/java/javase/downloads/index.html

Watch My Video on How to install Oracle Java JDK 8

Watch Video :- https://www.youtube.com/watch?v=bd5BodEF5To&list=PLmMAzSMza_1e-bD-_wtYeP9mT52-XGMRj&index=55

Installing Jenkins
Step4 :- wget -q -O - https://jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -

Step5 :- sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list'

Step6 :- sudo apt-get update

Step7 :- sudo apt-get install jenkins

Upgrade to Latest Version
 If available for latest version you can update
 Step8 :- sudo apt-get update

Step9 :- sudo apt-get install jenkins

What does this package do?
Jenkins will be launched as a daemon up on start. See /etc/init.d/jenkins for more details.

The 'jenkins' user is created to run this service.

Log file will be placed in /var/log/jenkins/jenkins.log. Check this file if you are troubleshooting Jenkins.

/etc/default/jenkins will capture configuration parameters for the launch like e.g JENKINS_HOME

By default, Jenkins listen on port 8080. Access this port with your browser to start configuration.
The Ubuntu Jenkins maintainer also maintains for deployment in clouds.

Step11 :- juju deploy jenkins

Step12 :- juju deploy -n 5 jenkins-slave

Step13 :- juju add-relation jenkins jenkins-slave

The default password for the 'admin' account will be auto-generated. You can set it using:

Step14 :- juju set jenkins password=mypassword

Always change it this way - this account is used by the charm to manage slave configuration. Then feel free to expose your jenkins master:

Step15 :- juju expose jenkins

Setting up an Apache Proxy for port 80 -> 8080
This configuration will setup Apache2 to proxy port 80 to 8080 so that you can keep Jenkins on 8080.

 Step16 :- sudo aptitude install apache2

 Step17 :- sudo a2enmod proxy

 Step18 :- sudo a2enmod proxy_http

Note :- do not do this next command if you already have virtual hosting setup that depends on the default site.

Step19 :- sudo a2dissite default
Create a file called jenkins.conf in /etc/apache2/sites-available
<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName cloudnetwork.in
    ServerAlias cloud
    ProxyRequests Off
    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>
    ProxyPreserveHost on
    ProxyPass / http://localhost:8080/ nocanon
    AllowEncodedSlashes NoDecode
</VirtualHost>

 Step21 :- sudo a2ensite jenkins

 Step22 :- sudo apache2ctl restart
Setting up an Nginx Proxy for port 80 -> 8080

This configuration will setup Nginx to proxy port 80 to 8080 so that you can keep Jenkins on 8080.
 Step22 :- Install Nginx.

 Step23 :- sudo aptitude -y install nginx

 Remove default configuration.
 Step24 :- cd /etc/nginx/sites-available

 Step25 :- sudo rm default ../sites-enabled/default

Create new configuration for Jenkins.

Note: Sometimes your permissions (umask, etc) might be setup such that this won't work.
Create the file somewhere else then copy it into place if you run into that problem

Step27 :-  sudo cat > jenkins
upstream app_server {
    server 127.0.0.1:8080 fail_timeout=0;
}
server {
    listen 80;
    listen [::]:80 default ipv6only=on;
    server_name cloudnetwork.in
    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        if (!-f $request_filename) {
            proxy_pass http://app_server;
            break;
        }
    }
}
                                           Hit CTRL + D to finish writing the file
Link your configuration from sites-available to sites-enabled:

 Step28 :- sudo ln -s /etc/nginx/sites-available/jenkins /etc/nginx/sites-enabled/

 Step29 :- Restart Nginx

 Step30 :- sudo service nginx restart
Where to go from here?
(http://myserver/jenkins/ instead of http://myserver:8080/)

-------------------------------------------------------------------------------
For Your Information Only

I am Willing to Make a FREE or CHARGE Website, if YOU WANT ME TO MAKE A VIDEOS ON Different Technologies I WILL DO IT..

Share My Video, Like it, Watch Others Videos and Have any Quries Email me (itcloudnet@gmail.com)
----------------------------------------------------------------------------------


NOTE :- For Any Clarification Please Comment Below

Comment,
Like and
Share us and help us to spread.

####--------------------------­------------------------------­------------------------------­####
Subscribe :- http://www.youtube.com/user/itcloudnet?sub_confirmation=1
Website :- http://www.cloudnetwork.in
Facebook :- http://facebook.com/itcloudnetwork
Twitter :- http://twitter.com/itcloudnet
Pinterset :- http://pinterset.com/itcloudnet
LinkedIn :- http://in.linkedin.com/pub/itcloudnet
Google+ :- https://plus.google.com/u/0/107923552480070716949/posts
Skype Id :- cloud.network1
E-Mail Id :- itcloudnet@gmail.com
####--------------------------­------------------------------­------------------------------­--####

Thanking You
Hope U Like it........