2014년 7월 2일 수요일

[cloudv] Installing Jenkins on Ubuntu



sudo apt-get install openjdk-7-jdk

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

* start jenkins service
sudo service jenkins start

* Change Jenkins HTTP Port
sudo vi /etc/default/jenkins
HTTP_PORT=<port>

* Open firewall using ufw
sudo ufw allow <port>

---

* set post scripts for deploy

$ sudo passwd jenkins
$ sudo vi /etc/sudoers
Defaults:jenkins !requiretty
jenkins ALL = NOPASSWD: /var/lib/jenkins/post_scripts/deploy_myapp.sh

$ sudo su - jenkins
jenkins$ mkdir /var/lib/jenkins/post_scripts
jenkins$ vi /var/lib/jenkins/post_scripts/deploy_myapp.sh
service tomcat6 stop
rm -rf /var/lib/tomcat6/webapps/huyang/
service tomcat6 start


http://localhost:8080/job/<myapp>/configure
Post Steps > Execute shell > Command
sudo /var/lib/jenkins/post_scripts/deploy_myapp.sh






댓글 없음:

댓글 쓰기