安装jdk11版本
yum -y install fontconfig java-11-openjdk
#查看安装路径
rpm -qa |grep java
vim ~/.bashrc
添加java路径
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-11.0.23.0.9-2.el7_9.x86_64
export PATH=$JAVA_HOME/bin:$PATH
重新加载配置文件
source ~/.bashrc
java -version
安装maven
mkdir /usr/local/maven
cd /usr/local/maven
wget https://archive.apache.org/dist/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
tar -zxvf apache-maven-3.6.3-bin.tar.gz
添加maven路径
vim ~/.bashrc
#添加这俩句
export MAVEN_HOME=/usr/local/maven/apache-maven-3.6.3
export PATH=$MAVEN_HOME/bin:$PATH
source ~/.bashrc
mvn -v
配置maven本地仓库路径
进入 conf 目录,并编辑settings.xml配置文件:
vim /usr/local/maven/apache-maven-3.6.3/conf/settings.xml
找到 localRepository 标签,添加本地仓库路径添加字段
<localRepository>/usr/local/maven/mvn_repo</localRepository>
找到 mirrors 标签,添加阿里云镜像下载地址
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
安装git
yum -y install git
git --version
安装jenknis
先下载证书 再下载包
yum install -y ca-certificates
wget https://repo.huaweicloud.com/jenkins/redhat-stable/jenkins-2.190.3-1.1.noarch.rpm
rpm -ivh jenkins-2.190.3-1.1.noarch.rpm
添加java路径
vim /etc/init.d/jenkins
#添加
/usr/lib/jvm/java-11-openjdk-11.0.23.0.9-2.el7_9.x86_64/bin/java
启动jenknis
systemctl daemon-reload
systemctl start jenkins
systemctl status jenkins
关闭防火墙
systemctl stop firewalld
访问jenkins
浏览器访问 http://ip:8080
# 查看密码
cat /var/lib/jenkins/secrets/initialAdminPassword
输入完后,会提示选择安装插件,这里不选择安装任何插件,因为安装源在国外的网站,速度是十分慢还可能失败,后面我们自己会配置安装插件的源