Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
On this page
Help Center/ Elastic Cloud Server/ Best Practices/ Setting Up an Application/ Installing and Deploying Jenkins on an ECS

Installing and Deploying Jenkins on an ECS

Updated on 2024-11-04 GMT+08:00

Preparations

  • Before installing Jenkins, purchase an ECS (recommended configuration: 4 GB+ memory and 40 GB+ disk size) running CentOS 7.6. Bind an EIP to the ECS.
  • After the ECS is purchased, add the inbound rule listed in the following table to the security group which the ECS belongs to. For details, see Adding a Security Group Rule.

    Direction

    Priority

    Action

    Type

    Protocol & Port

    Source Address

    Inbound

    1

    Allow

    IPv4

    TCP: 8080

    0.0.0.0/0

Procedure

  1. Install JDK.

    NOTE:

    To ensure compatibility with Jenkins, install OpenJDK 11 (view supported Java versions).

    1. Remotely log in to the purchased ECS.
    2. Run the following command to view the current JDK version:

      java -version

      If JDK exists and its version is earlier than 11, uninstall the JDK.

      rpm -qa | grep java | xargs rpm -e --nodeps

    3. Install JDK 11.

      yum install -y java-11-openjdk

    4. Restart the ECS.
    5. Check whether the installation is successful.

      java -version

  2. Install Jenkins.

    1. Run the following commands one at a time:

      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

      yum install -y jenkins --nogpgcheck

    2. Edit the Jenkins file.

      vim /etc/sysconfig/Jenkins

      #Port
      JENKINS_PORT="8080"
      #Modify the user
      $JENKINS_USER="root"
      #Modify directory permissions
      chown -R root:root /var/lib/jenkins
      chown -R root:root /var/cache/jenkins
      chown -R root:root /var/log/Jenkins
    3. Start Jenkins and check its status.

      systemctl start jenkins

      systemctl status jenkins

  3. Unlock Jenkins.

    1. In the address bar of your local browser, enter http:EIP bound to the ECS hosting Jenkins:8080. The unlocking page is displayed.

    2. Log in to the ECS.
    3. Obtain the activation password.

      cat /var/lib/jenkins/secrets/initialAdminPassword

    4. On the Unlock Jenkins page, paste this password into the Administrator password field and click Continue.
    5. Install suggested plugins. After the installation is complete, use the admin account to go to the next step.

    6. Save the settings and complete the installation. The Jenkins page is displayed.

Verification

Single Job

  1. Choose New item, select Freestyle Project, click OK.
  2. In Build Steps, select Execute shell, enter echo hello world; exit, and click OK.

  3. Click Build Now.
  4. Wait until the execution of build task in the lower left corner is complete. Click Console Output, you can see the job is finished and hello world is displayed.

Multiple Jobs

  1. On the plug-in management page, search for the MultiJob plug-in and install it.
    NOTE:
    • After the plug-in is installed, you need to restart Jenkins for the plug-in to take effect. Select Download now and install after restart.

    • After Jenkins is restarted, check whether the MultiJob plug-in takes effect on the installed plug-ins page.

  2. Click New item, select MultiJob Project, and click OK.

    NOTE:

    Before creating a MultiJob project, you need to create three jobs.

  3. In Build Steps, select MultiJob Phase.

  4. Add three jobs as follows:

  5. Save the settings. The jobs are added.
  6. Click Build Now. The three jobs are successfully built in sequence.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback