Ubuntu22.04 全程root用户
安装
apt-get install -y openjdk-11-jdk
wget -q -O - https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add -
echo deb http://pkg.jenkins.io/debian-stable binary/ | sudo tee /etc/apt/sources.list.d/jenkins.list
apt-get -y update
# 如果上面更新报错
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 上面给的公钥
apt-get install -y jenkins
启动
systemctl start jenkins
systemctl status jenkins
# 注意防火墙
ufw allow 8080
ufw status
配置
# 修改端口号
vim /etc/init.d/jenkins
vim /etc/defaut/jenkins
vim /lib/systemd/system/jenkins.service
# 重启
systemctl daemon-reload
systemctl restart jenkins
systemctl status jenkins