首页 > 其他分享 >部署 jenkins 2.414.2

部署 jenkins 2.414.2

时间:2023-09-22 18:23:19浏览次数:39  
标签:set jdk 部署 header proxy https jenkins 2.414

安装 jdk-17

下载 jdk-17

# wget https://download.oracle.com/java/17/latest/jdk-17_linux-x64_bin.tar.gz

解压 jdk

# tar xf jdk-17_linux-x64_bin.tar.gz -C /usr/local

创建软连接

# ln -sv /usr/local/jdk-17.0.8/ /usr/local/jdk

验证 jdk

# /usr/local/jdk/bin/java -version
java version "17.0.8" 2023-07-18 LTS
Java(TM) SE Runtime Environment (build 17.0.8+9-LTS-211)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.8+9-LTS-211, mixed mode, sharing)

部署 jenkins

# 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
# yum -y install jenkins

配置 jenkins

# egrep -v "^$|^#" /lib/systemd/system/jenkins.service 
[Unit]
Description=Jenkins Continuous Integration Server
Requires=network.target
After=network.target
[Service]
Type=notify
NotifyAccess=main
ExecStart=/usr/bin/jenkins
Restart=on-failure
SuccessExitStatus=143
User=root
Group=jenkins
Environment="JENKINS_HOME=/data/apps/jenkins"
WorkingDirectory=/var/lib/jenkins
Environment="JENKINS_WEBROOT=%C/jenkins/war"
Environment="JAVA_HOME=/usr/local/jdk"
Environment="JAVA_OPTS=-Djava.awt.headless=true"
Environment="JENKINS_PORT=8080"
[Install]
WantedBy=multi-user.target

配置 jenkins 代理

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;  # replace 'jenkins.example.com' with your server domain name

  # this is the jenkins web root directory
  # (mentioned in the output of "systemctl cat jenkins")
  root            /var/run/jenkins/war/;

  access_log      /var/log/nginx/jenkins.access.log;
  error_log       /var/log/nginx/jenkins.error.log;

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

  location ~ "^/static/[0-9a-fA-F]{8}\/(.*)$" {
    # rewrite all static files into requests to the root
    # E.g /static/12345678/css/something.css will become /css/something.css
    rewrite "^/static/[0-9a-fA-F]{8}\/(.*)" /$1 last;
  }

  location /userContent {
    # have nginx handle all the static requests to userContent folder
    # note : This is the $JENKINS_HOME dir
    root /var/lib/jenkins/;
    if (!-f $request_filename){
      # this file does not exist, might be a directory or a /**view** url
      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              $http_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_request_buffering    off; # Required for HTTP CLI commands
      proxy_set_header Connection ""; # Clear for keepalive
  }

}

jenkins 环境变量

JENKINS_UC_DOWNLOAD=https://mirrors.tuna.tsinghua.edu.cn/jenkins/
JENKINS_UC_EXPERIMENTAL=https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/experimental/
JENKINS_UC=https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json

参考文档

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

标签:set,jdk,部署,header,proxy,https,jenkins,2.414
From: https://www.cnblogs.com/wangguishe/p/17723092.html

相关文章

  • k8s部署redis单节点
    创建pvc.yamlkind:PersistentVolumeClaimapiVersion:v1metadata:name:nfspvc1namespace:sqqqqspec:accessModes:-ReadWriteOnceresources:requests:storage:5GistorageClassName:nfs-storage创建redis-configmap.yamlkind:Confi......
  • Flink的部署模式:Local模式、Standalone模式、Flink On Yarn模式
    Flink部署、执行模式Flink的部署模式Local本地模式、Standalone模式和FlinkonYARN模式是Flink的三种常见部署模式。1.Local本地模式:在本地模式下,Flink以单机模式运行,无需启动分布式资源管理器。这种模式适用于本地开发和测试,用于验证Flink代码的正确性和性能。2.Standalon......
  • Docker Swarm + Harbor + Portainer 打造高可用,高伸缩,集群自动化部署,更新。
    DockerSwarm是Docker官方自带的容器编排工具,Swarm,Compose,Machine合称Docker三剑客。DockerSwarm对于中小型应用来说,还是比较方便,灵活,当然K8S对于大型项目在各方面有着明显的优势。技术选型需要针对公司实际情况选择,架构往往是一步一步随着业务变化升级演变而来,本文主要讲解Docke......
  • docker部署java项目
    1、首先你需要提前准备好jar包或者war包,并想办法放入Linux环境(或虚拟机)中;2、java项目的部署需要用到Tomcat或者Jetty,docker可以直接拉取他俩的镜像,这里以Tomcat为例:#:后面需要加上war或者jar对应的Tomcat版本,最好加上,#否则默认最新的版本--latest,会出现版本不兼容的问题d......
  • ABP + Vue Docker 部署
    #!/bin/bashecho"Welcometodockerbuild"echo""echo""ABP_HOST="abp/host"ABP_NG="abp/ng"cd..echo"Buildingdockerimage$ABP_HOST..."#cd到aspnet-core目录,eg:cd/data/apb/#将aspnet-......
  • docker 部署mysql8.3.0
    以下内容全部来源于https://blog.csdn.net/Weirdo_zhu/article/details/126358872?spm=1001.2014.3001.5501一、拉取镜像dockerpullmysql:8.0.30二、创建挂载路径 //根目录选择自身实际最大磁盘路径一般为/home或者定义/datamkdir-p/data/mysql/datamkdir-p/data/m......
  • jenkins+测试平台+jacoco实现代码覆盖
    Jenkins配置 构架后执行shellif[${jacoco}=='true'];then cd/home/apps/xxxxx/xxxx sh./test_run.shelse echo"不生成jacoco报告"fi jenkins添加html插件 jacoco报告 shell脚本内容#!/bin/sh#定义要检查的主机和端口host="localhost"port=18098s......
  • docker-compose 部署 jenkins Blue Ocean插件
    DockerfileFROMjenkins/jenkins:2.414.2-lts-jdk17USERrootRUNapt-getupdate&&apt-getinstall-ylsb-releaseRUNcurl-fsSLo/usr/share/keyrings/docker-archive-keyring.asc\https://download.docker.com/linux/debian/gpgRUNecho"deb[a......
  • Jenkins问题记录:Windows Server Jenkins修改配置后重启系统,Jenkins被初始化,启动后需要
    现象:WindowsServerJenkins修改配置后重启系统,Jenkins被初始化,启动后需要重新安装插件,配置管理员密码,项目列表丢失原因:修改"C:\ProgramFiles\Jenkins\jenkins.xml"配置,可能是配置异常,系统重启后,Jenkins自动重置了解决:重新安装Jenkins,配置文件就重新初始化,再启动不需要再安......
  • 部署网站
    WindowsServer2012R2的InternetInformationServices(IIS)网站的模块化设计,可以减少被攻击面并减轻管理负担,让系统管理员更容易架设安全的具备高扩展的网站。 目录一、环境设置与安装IIS网站二、网站的基本设置三、建立新网站(未完待续) 一、环境设置与安装IIS网站1、申......