Tech Tips

  1. Uncategorized
  2. 933 view

[Ubuntu][Jenkins]Install and Setting

jenkins nginx
I thought I want to use Jenkins not only work place but also private environment, I tried to install jenkins.

Install Jenkins

There are articles which shows typing command below at first.
sudo wget -q -0 - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
gpg: 有効なOpenPGPデータが見つかりません。
But I can’t due to error happening. Then, I tried to get key from kerserver.ubuntu.com.
$ sudo vim /etc/apt/sources.list
deb http://pkg.jenkins-ci.org/debian binary/
$ sudo apt-get update
W: GPG error: http://ppa.launchpad.net jaunty Release: 公開鍵を利用できないため、以下の署名は検証できませんでした:
NO_PUBKEY 1A2B3C4D5E6F7G8H
Next, getting key using above PUBKEY.
$ gpg --keyserver keyserver.ubuntu.com --recv-keys 1A2B3C4D5E6F7G8H
gpg: 鍵12345678をhkpからサーバーwwwkeys.eu.pgp.netに要求
gpg: 鍵12345678: 公開鍵“Launchpad PPA for TualatriX”を読み込みました
gpg: 処理数の合計: 1
gpg:               読込み: 1  (RSA: 1)
$ gpg --export --armor 1A2B3C4D5E6F7G8H | sudo apt-key add -
OK
It works!. Next is finally install Jenkins.
$ sudo apt-get update
$ sudo apt-get install jenkins
Done. Just set port number for Jenkins.
$ sudo vim /etc/default/jenkins
# port for HTTP connector (default 8080; disable with -1)
HTTP_PORT=9090
$ sudo service jenkins restart
Restart Jenkins.
localhost:9090 works!

Setting Apache

:9090 is not cool. And I always use reverse proxy to service-in for new page.
After setting reverse proxy, we can access Jenkins with example/jenkins. Rewrite Jenkins config file.
$ sudo vim /etc/default/jenkins
JENKINS_ARGS="--webroot=/var/run/jenkins/war --httpPort=$HTTP_PORT --ajp13Port=$AJP_PORT --prefix=/jenkins"
$ sudo service jenkins restart

Add /jenkins to prefix. If mod_proxy doesn’t work, make it available using command below.
$ sudo a2enmod proxy
$ sudo a2enmod proxy_http
$ sudo a2enmod proxy_connect
Add new site setting with Jenkins for Apache.
$ sudo vim /etc/apache2/sites-available/jenkins
 <VirtualHost *:80>
     ServerName hameln.server-on.net
     ProxyRequests off
     ProxyPass /jenkins http://localhost:9090/jenkins
     <Location /jenkins>
        AuthType Basic
        AuthName "jenkins"
        AuthUserFile /etc/apache2/.htpasswd
        Require valid-user

        ProxyPassReverse http://localhost:9090/jenkins
        ProxyPassReverseCookieDomain localhost hameln.server-on.net
        ProxyPassReverseCookiePath / /
        Order allow,deny
        Allow from all
     </Location>
</VirtualHost>
$ cd /etc/apache2/sites-available/
$ sudo a2ensite jenkins
$ sudo /etc/init.d/apache2 restart
DONE!!
I can access Jenkins with example/jenkins It’s cool.

Uncategorized recent post

  1. Run Amazon FreeRTOS on M5Stack Core2 for AWS …

  2. Udacity Self-Driving Car Engineer Nanodegree …

  3. Install sbt 1.0.0 and run sample template

  4. Visualization of Neural Network and its Train…

  5. [Machine Learning]Created docker image includ…

関連記事

PAGE TOP