LoginSignup
68
69

More than 5 years have passed since last update.

UbuntuにJenkinsをインストールする

Last updated at Posted at 2014-06-21

環境: Ubuntu Server 14.04LTS

JDKのインストール

OracleJDK7をインストールします。

$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update
$ sudo apt-get install oracle-java7-installer

Jenkinsのインストール

Jenkinsをインストールします。

wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt-get update
sudo apt-get install jenkins

Nginxのインストールとリバースプロキシの設定

Jenkinsデフォルトでは8080番ポートで稼働するので、
Nginxを使ってホストから80番ポートからアクセスできるようにします。

Nginxのインストール

$ sudo apt-get install nginx

リバースプロキシの設定

Nginxの設定ファイルを以下のようにします。

$ cat /etc/nginx/sites-available/default
server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    root /usr/share/nginx/html;
    index index.html index.htm;

    # Make site accessible from http://localhost/
    server_name localhost;

    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect off;

        if (!-f $request_filename) {
            proxy_pass http://localhost:8080;
            break;
        }
    }
}

Nginxの再起動

$ sudo service nginx restart

Jenkins起動の確認

ブラウザでhttp://localhost/にアクセスして、Jenkinsが起動していることを確認します。

jenkins.png

68
69
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
68
69