简介
在开发过程中,devops搭建,ci集成工具选择Jenkins是不二之选
安装
- 安装docker
- centos7
创建jenkins目录
mkdir -p /data/jenkins-data
chmod 777 -R /data/jenkins-data
运行docker
docker run -d -p 8080:8080 -p 50000:50000 --restart=always -v /data/jenkins-data:/var/jenkins_home -v /etc/localtime:/etc/localtime --name jenkins jenkins/jenkins:2.311
- 如果用做cicd,需要挂载docker必须以root用户运行
docker run -d -p 8080:8080 -p 50000:50000 --restart=always -v /data/jenkins-data:/var/jenkins_home -v /etc/localtime:/etc/localtime -v /bin/docker:/bin/docker -v /var/run/docker.sock:/var/run/docker.sock --user root --name jenkins jenkins/jenkins:2.311
错误信息
2021-06-18 12:18:20.986+0000 [id=43] SEVERE SEVERE hudson.PluginManager#doCheckUpdatesServer: Error checking update sites for 1 attempt(s). Last exception was: UnknownHostException: updates.jenkins.io
解决方法
1. 修改update源头
vim hudson.model.UpdateCenter.xml
将url修改为:https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json
# 如果没有vi/vim命令
插件下载管理
先进入 http://ip:8080/pluginManager/advanced 插件管理页,将https://updates.jenkins.io/update-center.json
修改为http://mirror.xmission.com/jenkins/updates/update-center.json
重启docker
service docker restart
忘记密码
jenkins@1ae312b472af:/$ find / -name "initialAdminPassword" find: ‘/etc/ssl/private’: Permission denied find: ‘/proc/tty/driver’: Permission denied find: ‘/proc/1/map_files’: Operation not permitted find: ‘/proc/7/map_files’: Operation not permitted find: ‘/proc/76/map_files’: Operation not permitted find: ‘/proc/88/map_files’: Operation not permitted find: ‘/root’: Permission denied find: ‘/var/cache/apt/archives/partial’: Permission denied find: ‘/var/cache/ldconfig’: Permission denied /var/jenkins_home/secrets/initialAdminPassword jenkins@1ae312b472af:/$ cat /var/jenkins_home/secrets/initialAdminPassword afasdfasdfasdf
nginx配置
[root@k8s-ops conf.d]# cat jenkin.host.com.conf server { listen 80; client_max_body_size 1000M; server_name jenkins.host.com; location / { proxy_pass http://127.0.0.1:8080; proxy_connect_timeout 180; proxy_send_timeout 180; proxy_read_timeout 180; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; access_log /var/log/nginx/jenkins_access.log; error_log /var/log/nginx/jenkins_error.log; } }
原创文章,作者:站长,如若转载,请注明出处:https://wsppx.cn/50/%e7%bd%91%e7%bb%9c%e5%bc%80%e5%8f%91/