官网下载: https://www.oracle.com/java/technologies/javase/jdk11-archive-downloads.html
cd /usr/local
mkdir java
cd /usr/local/java
# 上传命令
rz
# 没有话安装一下
yum install lrzsz
tar -zxvf jdk-11.0.17_linux-x64_bin.tar.gz
# 一样没有就安装一下
yum install tar
vim /etc/profile
# 进入文件后添加这个两行数据 看下你自己的路径是不是跟我一样
export JAVA_HOME=/usr/local/java/jdk-11.0.17
export PATH=${JAVA_HOME}/bin:$PATH
# 刷新
source /etc/profile
java -version
官网下载: https://maven.apache.org/download.cgi
cd /usr/local
mkdir maven
cd /usr/local/maven
# 同上
tar -zxvf apache-maven-3.9.3-bin.tar.gz
# 同上
vim /etc/profile
# 进入文件后添加这个两行数据 看下你自己的路径是不是跟我一样
export M2_HOME=/usr/local/maven/apache-maven-3.9.3
export PATH=$M2_HOME/bin:$PATH
# 刷新
source /etc/profile
mvn -v
yum install git
yum -y install ca-certificates
wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io-2023.key
rpm -qa | grep jenkins
若已经安装了,则需要使用命令yum -y remove jenkins
进行卸载。若没有安装,则进行下一步。
yum install fontconfig java-11-openjdk
yum install jenkins
cd /var/lib/jenkins/updates
vim /etc/sysconfig/jenkins
# 端口可以改成自己想要的
JENKINS_PORT="6666"
vim /etc/init.d/jenkins
# 路径后面一定跟启动路径/bin/java
candidates="/usr/local/java/jdk-11.0.17/bin/java"
vim usr/lib/systemd/system/jenkins.service
# 添加
Environment="JENKINS_PORT=6666"
vim /etc/systemd/system/jenkins.service.d/override.conf
Environment="JENKINS_PREFIX=/jenkins"
vim /etc/sysconfig/jenkins
# 端口可以改成自己想要的
JENKINS_PORT="8880"
vim /etc/init.d/jenkins
# 路径后面一定跟启动路径/bin/java
candidates="/usr/local/java/jdk-11.0.17/bin/java"
vim usr/lib/systemd/system/jenkins.service
# 添加
Environment="JENKINS_PORT=6666"
vim /etc/systemd/system/jenkins.service.d/override.conf
Environment="JENKINS_PREFIX=/jenkins"
# 启动jenkins
systemctl daemon-reload
systemctl start jenkins
# 查看jenkins启动状态
systemctl status jenkins
# 关闭jenkins
systemctl daemon-reload
systemctl stop jenkins
# 重启jenkins
systemctl daemon-reload
systemctl restart jenkins
# 查看密码
cat /var/lib/jenkins/secrets/initialAdminPassword
浏览器中登录网址:http://ip:8080/,输入刚刚获得的管理员密码,点击“继续”即可。
如果还访问不了看下是不是端口没有开放
# 返回no表示没有开放
firewall-cmd --query-port=6666/tcp
firewall-cmd --zone=public --add-port=6666/tcp --permanent
# 此时查询还是no,需要再重启防火墙
firewall-cmd --reload
vim /etc/sysconfig/jenkins
#配置用户
$JENKINS_USER="root"
# 修改权限
chown -R root:root /var/lib/jenkins
chown -R root:root /var/cache/jenkins
chown -R root:root /var/log/jenkins
vim /usr/lib/systemd/system/jenkins.service
#修改一下内容
JENKINS_USER="root"
JENKINS_GROUP="root"
# 重启
service jenkins restart
ps -ef | grep jenkins