在Debian上部署Jenkins和应用可以分为以下几个步骤:
环境准备:
sudo apt update && sudo apt install -y openjdk-11-jdk
sudo wget -O /usr/share/keyrings/jenkins-keyring.asc https://pkg.jenkins.io/debian-stable/jenkins.io.key
echo "deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] https://pkg.jenkins.io/debian-stable binary/" | sudo tee /etc/apt/sources.list.d/jenkins.list
sudo apt update && sudo apt install -y jenkins
sudo systemctl enable jenkins
sudo systemctl start jenkins
sudo systemctl status jenkins
sudo ufw allow 8080/tcp
sudo ufw allow 50000/tcp
sudo ufw reload
初始化Jenkins:
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json
配置流水线:
ssh-keygen -t rsa -b 4096 -f ~/.ssh/jenkins_github
cat ~/.ssh/jenkins_github.pub
自动化部署应用:
通过以上步骤,你可以在Debian上成功搭建Jenkins并实现应用的自动化部署。
辰迅云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读: Debian Swapper在服务器环境中的应用