Skip to content

Instantly share code, notes, and snippets.

@jayarampradhan
Last active December 4, 2015 09:46
Show Gist options
  • Save jayarampradhan/55b72feab9b5861f7675 to your computer and use it in GitHub Desktop.
Save jayarampradhan/55b72feab9b5861f7675 to your computer and use it in GitHub Desktop.
Multiple Box in Vagrant (Centos 7.1, JDK1.8_u66, Docker)
sudo echo "LANG=en_US.UTF-8" >> /etc/environment
sudo echo "LANGUAGE=en_US.UTF-8" >> /etc/environment
sudo echo "LC_ALL=en_US.UTF-8" >> /etc/environment
sudo echo "LC_CTYPE=en_US.UTF-8" >> /etc/environment
sudo yum update -y
yum -y install wget
yum -y install git
yum -y install unzip
mkdir /home/vagrant/install-packages
chown vagrant:vagrant /home/vagrant/install-packages
chmod 777 /home/vagrant/install-packages
mkdir /home/vagrant/tools
chown vagrant:vagrant /home/vagrant/tools
chmod 777 /home/vagrant/tools
sudo yum install -y epel-release
sudo yum install -y python-pip
sudo curl -L https://github.com/docker/compose/releases/download/1.5.1/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
sudo echo "PATH=$PATH:/usr/local/bin/docker-compose" >> /etc/environment
sudo wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u66-b17/jdk-8u66-linux-x64.tar.gz" -P /home/vagrant/install-packages
tar xzf /home/vagrant/install-packages/jdk-8u66-linux-x64.tar.gz
mv jdk1.8.0_66 /opt
echo 'export JAVA_HOME="/opt/jdk1.8.0_45/"' >> /etc/profile
source /etc/profile
alternatives --install /usr/bin/java java /opt/jdk1.8.0_66/bin/java 1
alternatives --install /usr/bin/jar jar /opt/jdk1.8.0_66/bin/jar 1
alternatives --install /usr/bin/javac javac /opt/jdk1.8.0_66/bin/javac 1
alternatives --set jar /opt/jdk1.8.0_66/bin/jar
alternatives --set javac /opt/jdk1.8.0_66/bin/javac
sudo echo "JAVA_HOME=/opt/jdk1.8.0_66" >> /etc/environment
sudo echo "JRE_HOME=/opt/jdk1.8.0_66/jre" >> /etc/environment
sudo echo "PATH=$PATH:/opt/jdk1.8.0_66/bin:/opt/jdk1.8.0_66/jre/bin" >> /etc/environment
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
config.vm.provision "shell", inline: "echo Hello"
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
config.vm.define "uim_cookmate_docker_dev", autostart: false do |uim_cookmate_dev|
uim_cookmate_dev.vm.box = "boxcutter/centos71"
uim_cookmate_dev.vm.network "private_network", type: "dhcp"
uim_cookmate_dev.vm.synced_folder "shared", "/vagrant_data"
uim_cookmate_dev.vm.synced_folder "~/git/", "/dev/workspace", owner: "root", group: "root"
uim_cookmate_dev.vm.provision "docker"
uim_cookmate_dev.vm.provision "shell", path: "install-devtools/install-devtools.sh"
uim_cookmate_dev.vm.provision "shell", path: "install-jdk8/install-jdk8.sh"
uim_cookmate_dev.vm.provision "shell", path: "install-dockertools/install-dockertools.sh"
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# config.vm.network "forwarded_port", guest: 80, host: 8080
uim_cookmate_dev.vm.network "forwarded_port", guest: 80, host: 8081
uim_cookmate_dev.vm.provider "virtualbox" do |vb|
# Display the VirtualBox GUI when booting the machine
vb.gui = false
# Customize the amount of memory on the VM:
vb.memory = "2048"
vb.name = "UIM_CookMate_Dev"
vb.cpus = 4
end
#
# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
uim_cookmate_dev.vm.provision "shell", inline: <<-SHELL
echo "Hello CookMate Devloper"
SHELL
end
config.vm.define "uim_docker_poc", autostart: false do |docker_poc|
docker_poc.vm.box = "boxcutter/centos71"
docker_poc.vm.network "private_network", type: "dhcp"
docker_poc.vm.synced_folder "shared", "/vagrant_data"
docker_poc.vm.synced_folder "~/git/", "/dev/workspace", owner: "root", group: "root"
docker_poc.vm.network "forwarded_port", guest: 80, host: 8082
docker_poc.vm.provision "docker"
docker_poc.vm.provision "shell", path: "install-devtools/install-devtools.sh"
docker_poc.vm.provision "shell", path: "install-jdk8/install-jdk8.sh"
docker_poc.vm.provision "shell", path: "install-dockertools/install-dockertools.sh"
docker_poc.vm.provider "virtualbox" do |vb|
# Display the VirtualBox GUI when booting the machine
vb.gui = false
# Customize the amount of memory on the VM:
vb.memory = "2048"
vb.name = "UIM_Docker_POC"
vb.cpus = 4
end
#
# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
docker_poc.vm.provision "shell", inline: <<-SHELL
echo "Hello POC User"
SHELL
#
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment