LoginSignup
15
16

More than 5 years have passed since last update.

5 分で EC2 インスタンスに Jenkins で CI 環境をつくる

Last updated at Posted at 2014-04-16

5 分で EC2 インスタンスに Jenkins サーバを立てる

手動ですが Jenkins サーバを立てたのでそのメモです.
5 分というのはそれくらいやっつけですという気持ちです(・・;)

一旦 nginx を前に置いて jenkis にリバースプロキシさせています.

インスタンス生成

EC2 の画面から m1.small インスタンスを生成します.
セキュリティグループには SSH(port:22), HTTP(port:80) を追加しておきます.

SSH でログイン

~/.ssh/config に以下を追記します.

Host jenkins
    Hostname ec2-xxx.ap-northeast-1.compute.amazonaws.com
    IdentityFile ~/.ssh/my-key.pem
    User ec2-user
    Port 22

ssh jenkins でサーバに入ります.

jenkins をインストールし起動する

# wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo
# rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key
# yum install -y jenkins
# chkconfig jenkins on
# service jenkins start

nginx を立てて jenkins にリバースプロキシする

# yum install -y nginx
# vi /etc/nginx/nginx.conf

nginx.conf に以下を追記します.

location / {
    proxy_pass http://127.0.0.1:8080;
}
# chkconfig nginx on
# service nginx start

ブラウザで http://ec2-xxx.ap-northeast-1.compute.amazonaws.com を開くと jenkins おじさまに会えました〜!
(HTTP 通信なのでセキュリティには注意ですね.)
グローバルセキュリティ設定画面からユーザ登録をして一段落.
ひとまず CI 環境ができました.

15
16
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
15
16