jenkins(二):Jenkins的安装

 

Jenkins的安装

安装依赖,如果本机已有java环境可跳过

yum install java-1.8.0-openjdk java-1.8.0-openjdk-devel -y

java –version

#
或者采用下载安装CentOS 7 安装 JAVA环境(JDK 1.8)
 

三种安装方式

war包(常用方式,个人比较喜欢)

需要tomcat环境。
下载地址:http://updates.jenkins-ci.org/download/war/

wget http://mirrors.jenkins-ci.org/war-stable/latest/jenkins.war

#建议采用稳定版本的上一个版本

nginx反向代理配置,默认访问方式为http://IP:端口/jenkins 当然你自己能改

server {

        listen 80;

        server_name   jenkins.corp.XXX.com;

        location /jenkins/ {

                proxy_next_upstream http_502 http_504 error timeout invalid_header;

                proxy_set_header Host $host;

                proxy_set_header X-Forwarded-For $remote_addr;

                add_header Cache-Control no-store;

                proxy_pass  http://127.0.0.1:8090;

                log_by_lua_file /home/admin/webserver/conf/conf.d/record.lua;

                }

        location / {

                rewrite  ^/(.*)$    /jenkins/$1 ;

        }

}

 

yum安装的方式(不推荐)

wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins.io/redhat-stable/jenkins.repo

rpm --import http://pkg.jenkins.io/redhat/jenkins.io.key or \

rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key

#安装Jenkins 

yum –y install jenkins

service jenkins start

 

rpm的安装方式(直接可以service和systemctl管理,比较方便)

#清华大学开源镜像地址

#https://mirrors.tuna.tsinghua.edu.cn/jenkins/redhat-stable/

wget https://mirrors.tuna.tsinghua.edu.cn/jenkins/redhat-stable/jenkins-2.164.3-1.1.noarch.rpm 

sudo rpm -ivh jenkins-2.164.3-1.1.noarch.rpm

sudo service jenkins start

sudo service jenkins status

sudo cat /var/lib/jenkins/secrets/initialAdminPassword  #初试密码

 

访问方式为http://IP:端口/  这个和war包安装有些不一样

 

 

server {

        listen 80;

        server_name   testjenkins.corp.XXX.com;

        location / {

                proxy_next_upstream http_502 http_504 error timeout invalid_header;

                proxy_set_header Host $host;

                proxy_set_header X-Forwarded-For $remote_addr;

                add_header Cache-Control no-store;

                proxy_pass  http://10.6.76.28:10080;

                log_by_lua_file /home/admin/webserver/conf/conf.d/record.lua;

                }

}

 

 

 

离线状态处理

修改/var/lib/jenkins/hudson.model.UpdateCenter.xml
该文件为jenkins下载插件的源地址,改地址默认jenkins默认为:https://updates.jenkins.io/update-center.json,就是因为https的问题,此处我们将其改为http即可,如下图所示

 

重启jenkins服务即可,如下图所示
systemctl restart jenkins

 

 

 

 

Jenkins简体中文

之前使用Jenkins版本设置成中文都是locale plugin插件,最近更新Jenkins版本,发现不行了,找了找资料发现,大家水平都太菜,jenkins中文社区就专门做了个简体中文的插件,安装重启即可。

https://jenkins.io/changelog-stable/%EF%BC%89%E6%8F%8F%E8%BF%B0%E4%B8%AD%E5%8F%AF%E4%BB%A5%E7%9C%8B%E5%88%B0%E5%9C%A8%E5%8D%87%E7%BA%A7%E7%89%88%E6%9C%AC%E4%B8%AD%E6%96%B0%E5%8A%A0%E5%85%A5%E4%BA%86%E4%B8%80%E4%B8%AA%E6%9C%AC%E5%9C%B0%E5%8C%96%EF%BC%9A%E4%B8%AD%E6%96%87%EF%BC%88%E7%AE%80%E4%BD%93%EF%BC%89%E6%8F%92%E4%BB%B6

 

中文(简体)插件 localization-zh-cn-plugin

 

 

 

posted on 2019-06-25 16:56  光阴8023  阅读(870)  评论(0编辑  收藏  举报