在CentOS上配置Jenkins是一个相对直接的过程,但需要确保每个步骤都正确执行。以下是一个详细的步骤解析:
/data/jenkins
目录。vim /etc/profile
添加以下配置到文件末尾:export JAVA_HOME=/path/to/jdk
export PATH=${JAVA_HOME}/bin:${PATH}
export CLASSPATH=${JAVA_HOME}/lib:${CLASSPATH}
执行命令让环境变量生效:source /etc/profile
检查JDK版本:java -version
sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins.io/redhat-stable/jenkins.repo
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
sudo yum install jenkins
sudo systemctl start jenkins
sudo systemctl enable jenkins
wget https://git-scm.com/download/tar.gz
tar -xzf git-*.tar.gz
cd git-*
./configure
make && make install
vim /etc/profile
添加以下配置:export GIT_HOME=/path/to/git
export PATH=${GIT_HOME}/bin:${PATH}
执行命令让环境变量生效:source /etc/profile
git config --global credential.helper store
创建凭证并写入:cat > ~/.git-credentials <<EOF
https://username:password@github.com
EOF
wget https://nodejs.org/dist/v12.16.1/node-v12.16.1-linux-x64.tar.xz
tar -xvf node-v12.16.1-linux-x64.tar.xz
vim /etc/profile
添加以下配置:export NODE_HOME=/path/to/node
export PATH=${NODE_HOME}/bin:${PATH}
执行命令让环境变量生效:source /etc/profile
sudo firewall-cmd --permanent --add-port=8080/tcp
sudo firewall-cmd --reload
通过以上步骤,你应该能够在CentOS上成功安装和配置Jenkins。如果在配置过程中遇到问题,可以参考Jenkins的官方文档或相关的技术论坛。