How can we help?
Categories
< All Topics
Print

Setting Up a CI/CD Pipeline with Jenkins on Server Stadium Cloud VMs or Dedicated Servers

Introduction

Continuous Integration and Continuous Deployment (CI/CD) are critical practices in modern software development that automate the integration, testing, and deployment of code. Using Jenkins, an open-source automation server, you can establish a robust CI/CD pipeline on a Server Stadium dedicated server or cloud VM. This guide explains how to install and configure Jenkins on Server Stadium cloud VMs or dedicated servers, optimizing your development process.

Prerequisites

  • Access to Server Stadium cloud VMs or dedicated servers running Ubuntu 20.04 LTS or 22.04 LTS. If you do not have an account, sign up here.
  • Administrative or sudo privileges on your server.
  • Basic knowledge of software development, version control systems, and Linux command line.

Step 1: Install Jenkins

  1. Install Java
    Jenkins requires Java to run. Install Java using the following commands:

    sudo apt update
    sudo apt install openjdk-11-jdk

  2. Add Jenkins Repository
    Add the Jenkins repository to your system:

    wget -q -O – https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add –
    sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'

  3. Install Jenkins
    Update your package list and install Jenkins:

    sudo apt update
    sudo apt install jenkins

  4. Start Jenkins
    Start the Jenkins service and enable it to run at startup:

    sudo systemctl start jenkins
    sudo systemctl enable jenkins

Step 2: Configure Jenkins for CI/CD

  1. Access Jenkins Dashboard
    Open a web browser and navigate to http://your-server-ip:8080. You’ll be prompted to unlock Jenkins using an initial admin password found at:

    sudo cat /var/lib/jenkins/secrets/initialAdminPassword

    Enter the password to continue the setup.
  2. Install Suggested Plugins
    Choose to install the suggested plugins, which cover most Jenkins use cases and help with various automation tasks.
  3. Create an Admin User
    Create an admin user to securely manage Jenkins.
  4. Configure System Settings
    Set your Jenkins URL and configure email notifications if necessary.

Step 3: Create Your First Jenkins Job

  1. Create a New Job
    Click on “New Item” in the Jenkins dashboard, name your project, and select “Freestyle project”. Click OK.
  2. Configure Source Code Management
    Under the Source Code Management tab, select your version control system (e.g., Git) and provide repository URL and credentials.
  3. Set Build Triggers
    Configure build triggers according to your needs, such as triggering a build on every commit or periodically.
  4. Add Build Steps and Post-build Actions
    Specify commands or scripts that compile and test your code. Set post-build actions to deploy your application or notify team members.

Conclusion

Setting up Jenkins on a Server Stadium dedicated server enables you to automate your development and deployment processes, enhancing productivity and reducing the likelihood of errors in production. With Jenkins, you can continuously integrate code changes, ensure that your build passes all tests, and automatically deploy to production environments.

For further assistance or to explore more about Jenkins and CI/CD practices, visit our knowledge base or the Server Stadium website.

Table of Contents