jenkins的安装
- 下载地址:https://pkg.jenkins.io/redhat-stable/
1、yum安装
# 提前安装jdk环境
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 epel-release # repository that provides 'daemonize'
yum install java-11-openjdk-devel
yum install jenkins
2、tomcat安装
# 提前安装jdk环境
vi /etc/profile
export JAVA_HOME=/usr/local/jdk
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
wget https://get.jenkins.io/war-stable/2.319.1/jenkins.war
wget https://dlcdn.apache.org/tomcat/tomcat-9/v9.0.56/bin/apache-tomcat-9.0.56.tar.gz
tar -xf apache-tomcat-9.0.56.tar.gz
mv apache-tomcat-9.0.56 /usr/local/tomcat
cd /usr/local/tomcat/webapps
rm -rf ./*
mv ~/jenkins.war .
mv jenkins.war ROOT.war
/usr/local/tomcat/bin/startup.sh
[root@k3 ~]# ss -nltp | grep java
LISTEN 0 100 [::]:8080 [::]:* users:(("java",pid=4569,fd=57))
LISTEN 0 1 [::ffff:127.0.0.1]:8005 [::]:* users:(("java",pid=4569,fd=148))
3、docker安装
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yumm -y install docker-ce
[root@k1 ~]# cat /etc/docker/daemon.json
{
"registry-mirrors": ["https://tobb73u0.mirror.aliyuncs.com"],
"exec-opts": ["native.cgroupdriver=systemd"]
}
systemctl daemon-reload
systemctl restart docker
# 提前安装jdk环境
docker pull jenkins/jenkins
docker run -d --name jenkins -p 8080:8080 -p 50000:50000 -u root -v /opt/jenkins_home:/var/jenkins_home -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker -v /usr/local/maven:/usr/local/maven -v /usr/local/jdk:/usr/local/jdk -v /etc/localtime:/etc/localtime --restart=always --name jenkins jenkins/jenkins
/var/jenkins_home:数据目录映射
/etc/localtime:时区映射
[root@k2 ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
94fcf890acfc jenkins/jenkins "/sbin/tini -- /usr/…" 3 minutes ago Up 3 minutes 0.0.0.0:8080->8080/tcp, :::8080->8080/tcp, 0.0.0.0:50000->50000/tcp, :::50000->50000/tcp jenkins
maven安装
- 下载地址: https://maven.apache.org/download.cgi
- tomcat下载地址:https://tomcat.apache.org/download-90.cgi
wget https://dlcdn.apache.org/maven/maven-3/3.8.4/binaries/apache-maven-3.8.4-bin.tar.gz
tar -xf apache-maven-3.8.4-bin.tar.gz
vi /etc/profile
export PATH=$JAVA_HOME/bin:$PATH:/usr/local/maven/bin
source /etc/profie
[root@k3 ~]# cat /root/.jenkins/secrets/initialAdminPassword
74d8bb181a6c4d66947efbae4d1a17ba