Skip to content

Instantly share code, notes, and snippets.

@tangblack
Last active August 29, 2015 14:08
Show Gist options
  • Save tangblack/3fee3107a0c117f737ed to your computer and use it in GitHub Desktop.
Save tangblack/3fee3107a0c117f737ed to your computer and use it in GitHub Desktop.
mkdir /path/to/your/jenkins_vm_project
cd /path/to/your/jeknins_vm_project
# 查看你抓下來的 box
vagrant box list
# centos64_x86_64 是我替 CentOS6.4 64 取的 box 名稱
vagrant init centos64_x86_64
# vagrant init 會自動產生 Vagranfile
# 編輯修改
# 1) 用 bootstrap.sh 來初始化環境
# config.vm.provision :shell, path: "bootstrap.sh"
# 2) 將實體機器的 38080 對應至 VM 的 8080 (Jenkins Web GUI 會用到)
# config.vm.network "forwarded_port", guest: 8080, host: 38080
vim Vargrantfile
# 建立初始化環境的 script
# 內容如下方 vagrant_install_jenkins_bootstrap
touch bootstrap.sh
vim bootstrap.sh
# 啟動 VM
# VM 啟動後,在實體機器的瀏覽器上連 http://127.0.0.1:38080/ 就可以看到 Jenkins
vagrant up
#!/usr/bin/env bash
yum -y install wget
yum -y install java-1.6.0-openjdk
java -version
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 -y install jenkins
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment