CentOS 7 deployment Jenkins continuous integration environment

CentOS 7 deployment Jenkins continuous integration environment

Jenkins is a popular open source CI (continuous integration) tool, widely used in project development, deployment, and automation.

This article will guide you through the process of installation on CentOS 7 Jenkins server instance.

1. Prerequisites

Before you continue, you must have:

  • Scratch deployed CentOS 7 server instance.
  • root privileges

2. Deploy Ali cloud sources

curl -o /etc/yum.repos.d/CentOS-Base-ali.repo http://mirrors.aliyun.com/repo/Centos-7.repo

curl -o /etc/yum.repos.d/epel-7-ali.repo http://mirrors.aliyun.com/repo/epel-7.repo

yum clean all

yum makecache
Bash

3. Install Java

Before installing Jenkins, you need to install a Java Virtual Machine on the system. Here, let's use yum to install the latest JDK:

yum install -y java
Bash

After the installation is complete, you can confirm by running the following command:

java -version
Bash

4. Installation Jenkins

curl -o /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo

rpm --import http://pkg.jenkins-ci.org/redhat-stable/jenkins-ci.org.key
Bash

Use the official  yum install the latest stable version of Jenkins:

yum install -y jenkins
Bash

Jenkins started the service and set to run at startup:

systemctl start jenkins.service

systemctl enable jenkins.service
Bash

To allow visitors to Jenkins, you need to allow incoming traffic on port 8080:

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

firewall-cmd --reload
Bash

Now, go to the following address from a browser by accessing Jenkins:

http://服务器IP:8080
Bash

4.1. Basic Configuration

  1. Unlock jenkins

    Follow the prompts to use the  cat View command password

    cat /var/lib/jenkins/secrets/initialAdminPassword
    Bash
  2. Custom Jenkins

    Jenkins plugin automatically download and install from the network, because the plug-in server in a foreign country, will produce network latency issues cause the installation to fail.

    So choose  选择插件来安装 . This time we will not select any plug-in for quick installation, the latter through  插件管理器 plug-in installation required.

  3. Create the first administrator user

  4. Examples of configuration

    You can modify the address and port, no proposed changes. Keep the default.

  5. Plug-in installation

    System Management -> Manage Plugins -> optional plug-ins -> Filters

    HTML Publisher

    Workspace Cleanup

    Subversion

    Startup Trigger

    Groovy

5. Deploy Python 3

Deployment compiler environment

yum -y groupinstall 'Development Tools'

yum -y install zlib zlib-devel libffi-devel openssl-devel
Bash

Python official website to download the latest version of the Python source code.

In this paper, Python-3.7.2 Case Study

cd /tmp

curl -O https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tgz

tar xf Python-3.7.2.tgz
Bash

Python Configuration

./Python-3.7.2/configure
Bash

Build and install Python 3

make install Python-3.7.2
Bash

Confirm successful deployment Python 3

python3 --version
Bash

Installation of automated library-related dependence Python

pip3 install selenium

pip3 install ddt

pip3 install htmlreport

pip3 list
Bash

6. Jenkins related

  • Profiles /etc/sysconfig/jenkins

  • Enabled by default 8080

  • Journal /var/log/jenkins/jenkins.log

  • service status systemctl status jenkins

  • Start Service systemctl start jenkins

  • Out of service systemctl stop jenkins

  • Restart Service systemctl restart jenkins

Guess you like

Origin www.cnblogs.com/nullnullnull/p/11114551.html