Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 19 Current »

Contents

Introduction

This document describes the steps to create Peer Jenkins server and establish the connection with the LF master Jenkins

Infrastructure Requirements for VM

Minimum hardware requirements:

  • 256 MB of RAM
  • 1 GB of drive space (although 10 GB is a recommended minimum if running Jenkins as a docker container)
  • Ubuntu 16.04 or higher OS

Recommended hardware configuration:

  • 1 GB+ of RAM
  • 50 GB+ of drive space

Software requirements:

  • Java
  • Web browser compatibility
  • Docker to be installed if Jenkins server running as a container


Installation Guide

Install Java

Since Jenkins is a Java application, the first step is to install Java. Update the package index and install the Java 8 OpenJDK package with the following commands

sudo apt-get update
sudo apt install openjdk-8-jdk


Install Docker

Step 1: First, in order to ensure the downloads are valid, add the GPG key for the official Docker repository to your system

curl -s https://apt.dockerproject.org/gpg | sudo apt-key add
apt-key fingerprint 58118E89F3A912897C070ADBF76221572C52609D

Step 2: Add the Docker repository to APT sources

sudo
add-apt-repository "deb https://apt.dockerproject.org/repo ubuntu-$(lsb_release -cs) main"

Step 3: Next, update the package database with the Docker packages from the newly added repo

sudo apt-get update

Step 4 : Make sure you are about to install from the Docker repo instead of the default Ubuntu 16.04 (xenial):

sudo apt-cache policy docker-engine

You should see output like the follow:

Output of apt-cache policy docker-engine

docker-engine

Step 5: Finally, Install Docker

sudo apt-get install docker-engine=1.13.0-0~ubuntu-xenial

Step 6: Docker should now be installed, the daemon started, and the process enabled to start on boot. Check that it's running

sudo systemctl status docker


Setting up the Peer Jenkins server

Step 1 : Pulling the latest jenkins image from docker hub

sudo docker pull jenkins
sudo docker images

Step 2 : create a jenkins.sh file under /data directory

sudo vi jenkins.sh

add below startup script in Jenkins.sh file for running the Jenkins in a container

#!/bin/bash
export DROOT=/data
export DOMAIN=your.domain.name
docker run --detach --name jenkins --restart=always --hostname jenkins.$DOMAIN --volume $DROOT/jenkins:/var/jenkins_home  --volume /var/run/docker.sock:/var/run/docker.sock --publish 80:8080 jenkins/jenkins

save the changes and run the script using below command

./jenkins.sh (or) 
sudo sh jenkins.sh

Step 3 : Pulling the latest jenkins image from docker hub

sudo docker ps
  • if the Jenkins container is restarting again and again then check the logs using below command

    sudo docker logs --tail 50 –follow --timestamps Jenkins
  • If the logs are showing like below Wrong volume permissions?

    touch: cannot touch '/var/jenkins_home/copy_reference_file.log': Permission denied
    Can not write to /var/jenkins_home/copy_reference_file.log. 

    The volume directory /data/jenkins need to be separated with the admin ownership to keep the Jenkins home

    sudo chown 1000 /data/Jenkins

    Then run the command: (Now the container is up and running)

    sudo docker ps -a 

    Executing into Jenkins container

    sudo docker exec -it jenkins /bin/bash 

    Inside the Jenkins container, go to /var/Jenkins_home/secrets/ directory. Copy the initial admin password like this

    cat /var/Jenkins_home/secrets/initialAdminPassword

Accessing Jenkins Peer and continue setup

Default port for Jenkins is 8080 and this should be open. To set up your new Jenkins installation, open your browser and type your domain or IP address followed by port 8080

http://your_ip_or_domain:8080

A screen like the following will appear, prompting you to enter the Administrator password that is created during the installation

Use the following command to print the password on your Jenkins container

cat /var/jenkins_home/secrets/initialAdminPassword

You should see a 32-character long alphanumeric password. Copy the password from your terminal, paste it into the Administrator password field and click Continue

On the next screen, you will be asked whether you want to install the suggested plugins or to select specific plugins. Click on the Install suggested plugins box, and the installation process will start immediately.

Once the installation is complete, you will be prompted to set up the first administrative user. Fill out all required information and click Save and Continue.

On the next page, you will be asked to set the URL for the Jenkins instance. The URL field will be populated with an automatically generated URL.

To complete the setup, confirm the URL by clicking on the Save and Finish button.

Finally, click on the Start using Jenkins button and you will be redirected to the Jenkins dashboard logged in as the admin user you have created in one of the previous steps.

If you’ve reached this point, you’ve successfully installed Jenkins.

  • No labels