首页 > 其他分享 >Jenkins 系列1 --- 安装与配置

Jenkins 系列1 --- 安装与配置

时间:2023-06-30 23:11:06浏览次数:42  
标签:sudo --- ssl EECDH proxy https jenkins Jenkins 安装

一、概要

1. 环境

(1) Rocky Linux 9.1

2. 硬件要求

(1) 底线要求

内存:256 MB

硬盘:1 GB

(2) 推荐要求

内存:4 GB

硬盘:50 GB

二、安装

1. 依赖

(1) OpenJDK

sudo dnf install java-11-openjdk -y

(2) 仓库

sudo wget -O /etc/yum.repos.d/jenkins.repo  https://pkg.jenkins.io/redhat-stable/jenkins.repo
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io-2023.key
sudo yum upgrade -y

2. 安装

sudo dnf install jenkins -y

3. 安装后

(1) 服务

sudo systemctl daemon-reload
sudo systemctl enable jenkins
sudo systemctl start jenkins
systemctl status jenkins

(2) 防火墙

如果需要立即通过端口号访问Jenkins,则可以通过以下配置实现:

sudo firewall-cmd --permanent --add-port=8080/tcp
sudo firewall-cmd --reload

4. HTTPS

(1) 生成证书和密钥

https://www.cnblogs.com/eagle6688/p/16974768.html

(2) 创建日志目录

sudo mkdir -p /var/log/nginx/jenkins

(3) Nginx配置

a. 创建配置文件

sudo vi /etc/nginx/conf.d/jenkins.conf

b. 初始化

upstream jenkins {
    keepalive 32; # keepalive connections
    server 127.0.0.1:8080; # jenkins ip and port
}

# Required for Jenkins websocket agents
map $http_upgrade $connection_upgrade {
    default upgrade;
    '' close;
}

server {
    listen 80; # Listen on port 80 for IPv4 requests
    server_name jenkins.example.com;
    rewrite ^(.*)$ https://${server_name}$1 permanent;
}

server {
    listen 443 ssl;
    listen [::]:443 ssl;
    server_name jenkins.example.com;

    root /var/run/jenkins/war/;
    access_log /var/log/nginx/jenkins.access.log;
    error_log /var/log/nginx/jenkins.error.log;

    ssl_certificate /etc/ssl/certs/jenkins.example.com.crt.pem;
    ssl_certificate_key /etc/ssl/private/jenkins.example.com.key.pem;
    ssl_session_timeout 1d;
    ssl_session_tickets on;
    ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
    ssl_ciphers 'TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-128-GCM-SHA256:TLS13-AES-128-CCM-8-SHA256:TLS13-AES-128-CCM-SHA256:EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+ECDSA+AES128:EECDH+aRSA+AES128:RSA+AES128:EECDH+ECDSA+AES256:EECDH+aRSA+AES256:RSA+AES256:EECDH+ECDSA+3DES:EECDH+aRSA+3DES:RSA+3DES:!MD5';
    ssl_prefer_server_ciphers on;

    # pass through headers from Jenkins that Nginx considers invalid
    ignore_invalid_headers off;

    location ~ "^/static/[0-9a-fA-F]{8}\/(.*)$" {
        rewrite "^/static/[0-9a-fA-F]{8}\/(.*)" /$1 last;
    }

    location /userContent {
        root /var/lib/jenkins/;

        if (!-f $request_filename) {
            rewrite (.*) /$1 last;
            break;
        }

        sendfile on;
    }

    location / {
        sendfile off;
        proxy_pass http://jenkins;
        proxy_redirect default;
        proxy_http_version 1.1;

        # Required for Jenkins websocket agents
        proxy_set_header   Connection        $connection_upgrade;
        proxy_set_header   Upgrade           $http_upgrade;

        proxy_set_header   Host              $host;
        proxy_set_header   X-Real-IP         $remote_addr;
        proxy_set_header   X-Forwarded-For   $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Proto $scheme;
        proxy_max_temp_file_size 0;

        #this is the maximum upload size
        client_max_body_size       10m;
        client_body_buffer_size    128k;

        proxy_connect_timeout      90;
        proxy_send_timeout         90;
        proxy_read_timeout         90;
        proxy_buffering            off;
        proxy_request_buffering    off; # Required for HTTP CLI commands
        proxy_set_header Connection ""; # Clear for keepalive
    }
}

Placeholder

四、参考

1. 官方

https://www.jenkins.io/doc/book/installing/linux/

https://www.jenkins.io/doc/book/installing/war-file/

https://www.jenkins.io/doc/book/managing/system-properties/

https://www.jenkins.io/doc/book/system-administration/reverse-proxy-configuration-nginx/

标签:sudo,---,ssl,EECDH,proxy,https,jenkins,Jenkins,安装
From: https://www.cnblogs.com/eagle6688/p/17502872.html

相关文章

  • centos7安装配置rocketmq
    1、下载地址::https://rocketmq.apache.org/download/ 2、报错:安装rockerMQ报错ERROR:PleasesettheJAVA_HOMEvariableinyourenvironment,Weneedjava(x64)  修改rocketmy的配置文件进入到解压后rocketMQ的bin目录,修改以下三个文件runbroker.sh、runserver.sh、tools.sh修......
  • Redis Desktop Manager(Redis可视化工具)安装及使用教程
    RedisDesktopManager(Redis可视化工具)安装及使用教程2、一、工具/材料官网下载:https://redisdesktop.com/download百度网盘:https://pan.baidu.com/s/15xVRpCT8mkP2uT8PoBHT3g提取码:v727二、方法/步骤1.说明RedisDesktopManager是一款简单快速、跨平台的Redis桌面管理工具,也被......
  • Linux编译过程以及生成中间文件--链接
    1、编译系统C源文件到可执行文件共经历了4个过程。在使用GCC编译程序时,编译过程可以被细分为四个阶段,包括预处理、编译、汇编、链接 1、预处理在预处理阶段,编译器主要作加载头文件、宏替换、条件编译的作用。一般处理带“#”的语句。 我们可以通过gcc的-E选项进行查看......
  • centos7安装nginx
    1.tar-zxvfnginx-1.6.2.tar.gz2.yuminstall-ygccpcre-develzlib-developensslopenssl-devel 3. ./configure4.删除-Werror,这个文件在/nginx-1.6.2/objs/Makefile 5. 删除下面这句话  文件在/src/os/unix/ngx_user.c ......
  • 数据结构和算法-2023.06.30
    动态链表的生成和初衷......
  • centos7安装java
    1.tar-zxvfjdk-8u11-linux-x64.tar.gz 2.编辑环境变量vim/etc/profile 3.source/etc/profile4.java-version ......
  • STD-study-暑假-大一下-PTA-day1
    L1-001#include<iostream>usingnamespacestd;intmain(){cout<<"HelloWorld!"<<endl;return0;}毫无难度L1-002打印沙漏#include<stdio.h>#include<math.h>intmain(){intn;//符号的个数charc;//符号......
  • Debian 12 (bookworm) 安装方法及其国内软件源
    摘要:Debian12(bookworm)已经于2023年6月份正式发布。以下为原来信息:Debian12(bookworm)预计于2023年中期发布,但是目前(2023年4月)已经处于硬冻结阶段。原计划是在2023年中发布正式版本,但“Bookwo...Debian12(bookworm)已经于2023年6月份正式发布。以下为原来信息:De......
  • 关于Linux内核-live-patching-更新内核补丁模块
    由于内核补丁模块是通过RPM软件包交付和应用,更新累积内核补丁模块就如同更新任何其他RPM软件包一样。先决条件:系统已订阅实时补丁流,如将当前安装的内核订阅到实时补丁流中所述。流程如下:更新至当前内核的新累计版本:#yumupdate"kpatch-patch=$(uname-r)"以上命令......
  • Kotlin 集合 - 创建列表、集合和映射
    集合是保存多个相同或不同类型元素的容器。它们提供了各种方法和操作来有效地操纵和访问存储的数据。了解如何创建和使用集合对于任何Kotlin开发人员都至关重要,因为这使他们能够有效地组织和管理数据。列表列表是Kotlin中允许重复元素的有序集合。它们提供了根据元素在列表中的......