jenkins安装

安装到 CentOS7

安装JRE

下载JRE安装包(Linux x64 RPM)
https://www.java.com/en/download/manual.jsp

安装JRE

rpm -ivh jre-8u211-linux-x64.rpm

安装Jenkins

下载Jenkins RPM安装包 https://pkg.jenkins.io/redhat-stable/

wget https://pkg.jenkins.io/redhat-stable/jenkins-2.176.1-1.1.noarch.rpm

安装Jenkins

rpm -ivh jenkins-2.176.1-1.1.noarch.rpm

启动jenkins

systemctl start jenkins

配置开机自动启动

systemctl enable jenkins

更新Jenkins

下载最新的Jenkins war包,直接覆盖原来的war包即可。

默认安装的war包路径: /usr/lib/jenkins/jenkins.war

配置nginx反向代理

安装nginx步骤略!

添加nginx vhost,然后重启nginx

server {
    listen  80;
    server_name yourdomain;

    access_log  /data/logs/nginx/yourdomain.access.log  main;
    error_log   /data/logs/nginx/yourdomain.error.log;

    location / {
        proxy_pass      http://127.0.0.1:8080;
        proxy_redirect  http://127.0.0.1:8080 http://$host;
        sendfile off;

        proxy_set_header   Host             $host:$server_port;
        proxy_set_header   X-Real-IP        $remote_addr;
        proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
        proxy_max_temp_file_size 0;
        proxy_buffers 256 8k;
        proxy_connect_timeout 30;
        proxy_read_timeout 600;
    }
}

设置Jenkins

进入Nginx里设置的域名,直接进入Jenkins安装引导,完成初始化。

参考资料
安装Jenkins
RedHat Linux RPM packages for Jenkins
jenkins+gitlab项目回滚
jenkins+svn自动发布和回滚