Centos7安装 jenkins
作者:吴磊
1.安装git
yum install git -y
2.安装JDK
离线安装jdk1.8
01.上传jdk安装包并解压到/usr/local/src/
tar zxf jdk-8u251-linux-x64.tar.gz -C /usr/local/src/
02.配置环境变量
vim /etc/profile #增加如下配置
export JAVA_HOME=/usr/local/src/jdk1.8.0_172
export CLASSPATH=.:$CLASSPATH:$JAVA_HOME/lib
export PATH=$PATH:$JAVA_HOME/bin
source /etc/profile #使配置生效
3.安装jenkins
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.key
yum install jenkins -y
4.配置jenkins文件
01.安装完毕后更改jenkins配置文件
# vim /etc/sysconfig/jenkins
JENKINS_HOME="/data/jenkins_YumHome" # ---指定jenkins的HOME
JENKINS_USER="root" # 修改用户
JENKINS_PORT="18182" #更改监听端口
02.给jdk创建软连接,否则jenkins启动报错
ln -s /usr/local/src/jdk1.8.0_251/bin/java /usr/bin/java
03.重启jenkins
systemctl restart jenkins
5.页面配置
01访问jenkins地址 http://ip:18182 #云环境放开端口
6:Jenkins安装完毕,可根据自己环境安装相关工具(以.net环境为例)
#安装相关编译工具和dotnet:
rpm -Uvh https://packages.microsoft.com/config/rhel/7/packages-microsoft-prod.rpm
yum install dotnet-sdk-2.2 net-tools vim lrzsz unzip wget git -y
#node安装:下载安装包
wget https://npm.taobao.org/mirrors/node/v10.14.1/node-v10.14.1-linux-x64.tar.gz
#安装依赖环境:
yum install gcc gcc-c++ -y
#更换淘宝源下载npm安装包:
wget https://npm.taobao.org/mirrors/node/v10.14.1/node-v10.14.1-linux-x64.tar.gz
tar -zxvf node-v10.14.1-linux-x64.tar.gz -C /usr/local/
cd /usr/local/
mv node-v10.14.1-linux-x64 node
vim /etc/profile
export NODE_HOME=/usr/local/node
export PATH=$NODE_HOME/bin:$PATH
source /etc/profile