jenkins部署–快速上手

ubuntu更换阿里云apt源

cp /etc/apt/sources.list /etc/apt/sourses.list.backup # 备份/etc/apt/sources.list文件
vim /etc/apt/sources.list # 注释掉原有的,添加如下内容

#阿里云源
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

sudo apt update
sudo apt upgrade

(1)基于Docker搭建Jenkins、Jenkins集成群晖LDAP Server用户

注意事项

  sudo chown -R 1000:1000 /data/docker/container/jenkins/  
  

安装Docker

sudo apt-get update  sudo apt-get install -y docker.io  
sudo systemctl status docker  sudo systemctl start docker  sudo systemctl enable docker  

拉取Jenkins镜像

sudo docker search jenkins  sudo docker pull jenkins/jenkins  sudo docker images  

创建Jenkins目录相关文件夹

sudo mkdir -p /data/docker/container/jenkins  

启动jenkins的Docker容器

sudo docker run -d --name jenkins -p 8081:8080 -v /data/docker/container/jenkins:/var/jenkins_home jenkins/jenkins sudo docker ps -a  

查看解锁Jenkins的管理员密码

cat /data/docker/container/jenkins/secrets/initialAdminPassword  

集成群晖LDAP Server用户

cd /data/docker/container/jenkins/  cp config.xml config.xml.bak  vim config.xml  <securityRealm class="hudson.security.HudsonPrivateSecurityRealm"> <disableSignup>false</disableSignup>  <enableCaptcha>false</enableCaptcha> </securityRealm> sudo docker restart 45556ff94384  
出现这个情况时,是因为Jenkins的默认更新镜像用的国外的镜像,把更新镜像改成国内的即可。 首先打开Jenkins的安装目录, 比如我是安装在 D:\Program Files (x86)\Jenkins 这个目录,打开这个目录,然后打开hudson.model.UpdateCenter.xml 这个配置文件, 将<url>https://updates.jenkins.io/update-center.json</url> 修改成<url>http://mirror.xmission.com/jenkins/updates/update-center.json</url>

在这里插入图片描述
jenkins部署–快速上手插图1

(2)Jenkins版本升级

方法一:

访问链接查看最新号:http://mirrors.jenkins.io/war/ docker pull jenkins/jenkins:2.284  docker images  docker stop jenkins  docker run -d --name jenkins-new -p 8081:8080 -v /data/docker/container/jenkins:/var/jenkins_home jenkins/jenkins:2.284  

方法二:

docker exec -it jenkins bash  cd /var/jenkins_home wget http://mirrors.jenkins.io/war/latest/jenkins.war  cd /usr/share/jenkins mv jenkins.war jenkins.war-bak  cp /var/jenkins_home/jenkins.war .  exit docker restart jenkins  
注意事项 mv jenkins.war jenkins.war-bak 若提示Permission denied 需将宿主机所对应的映射目录权限改成775 

(3)Jenkins备份设置

系统管理->插件管理->可选插件->search ThinBackup  系统管理->ThinBackup->Setting  

以实战来学习java,希望每个从我这边都有收获,然后点上一个小小赞,关注,共同进步,谢谢

原文链接:https://blog.csdn.net/m0_46435451/article/details/121038063?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522171828022116800180643007%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fblog.%2522%257D&request_id=171828022116800180643007&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~blog~first_rank_ecpm_v1~times_rank-6-121038063-null-null.nonecase&utm_term=nas+%E9%93%81%E5%A8%81%E9%A9%AC

© 版权声明
THE END
喜欢就支持一下吧
点赞12 分享