Jenkinsインストール

Javaインストール

jenkinsの起動スクリプト用に/usr/bin/javaシンボリックリンクを作っておく。
(jdkは/usr/local/srcにダウンロード済の前提)

cd /usr/local/src
tar zxvf jdk-7u21-linux-x64.tar.gz
mv -i jdk1.7.0_21 /usr/local/.
ln -s /usr/local/jdk1.7.0_21 /usr/local/java
ln -s /usr/local/java/bin/java /usr/bin/java

Jenkinsインストール

cd
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 jenkins
/etc/init.d/jenkins start

Nginx設定

自己署名証明書作成:

openssl genrsa -des3 -out server.key 1024
openssl rsa -in server.key -out server.key
openssl req -new -x509 -out server.crt -key server.key -days 365

Jenkins用vhosts作成:

mkdir -p /usr/local/nginx/vhosts/jenkins.xxx.com/{logs,ssl.crt,ssl.key}
mv -i server.crt /usr/local/nginx/vhosts/jenkins.xxx.com/ssl.crt/.
mv -i server.key /usr/local/nginx/vhosts/jenkins.xxx.com/ssl.key/.
vi /usr/local/nginx/conf/conf.d/jenkins.xxx.com.conf

jenkins.xxx.com.conf:

server {
  listen 443 ssl;
  server_name jenkins.xxx.com;

  access_log /usr/local/nginx/vhosts/jenkins.xxx.com/logs/ssl_access.log ltsv;
  error_log /usr/local/nginx/vhosts/jenkins.xxx.com/logs/ssl_error.log info;

  ssl on;
  ssl_certificate /usr/local/nginx/vhosts/jenkins.xxx.com/ssl.crt/server.crt;
  ssl_certificate_key /usr/local/nginx/vhosts/jenkins.xxx.com/ssl.key/server.key;

  ssl_session_timeout 5m;

  ssl_protocols SSLv2 SSLv3 TLSv1;
  ssl_ciphers HIGH:!aNULL:!MD5;
  ssl_prefer_server_ciphers on;

  location / {
    proxy_pass http://localhost:8080;
  }
}

Nginx再起動:

/usr/local/nginx/sbin/nginx -t
/usr/local/nginx/sbin/nginx -s stop
/usr/local/nginx/sbin/nginx