ubuntu 安装 Jenkins

本贴最后更新于 1135 天前,其中的信息可能已经物是人非

jenkins.jpg

1. 安装 java JDK 环境

  1. 更新软件包列表
sudo apt-get update
  1. 安装 openjdk-8-jdk
sudo apt-get install openjdk-8-jdk
  1. 查看 java 版本,看看是否安装成功
java -version

2. 安装 jenkins

  1. 将存储库密钥添加到系统
wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -
  1. 将 Debian 包存储库地址附加到服务器的 sources.list
sudo sh -c 'echo deb https://pkg.jenkins.io/debian-stable binary/  > /etc/apt/sources.list.d/jenkins.list'
  1. apt-get update
sudo apt-get update
  1. 安装 Jenkins
sudo apt-get install jenkins

3. 配置并启动 Jenkins

  1. 查看端口是否占用
lsof -i:8080
  1. 启动 Jenkins
systemctl start jenkins
  1. 稍等一会查看状态
systemctl status jenkins

4. 部署

  1. 安装 nginx
apt-get install nginx
  1. 增加配置文件
upstream Jenkins_Server {
    server 127.0.0.1:8080 max_fails=1  fail_timeout=30s;
}

server {
    listen     80;
    server_name  120.131.9.23;
    access_log /var/log/nginx/Jenkins_Server.log;
    error_log /var/log/nginx/Jenkins_Server_error.log;
    # gzip config
    gzip on;
    gzip_min_length 1k;
    gzip_comp_level 9;
    gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
    gzip_vary on;
    gzip_disable "MSIE [1-6]\.";
    client_max_body_size    512m;

    location / {
        proxy_pass http://Jenkins_Server;
        proxy_pass_header Server;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Scheme $scheme;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        proxy_read_timeout 600;
    }
}
  1. 重启 Nginx
systemctl restart nginx
  1. 访问并按照步骤配置
120.131.9.23
  • Jenkins

    Jenkins 是一套开源的持续集成工具。它提供了非常丰富的插件,让构建、部署、自动化集成项目变得简单易用。

    51 引用 • 37 回帖
  • Ubuntu

    Ubuntu(友帮拓、优般图、乌班图)是一个以桌面应用为主的 Linux 操作系统,其名称来自非洲南部祖鲁语或豪萨语的“ubuntu”一词,意思是“人性”、“我的存在是因为大家的存在”,是非洲传统的一种价值观,类似华人社会的“仁爱”思想。Ubuntu 的目标在于为一般用户提供一个最新的、同时又相当稳定的主要由自由软件构建而成的操作系统。

    123 引用 • 168 回帖

相关帖子

欢迎来到这里!

我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。

注册 关于
请输入回帖内容 ...