•  Home
  •  Dashboard
  •  Company
    • About Us
    • Blog
    • Careers
    • Contact Us
    • Data Centers
    • Looking Glass
    • Network
    • Reseller
  •  Hosting Services
    • Infrastructure
      • iColocation
    • Compute
      • cMetal
      • cVirtual
    • Storage
      • sObject
      • sBlock
    • Networking
      • nIP Transit
      • nWavelength
    • Protection
      • pBackup
      • pDDoS
  •  Solutions
    • Ecommerce
    • Finance
    • Gaming
    • Hosting
    • Management
    • Security
    • System Integrator
  •  Support
    • Community
    • Knowledge Base
    • Open A Ticket
    • Status
  •  USA & Canada: 800-933-1517
  •  International: 626-549-2801
  •  Email: sales@psychz.net
  • Services
    • new-colocation-header-img
      Infrastructure
      • iColocation
    • new-compute-header-img
      Compute
      • cMetal
      • cVirtual
    • new-storage-header-img
      Storage
      • sObject
      • sBlock
    • new-networking-header-img
      Networking
      • nIP Transit
      • nWavelength
    • new-protection-header-img
      Protection
      • pBackup
      • pDDoS
  • Solutions
    • Ecommerce
    • Security
    • Gaming
    • Hosting
    • Management
    • Finance
    • System Integrator
  • Dashboard

Deploy Psychz Dedicated Server Using Jenkins Pipeline Scripts

  • Home
  • Client
  • Knowledgebase
  • API
  • Deploy Psychz Dedicated Server Using Jenkins Pipeline Scripts

Table Of Content

    Related Articles

    • API Introduction
    • How to install an Operating System using the API?
    • How To Place An Order Using The API?
    • How to setup API Access

    Deploy Psychz Dedicated Server Using Jenkins Pipeline Scripts

    Publisher: Psychz Networks March 21,2023
    • Installing Java
    • Required Plugins
    • Adding Credentials
    • Creating Pipeline
    • Execute Pipeline

    Jenkins is an open-source continuous integration tool that helps automate the software build, testing, and deployments involved in software development. It is written in Java, so it will require Java to be installed on our system.
    Here, we will see how to install Jenkins on Rocky Linux 8 / AlmaLinux 8.

    Installing Java


    Step 1: Install OpenJDK – JAVA

    As Jenkins is written in Java, thus we need a Java development kit installed on our AlmaLinux or Rocky. Here will install the OpenJDK version that is available in the official repo of our Linux.

    $ sudo dnf install java-11-openjdk -y


    Step 2: Add Jenkins RPM repo on AlmaLinux/Rocky.

    The next thing is to add the source from where we will receive the Jenkins packages and updates to install. For that, we need to add the official RPM repo of Jenkins on our Linux using the below commands:

    First, import and add the GPG key:

    $ sudo rpm --import https://pkg.jenkins.io/redhat/jenkins.io.key

    Next, add and create the repository.

    $ sudo tee /etc/yum.repos.d/jenkins.repo<<EOF

    [jenkins]
    name=Jenkins-stable
    baseurl=http://pkg.jenkins.io/redhat-stable
    gpgcheck=1

    EOF

    Press Enter key and provide your user password, and the repo will be created.


    Step 3: Refresh system repos

    Refresh the repository cache to integrate the newly added repository into the system.

    $ sudo dnf makecache


    Step 4: Command to install Jenkins on Almalinux or Rocky Linux

    Finally, run the command to install and set up the Jenkins server on our Redhat-based Linux operating system.

    $ sudo dnf install jenkins

    Important: If you don't want to use the repo, download the RPM package directly from Github.

    To install the RPM package, switch to the directory where you have downloaded the file and run the below command

    $ sudo dnf install ./jenkins-*.noarch.rpm


    Step 5: Start & enable Jenkins Service

    To start the Jenkins service on Almalinux or Rocky and also enable the same so that it can start automatically with system boot, follow the given command-

    $ sudo systemctl enable --now jenkins


    Step 6: Allow Jenkins port 8080 to access from a remote system

    Although after installing and running this automation server services, we can access its web interface from a locally installed browser; however, if you are using a CLI server, we have to use a remote system browser to access it. For that, the ports must be opened in the AlmaLinux firewall.

    $ sudo firewall-cmd --permanent --zone=public --add-port=8080/tcp
    $ sudo firewall-cmd --reload


    Step 7: Note Admin password

    With the installation, Jenkins will create a password for the Admin user. To find that, run the below command and then copy the same.

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


    A password will be displayed, copy and save it somewhere.


    Step 8: Access Jenkins web interface

    Now, open a browser on your local system or any other system to access the IP address of the system where the Jenkins server has been installed.

    In the browser URL address bar type- http://server-ip-address:8080

    Enter the Username and Password and sign-in


    Step 9: Install Plugins

    You will have two options to install Jenkins plugins to extend its features. It is recommended to go for the "Install Suggested Plugins" option. We will also install or additional plugins later from the Jenkins web interface.

    Select "Install suggested plugins"


    Step 10: Create First Admin User

    Once you have configured the Plugins, create an Admin user account that will be used to login to the Jenkins web interface later.

    Enter the required details and ensure that you save or memorize the password you have used to create the Admin login.

    After that, the setup will provide a page for Instance, and Configuration, showing the current URL to access Jenkins. Just save and continue.

    Step 11: Jenkins dashboard

    Finally, you have successfully run and configured Jenkins on AlmaLinux. Now you can Create new pipelines to start testing applications.

    List of Jenkins Plugins

    Jenkins, by default, will install a set of plugins required to run it. Apart from the installed plugins, you will also need a few additional plugins to create and run your pipeline successfully builds.

    To download and install the plugins, go to the main dashboard and click on "Manage Jenkins" with the gear icon on the left-side navigation menu bar. Now, under "System Configuration," click on "Manage Plugins." On the left-hand side, click on "Available Plugins" to search the required plugins as mentioned below, one by one.
    Select the checkbox next to the plugin name and hit the "Download now and install after restart" button at the bottom of the page.

    1. Credentials Plugin
    2. Credentials Binding Plugin
    3. commons-lang3 v3.x Jenkins API Plugin Version
    4. Checks API plugin
    5. Caffeine API Plugin
    6. Apache HttpComponents Client 4.x API Plugin
    7. Branch API Plugin
    8. Maven Integration plugin
    9. HTTP Request Plugin
    10. Pipeline: Groovy Libraries
    11. Pipeline: REST API Plugin
    12. Plain Credentials Plugin
    13. Plugin Utilities API Plugin
    14. SSH Build Agents plugin

    Adding credentials

    Jenkins offer a module that lets you save all the login credentials safely which you can easily call via a code in your pipeline script. Itis highly advisable to add your login credentials like security token and username or password in Jenkins "Credential" module.

    Follow the steps given below

    Step 1 : To access "Credentials" feature, click on "Manage Jenkins" with the gear icon on the left-side navigation menu bar. Now, under "Security," click on "Credentials." Navigate to "System" > "Global credentials (unrestricted)."

    Step 2: Click on "Add Credentials."

    Step 3: Select "Username with password" from the "Kind" dropdown.

    Step 4: Enter your Psychz API access token as the "Username" and your access username as the "Password".

    Step 5: Assign a unique ID to this credential, e.g., "psychz-api-credentials".

    Step 6: Click "OK" to save the credentials.


    Create Jenkins Pipeline

    Create a new Jenkins pipeline job and configure it to use a Jenkinsfile or the pipeline script directly. To create a pipeline, click on "New Item" with the + icon on the dasboard and select "Pipeline" module from the list. Before moving forward, name the pipeline that you wish to create.

    Scroll down to the "Pipeline" section with the text area (under Script) and copy the below pipeline script and paste it in the text area.

    import groovy.json.JsonSlurper
    pipeline {
    agent any
    stages {
    stage('Deploy dedicated server') {
    steps {
    script {
    withCredentials([usernamePassword(
    credentialsId: 'psychz-api-credentials',
    usernameVariable: 'ACCESS_TOKEN',
    passwordVariable: 'ACCESS_USERNAME'
    )]) {
    def apiUrl = 'https://api.psychz.net/v1/order_express'
    def payload = [
    access_token: ACCESS_TOKEN,
    access_username: ACCESS_USERNAME,
    plan_id: 138,
    order_quantity: 1,
    payment_mode: 1,
    os_cat: 1,
    os_id: 7366,
    disk_partition_id: 9,
    software_raid: 1,
    hostname: 'testserver1',
    password: 'test1234567890',
    partner_id: 0,
    enforce_password_change: 0
    ]
    def response = httpRequest(
    url: apiUrl,
    httpMode: 'POST',
    contentType: 'APPLICATION_JSON',
    requestBody: groovy.json.JsonOutput.toJson(payload),
    validResponseCodes: '200:404'
    )
    def jsonResponse = new JsonSlurper().parseText(response.content)
    echo "Order ID: ${jsonResponse.data.order_id}"
    return jsonResponse.data.order_id
    }
    }
    }
    }
    }
    }

    Save the Jenkinsfile and commit it to your source control repository if necessary.

    Execute Pipeline

    You can use the "Build Now" feature to test run your pipeline or Trigger the Jenkins pipeline job automatically (e.g., through webhooks).

    Once the pipeline is executed successfully (indicated in green), you can check the console output to see the fetched results.

    The above pipeline script sends a POST request to the Psychz API to order the specified dedicated servers, using the stored credentials. The response from the API will be displayed in the Jenkins job console output. By using the withCredentials function from the Credentials Binding plugin, you're securely binding the stored credentials to environment variables that can be used in the pipeline script without exposing the sensitive data.

    IMPORTANT NOTE: Please ensure to whitelist your IP Address before you attempt to build the pipeline. To know how to whitelist an IP address, please refer to the following article Setup API Access Key

    Views: (2171) Votes: (0)

    Related Articles

    • API Introduction
    • How to install an Operating System using the API?
    • How To Place An Order Using The API?
    • How to setup API Access
    Copyright © 2026 Psychz Networks,
    A Profuse Solutions Inc Company
    Hosting Services
    • Catalog
    Infrastructure
    • iColocation
    Compute
    • cMetal
    • cVirtual
    Storage
    • sObject
    • sBlock
    Networking
    • nIP Transit
    • nWavelength
    Protection
    • pBackup
    • pDDoS
    Company
    • About Us
    • Blog
    • Careers
    • Contact Us
    • Data Centers
    • Looking Glass
    • Network
    • Reseller
    Policies
    • Acceptable Usage Policy
    • Privacy Policy
    • Service Level Agreement
    • Terms and Conditions
    Support
    • Community
    • Knowledge Base
    • Open A Ticket
    • Status
    Get In Touch
    • Psychz Networks,
      A Profuse Solutions Company
      611 Wilshire Blvd #300
      Los Angeles,California 90017
      USA
    • US/Canada: 800-933-1517
    • International: 626-549-2801