Last active
January 3, 2016 02:19
-
-
Save sgykfjsm/8394448 to your computer and use it in GitHub Desktop.
vagrantでubuntuを入れて、jenkins,apapcheをセットアップ。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# ssh setting | |
su - vagrant -c ' | |
mkdir -p ${HOME}/.ssh | |
## for more secure | |
# ssh-keygen -t rsa -q -P "" -f ~/.ssh/id_dsa | |
## sandbox setting | |
wget -q -O ${HOME}/.ssh/id_dsa https://raw.github.com/mitchellh/vagrant/master/keys/vagrant | |
wget -q -O ${HOME}/.ssh/id_dsa.pub https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub | |
cat $HOME/.ssh/id_dsa.pub >> $HOME/.ssh/authorized_keys | |
chmod 700 ${HOME}/.ssh | |
chmod 600 ${HOME}/.ssh/id_dsa* | |
' | |
# ssh speed up | |
echo UseDNS no >> /etc/ssh/sshd_config | |
cd /tmp | |
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 -fy update | |
sudo apt-get -y install git openjdk-7-jdk apache2 jenkins zip unzip | |
# Setting up an Apache Proxy for port 80 -> 8080 | |
sudo a2enmod proxy | |
sudo a2enmod proxy_http | |
sudo a2dissite default | |
sudo cat <<EOF > /etc/apache2/sites-available/jenkins | |
<VirtualHost *:80> | |
ServerAdmin webmaster@localhost | |
ServerName ci.presice.com | |
ServerAlias ci | |
ProxyRequests Off | |
<Proxy *> | |
Order deny,allow | |
Allow from all | |
</Proxy> | |
ProxyPreserveHost on | |
ProxyPass / http://localhost:8080/ | |
</VirtualHost> | |
EOF | |
sudo a2ensite jenkins | |
sudo apache2ctl restart | |
# scala | |
DOWNLOAD_URL=http://www.scala-lang.org/files/archive/scala-2.10.3.tgz | |
SCALA_TGZ=`basename ${DOWNLOAD_URL}` | |
SCALA_DIR=`basename ${SCALA_TGZ} .tgz` | |
wget -q -O /tmp/${SCALA_TGZ} ${DOWNLOAD_URL} | |
sudo tar zxf /tmp/${SCALA_TGZ} -C /usr/local/ | |
sudo ln -s /usr/local/${SCALA_DIR} /usr/local/scala | |
# setting environment | |
SETTING_FILE=/etc/profile.d/append_environment_values.sh | |
echo '#!/bin/bash' | sudo tee -a ${SETTING_FILE} | |
echo '# added by vagrant setup.sh' | sudo tee -a ${SETTING_FILE} | |
echo | sudo tee -a ${SETTING_FILE} | |
echo 'export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-amd64' | sudo tee -a ${SETTING_FILE} | |
echo 'export SCALA_HOME=/usr/local/scala' | sudo tee -a ${SETTING_FILE} | |
echo 'export PATH=${SCALA_HOME}/bin:${JAVA_HOME}/bin:${PATH}' | sudo tee -a ${SETTING_FILE} | |
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! | |
VAGRANTFILE_API_VERSION = "2" | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
config.vm.box = "precise" | |
config.vm.box_url = "/Users/sgyk/local/vagrant/box/precise-server-cloudimg-amd64-vagrant-disk1.box" | |
config.cache.auto_detect = true | |
config.vm.define :presice do |presice| | |
presice.vm.hostname = "precise" | |
presice.vm.network :private_network, ip: "192.168.56.100" | |
presice.vm.provider "virtualbox" do |v| | |
v.customize ["modifyvm", :id, "--memory", 2048] | |
v.name = "jenkins_presice" | |
end | |
presice.vm.synced_folder "data1", "/vagrant_data" | |
presice.vm.provision :shell, :path => "./setup.sh" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment