Monday 11 March 2019

How to Install Jenkins by Raj Gupta


Prerequisites

  1. EC2 Instance
    • With Internet Access
    • Security Group with Port 8080 open for internet
  2. Java 11 should be installed

Install Jenkins

You can install jenkins using the rpm or by setting up the repo. We will set up the repo so that we can update it easily in the future.

  1. Get the latest version of jenkins from https://pkg.jenkins.io/redhat-stable/ and install

    sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
    sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
    amazon-linux-extras install epel 
    amazon-linux-extras install java-openjdk11  
    
    #on RedHat/CentOs 
    #yum install epel-release # repository that provides 'daemonize'
    #yum install java-11-openjdk-devel
    #yum install jenkins

    Start Jenkins

    # Start jenkins service
    service jenkins start
    
    # Setup Jenkins to start at boot,
    chkconfig jenkins on

    Accessing Jenkins

    By default jenkins runs at port 8080, You can access jenkins at

    http://YOUR-SERVER-PUBLIC-IP:8080

Configure Jenkins

  • The default Username is admin
  • Grab the default password
  • Password Location:/var/lib/jenkins/secrets/initialAdminPassword
  • Skip Plugin Installation; We can do it later
  • Change admin password
    • Admin > Configure > Password
  • Configure java path
    • Manage Jenkins > Global Tool Configuration > JDK
  • Create another admin user id

Test Jenkins Jobs

  1. Create “new item”
  2. Enter an item name – My-First-Project
    • Chose Freestyle project
  3. Under the Build section Execute shell: echo "Welcome to Jenkins Demo"
  4. Save your job
  5. Build job
  6. Check "console output"

No comments:

Post a Comment