Table of Contents
不带时间的个性主机名" >不带时间的个性主机名
关闭CentOS7自带的防火墙服务" >关闭CentOS7自带的防火墙服务
关闭SeLsinux" >关闭SeLsinux
安装Git" >安装Git
安装JDK" >安装JDK
添加Jenkins源" >添加Jenkins源
导入Jenkins密钥" >导入Jenkins密钥
安装Jenkins" >安装Jenkins
可选-挂载磁盘-设置Jenkins目录" >可选-挂载磁盘-设置Jenkins目录
修改Jenkins的用户和端口号" >修改Jenkins的用户和端口号
设置开机自启" >设置开机自启
获取Jenkins密码" >获取Jenkins密码
网页访问" >网页访问
选择需要安装的插件" >选择需要安装的插件
Home Computer Tutorials Computer Knowledge CentOS7 deploys cicd service in Jenkins

CentOS7 deploys cicd service in Jenkins

Feb 20, 2024 am 08:30 AM
jenkins m CPU name

项目地址

https://www.jenkins.io/zh/

CentOS7 deploys cicd service in Jenkins

设置主机名:

hostnamectl set-hostname jenkins
Copy after login

不带时间的个性主机名

echo "PS1='[e[37;1m][[e[36;40m][e[32;40m]u[e[33;40m]@[e[31;40m]h [e[34;40m]w[e[37;1m]]\$[e[m]'" >>.bashrc
Copy after login

关闭CentOS7自带的防火墙服务

systemctl disable firewalld && systemctl stop firewalld
Copy after login

关闭SeLsinux

sed -i 's/enforcing/disabled/' /etc/selinux/config && setenforce 0
Copy after login

安装Git

yum install git -y
Copy after login

安装JDK

yum install -y java-1.8.0
yum install -y java-1.8.0-openjdk*
Copy after login

添加Jenkins源

最新版:
wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins.io/redhat/jenkins.repo

稳定版本:
wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
Copy after login

导入Jenkins密钥

最新版:
rpm --import http://pkg.jenkins.io/redhat/jenkins.io.key

稳定版本
rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
Copy after login

ps:如果在以前从Jenkins导入过密钥,那么“rpm –import”将失败,因为在服务器上已经有了一个密钥。所以,这个错误信息可以忽略

安装Jenkins

### 安装当时最新稳定版
yum install -y jenkins

### rpm包安装指定版本,具体当前稳定版是哪个?https://www.jenkins.io/zh/download/
# redhat老版本
https://mirror.tuna.tsinghua.edu.cn/jenkins/redhat/
# redhat稳定版
https://mirror.tuna.tsinghua.edu.cn/jenkins/redhat-stable/

# 下载稳定版
wget https://mirror.tuna.tsinghua.edu.cn/jenkins/redhat-stable/jenkins-2.303.2-1.1.noarch.rpm

# 需要的依赖软件
yum install daemonize -y

# 开始安装
[root@jenkins ~]#rpm -ivh jenkins-2.303.2-1.1.noarch.rpm 
Preparing...################################# [100%]
Updating / installing...
 1:jenkins-2.303.2-1.1################################# [100%]
Copy after login

可选-挂载磁盘-设置Jenkins目录

格式化磁盘
mkfs.ext4 /dev/vdb 
创建data目录
mkdir /data/
挂载目录
mount /dev/vdb /data
设置开机自动挂载
echo "/dev/vdb /data ext4 defaults 0 0" >> /etc/fstab
创建Jenkins目录
mkdir /data/jenkins
设置Jenkins目录所属组所属用户
chown -R jenkins.jenkins /data/jenkins/
Copy after login

修改Jenkins的用户和端口号

ps:此处是因为Jenkins的端口号默认是8080,与tomcat的默认端口冲突
所以可以根据自己的条件判断是否需要修改,此处我是已经修改为9999端口
ps:此处是因为Jenkins的用户默认是jenkins,我们可以改为root用户来管理jenkins

vim /etc/sysconfig/jenkins

# 配置Jenkins的运行用户,这里不是登录用户
JENKINS_USER="root"

# 配置Jenkins的端口
JENKINS_PORT="8080"

# 配置Jenkins的目录
JENKINS_HOME="/data/jenkins"

# 配置资源限制
JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true -Xms256m -Xmx512m -XX:MaxNewSize=256m"
Copy after login

设置开机自启

systemctl start jenkins && /sbin/chkconfig jenkins on && systemctl status jenkins
Copy after login

获取Jenkins密码

cat /var/lib/jenkins/secrets/initialAdminPassword
Copy after login

网页访问

打开xxx.xxx.xxx.xxx:8080
Copy after login

选择需要安装的插件

选择默认推荐即可,会安装通用的社区插件,剩下的可以在使用的时候再进行安装。
Copy after login

The above is the detailed content of CentOS7 deploys cicd service in Jenkins. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1669
14
PHP Tutorial
1273
29
C# Tutorial
1256
24
3 tips to easily customize your Mac computer name, host name and Bonjour name 3 tips to easily customize your Mac computer name, host name and Bonjour name Mar 06, 2024 pm 12:20 PM

Many Mac users tend to keep the default name of their device and may never consider changing it. Many people choose to stick with the name from the initial setup, such as "Johnny's MacBook Air" or simply "iMac." Learning how to change the name of your Mac is a very useful skill, especially when you have multiple devices, as it can help you quickly distinguish and manage them. Next, we will teach you step by step how to change the computer name, host name and Bonjour name (local host name) in macOS system. Why should you change your Mac name? Changing the name of your Mac can not only show your personality, but also help improve the user experience: Personalize your Mac: The default name may not be to your taste, change it to a name you like.

How to use Jenkins Pipeline to build a continuous packaging and deployment process for PHP programs? How to use Jenkins Pipeline to build a continuous packaging and deployment process for PHP programs? Jul 30, 2023 pm 07:41 PM

How to use JenkinsPipeline to build a continuous packaging and deployment process for PHP programs? Jenkins is a very popular continuous integration and deployment tool. It provides a wealth of plug-ins and functions to make the build and deployment process simple and efficient. JenkinsPipeline is the latest plug-in for Jenkins, which allows us to use a complete and extensible DSL (DomainSpecificLanguage) to define continuous integration and deployment.

The role and setting method of MySQL host name The role and setting method of MySQL host name Mar 01, 2024 am 11:36 AM

The role and setting method of the MySQL host name MySQL is a popular open source database management system that is widely used in various websites and applications. In the MySQL database, the hostname plays a very important role. It is used to identify the host or client connecting to the database. Host names have many uses in MySQL, including authorizing access, identifying connection sources, controlling access permissions, etc. This article will introduce the role of the MySQL host name and how to set up the host

Detailed explanation of the meaning of MySQL host name Detailed explanation of the meaning of MySQL host name Mar 01, 2024 pm 12:03 PM

The meaning and specific usage of MySQL host name MySQL is a popular open source relational database management system that is widely used in various web applications. In MySQL, hostname is an important concept, which is used to specify the name of the host connected to the database server. In this article, we will explain in detail what the MySQL hostname means and how to use it in actual development. The meaning of MySQL host name: In MySQL, the host name is used to specify which connections are allowed to

Jenkins in PHP Continuous Integration: Master of Build and Deployment Automation Jenkins in PHP Continuous Integration: Master of Build and Deployment Automation Feb 19, 2024 pm 06:51 PM

In modern software development, continuous integration (CI) has become an important practice to improve code quality and development efficiency. Among them, Jenkins is a mature and powerful open source CI tool, especially suitable for PHP applications. The following content will delve into how to use Jenkins to implement PHP continuous integration, and provide specific sample code and detailed steps. Jenkins installation and configuration First, Jenkins needs to be installed on the server. Just download and install the latest version from its official website. After the installation is complete, some basic configuration is required, including setting up an administrator account, plug-in installation, and job configuration. Create a new job On the Jenkins dashboard, click the "New Job" button. Select "Frees

The role and setting method of Linux host name The role and setting method of Linux host name Mar 15, 2024 am 10:06 AM

The role and setting method of Linux host name In Linux system, host name is a very important identifier, which can help users identify and manage network connections between different hosts. A hostname is usually composed of letters, numbers, and hyphens and is used to uniquely identify a computer on a network. Function: Identification: Host names can identify different computers, allowing users to easily distinguish between different hosts. Network connection: The host name plays an important role in network communication, allowing different hosts to identify and communicate with each other.

AITO's Wenjie M9 panoramic smart flagship SUV is about to debut AITO's Wenjie M9 panoramic smart flagship SUV is about to debut Sep 26, 2023 pm 02:41 PM

According to news on September 25, Huawei Mall has begun accepting reservations for AITO’s Wenjie M9 car. This car is positioned as a panoramic smart flagship SUV with eye-catching features. Consumers only need to pay a deposit of 5,000 yuan, which can be used to offset the final payment of up to 10,000 yuan. The new car will be available in two versions, namely the extended-range version and the pure electric version. The price is expected to be between 500,000 yuan and 600,000 yuan, making it competitive in the high-end SUV market. Wenjie M9 is expected to be officially launched in the fourth quarter of 2023. No information on its specific configuration has been disclosed yet. It is understood that the M9 model adopts a family-oriented design language. Judging from the two official pictures, the side lines of the vehicle are smooth, and the door handles adopt a hidden design, adding technology to the entire vehicle.

PHP Jenkins 101: The only way to get started with CI/CD PHP Jenkins 101: The only way to get started with CI/CD Mar 09, 2024 am 10:28 AM

Introduction Continuous integration (CI) and continuous deployment (CD) are key practices in modern software development that help teams deliver high-quality software faster and more reliably. Jenkins is a popular open source CI/CD tool that automates the build, test and deployment process. This article explains how to set up a CI/CD pipeline with Jenkins using PHP. Set up Jenkins Install Jenkins: Download and install Jenkins from the official Jenkins website. Create project: Create a new project from the Jenkins dashboard and name it to match your php project. Configure source control: Configure your PHP project's git repository as Jenkin

See all articles