jenkins 安装
Last updated on November 20, 2024 am
🧙 Questions
☄️Ideas
jenkins安装命令
- 需要有java环境
# 下载jenkins安装repo
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
sudo yum upgrade
# 安装最新版本
sudo yum install jenkins
# 指定版本
sudo yum install jenkins-2.235.3-1.1
# 安装java
sudo yum -y install java-1.8.0-openjdk-devel
# 切换阿里镜像 https://mirrors.aliyun.com/jenkins/redhat-stable/
sudo tee /etc/yum.repos.d/jenkins.repo <<-'EOF'
[jenkins]
name=Jenkins-stable
baseurl=https://mirrors.aliyun.com/jenkins/redhat-stable/
gpgcheck=1
EOF
jenkins启动命令
sudo systemctl restart jenkins
sudo systemctl start jenkins
sudo systemctl status jenkins
sudo systemctl stop jenkins
修改jenkins储存地址
vim /etc/sysconfig/jenkins
# 搜索 / JENKINS_HOME
修改端口号
vim /etc/sysconfig/jenkins
# 搜索 / JENKINS_PORT
修改java环境
vim /etc/sysconfig/jenkins
# 搜索 / JENKINS_JAVA_CMD="/usr/java/jdk1.8.0_191/bin/java"
修改jenkins运行角色
vim /etc/sysconfig/jenkins
# 搜索 / JENKINS_USER="ispong"
# 修改用户后可能导致 新用户没有权限访问日志/缓存等文件权限
sudo chown -R ispong:isxcode /data/jenkins
sudo chown -R ispong:isxcode /var/cache/jenkins
sudo chown -R ispong:isxcode /var/log/jenkins
查看默认密码
cat /var/lib/jenkins/secrets/initialAdminPassword
无法切换jenkins用户
解决方案
# su jenkins 无法切换用户
vim /etc/passwd
# 搜索/jenkins
# 修改内容 /bin/false -> /bin/bash
jenkins 安装
https://ispong.isxcode.com/kubernetes/jenkins/jenkins 安装/