CentOS7 deploys cicd service in Jenkins
项目地址
https://www.jenkins.io/zh/
设置主机名:
hostnamectl set-hostname jenkins
不带时间的个性主机名
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
关闭CentOS7自带的防火墙服务
systemctl disable firewalld && systemctl stop firewalld
关闭SeLsinux
sed -i 's/enforcing/disabled/' /etc/selinux/config && setenforce 0
安装Git
yum install git -y
安装JDK
yum install -y java-1.8.0 yum install -y java-1.8.0-openjdk*
添加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
导入Jenkins密钥
最新版: rpm --import http://pkg.jenkins.io/redhat/jenkins.io.key 稳定版本 rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
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%]
可选-挂载磁盘-设置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/
修改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"
设置开机自启
systemctl start jenkins && /sbin/chkconfig jenkins on && systemctl status jenkins
获取Jenkins密码
cat /var/lib/jenkins/secrets/initialAdminPassword
网页访问
打开xxx.xxx.xxx.xxx:8080
选择需要安装的插件
选择默认推荐即可,会安装通用的社区插件,剩下的可以在使用的时候再进行安装。
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!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



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 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 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

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

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

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.

The host name is an important identifier in the Linux system, which identifies the computer's identity and location on the network. Correctly setting the host name can help improve the efficiency of system management and the stability of network communication. This article will delve into the meaning of Linux hostnames, setup tips, and some specific code examples. 1. The meaning of the host name In the Linux system, the host name is used to identify the unique identity of the computer on the network. The host name usually consists of the host name and the domain name, in the following form: hostname.domainThe function of the host name

Introduction to PHPCI/CD CI/CD (ContinuousIntegration/ContinuousDelivery) is a software development practice that emphasizes frequently integrating code changes into the master branch and automatically building, testing, and deploying after each change. CI/CD can help developers quickly find and solve problems and improve the quality and reliability of applications. phpCI/CD Tools There are many open source and commercial PHPCI/CD tools to choose from, one of the most popular is Jenkins. Jenkins is an open source CI/CD tool that provides a wealth of plug-ins and extensions and supports multiple programming languages and tools. Jenkins demo code
