企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
#### 安装 ```shell # 部署jdk yum install java sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat/jenkins.repo sudo rpm --import https://pkg.jenkins.io/redhat/jenkins.io.key yum install jenkins -y ``` Jenkins系统初始化 ``` # 如果有haproxy作为带来,需要增加 reqadd X-Forwarded-Proto:\ https #创建普通用户 useradd deploy #修改jenkins启动用户及端口 /etc/sysconfig/jenkins # 修改目录权限 chown -R deploy.deploy /var/cache/jenkins chown -R deploy.deploy /var/lib/jenkins chown -R deploy.deploy /var/log/jenkins # 查看并修改密码 cat /var/lib/jenkins/secrets/initialAdminPassword ``` #### 插件加速 方案一 配置文件修改 ``` 1. jenkins插件->可用插件->获取一次更新 2. jenkins插件->高级->修改更新地址 https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json 3. 替换指定文件内容 sed -i 's/http:\/\/www.google.com/https:\/\/www.baidu.com/g' /var/lib/jenkins/updates/default.json sed -i 's/https:\/\/updates.jenkins.io\/download/https:\/\/mirrors.tuna.tsinghua.edu.cn\/jenkins/g' /var/lib/jenkins/updates/default.json 4. 重启服务 5. 下载插件 - chinese - git - maven - .... 6. 文件重启会更新,写道任务计划比较好 ``` 方案二 负载均衡-新版本不适用,update地址变为https,非常感谢[vasks](https://my.oschina.net/VASKS/blog/3106314 "vasks ")的分享 ``` 进入jenkins系统管理 进入插件管理(Manage Plugins)——高级——升级站点 https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json 服务器host设置 127.0.0.1 mirrors.jenkins-ci.org 本机安装Nginx server { listen 80; server_name mirrors.jenkins-ci.org; location / { proxy_redirect off; proxy_pass https://mirrors.tuna.tsinghua.edu.cn/jenkins/; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Accept-Encoding ""; #proxy_set_header User-Agent "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.49 Safari/537.36"; proxy_set_header Accept-Language "zh-CN"; } index index.html index.htm index.php; #error_page 404 /404.html; location ~ /\. { deny all; } } ```