Setting up a full JVM Env with Vagrant: Java 8, Scala 2.11, Groovy 2.4, Clojure 1.6, Maven 3.3, Gradle 2.4, Sbt 0.13 and Lein
On the previous posts i show how to use docker, docker-compose and nodejs with vagrant now let`s do a full jvm env :-)
This setup is pretty easy and straightforward for you however it could take some time depending of your internet bandwidth because we gonna download several components.
Remember you need to have Vagrant installed already, this time we gonna need more than just the Vagrant file because java, scala, clojure for instance require we setup environment variables so we gonna need change some files for clojure and sbt in order to make everything work smoothly.
What Languages will be installed?
This setup is pretty easy and straightforward for you however it could take some time depending of your internet bandwidth because we gonna download several components.
Remember you need to have Vagrant installed already, this time we gonna need more than just the Vagrant file because java, scala, clojure for instance require we setup environment variables so we gonna need change some files for clojure and sbt in order to make everything work smoothly.
What Languages will be installed?
What Build Systems will be installed?
Vagrantfile
You will need to use this vagrantfile, here i do all the provisioning necessary to have this components installed and proper configured ready to you use and have fun.
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 : | |
Vagrant.configure(2) do |config| | |
config.vm.box = "ubuntu/trusty64" | |
config.vm.network "private_network", ip: "55.55.55.102" | |
config.vm.synced_folder ".", "/home/vagrant/shared/" | |
#config.vm.provision "file", source: "conf/sbt.sh", destination: "/home/vagrant/bin/sbt" | |
config.vm.provision "shell", inline: <<-SHELL | |
# | |
# Update and install basic linux programs for development | |
# | |
sudo apt-get update | |
sudo apt-get install -y wget | |
sudo apt-get install -y curl | |
sudo apt-get install -y vim | |
sudo apt-get install -y git | |
sudo apt-get install -y build-essential | |
sudo apt-get install -y unzip | |
# | |
# Install Java 8 | |
# | |
cd /opt | |
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/8u45-b14/jdk-8u45-linux-x64.tar.gz" | |
sudo tar -xzvf jdk-8u45-linux-x64.tar.gz | |
sudo rm -rf jdk-8u45-linux-x64.tar.gz | |
# | |
# Install Maven 3.3 | |
# | |
sudo wget http://mirror.nbtelecom.com.br/apache/maven/maven-3/3.3.3/binaries/apache-maven-3.3.3-bin.tar.gz | |
sudo tar -xzvf apache-maven-3.3.3-bin.tar.gz | |
sudo rm -rf apache-maven-3.3.3-bin.tar.gz | |
# | |
# Install Groovy 2.4 | |
# | |
sudo wget http://dl.bintray.com/groovy/maven/groovy-binary-2.4.3.zip | |
sudo unzip groovy-binary-2.4.3.zip -d /opt/ | |
sudo rm -rf groovy-binary-2.4.3.zip | |
# | |
# Install Gradle 2.4 | |
# | |
sudo wget https://services.gradle.org/distributions/gradle-2.4-bin.zip | |
sudo unzip gradle-2.4-bin.zip -d /opt/ | |
sudo rm -rf gradle-2.4-bin.zip | |
# | |
# Install Clojure 1.6 | |
# | |
sudo wget http://repo1.maven.org/maven2/org/clojure/clojure/1.6.0/clojure-1.6.0.zip | |
sudo unzip clojure-1.6.0.zip -d /opt/ | |
sudo rm -rf clojure-1.6.0.zip | |
sudo cp /home/vagrant/shared/conf/clojure.sh /opt/clojure-1.6.0/clojure | |
sudo chmod +x /opt/clojure-1.6.0/clojure | |
# | |
# Install Lein | |
# | |
sudo mkdir /home/vagrant/bin | |
cd /home/vagrant/bin/ | |
sudo wget https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein | |
sudo chmod a+x /home/vagrant/bin/lein | |
# | |
# Install Scala 2.11 | |
# | |
sudo wget http://downloads.typesafe.com/scala/2.11.6/scala-2.11.6.tgz | |
sudo tar -xzvf scala-2.11.6.tgz | |
sudo rm -rf scala-2.11.6.tgz | |
# | |
# Install SBT 0.13 | |
# | |
cd /home/vagrant/bin/ | |
sudo wget https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt-launch/0.13.8/sbt-launch.jar | |
sudo cp /home/vagrant/shared/conf/sbt.sh /home/vagrant/bin/sbt | |
sudo chmod u+x /home/vagrant/bin/sbt | |
sudo chmod +x /home/vagrant/bin/sbt | |
# | |
# Source the new bashrc | |
# We also need finish install lein, it will self install thats why we do lein for last | |
# | |
sudo cat /home/vagrant/shared/conf/bashrc.txt >> /home/vagrant/.bashrc | |
source /home/vagrant/.bashrc | |
SHELL | |
end |
As i said you will need custom bashrc file and also a script to run clojure all this file you can get on my github here: https://github.com/diegopacheco/Diego-Pacheco-Sandbox/tree/master/DevOps/vagrant-jvm look for the conf directory.
Now we are ready to run $ vagrant init && vagrant ssh
Vagrant will download and provision all installations we need, as i said this cloud take some time.
Cheers,
Diego Pacheco
Now we are ready to run $ vagrant init && vagrant ssh
Vagrant will download and provision all installations we need, as i said this cloud take some time.
Cheers,
Diego Pacheco