やってみた。

勉強/チャレンジなどやってみたことのログ

how to install Java8 and IntelliJ IDEA with Chef

Overview

this is continuation of the entry: akzero.hatenablog.com

and you'll create project like this: basic-development-machine

we should learn:

version

VirtualBox: 5.1.6 Vagrant: 1.8.5 ChefDK: 0.18.26

preparation

$ vagrant plugin install vagrant-vbguest
$ vagrant plugin install vagrant-omnibus

refer to:

todos

find cookbooks from Chef Supermarket

$ vi Berksfile

write:

source 'https://supermarket.chef.io'

cookbook 'java'
cookbook 'idea'

download cookbooks

$ berks vendor cookbooks

specify settings

$ mkdir roles
$ cd roles
$ vi java.json
$ vi idea.json
{
  "name":"java",
  "description":"Install Oracle Java",
  "default_attributes":{
    "java":{
      "install_flavor":"oracle",
      "jdk_version":"8",
      "oracle":{
        "accept_oracle_download_terms":true
      }
    }
  },
  "run_list":[
    "recipe[java]"
  ]
}
{
  "name":"idea",
  "description":"Install IntelliJ IDEA",
  "default_attributes":{
    "idea":{
      "setup_dir":"/home/vagrant",
      "user":"vagrant",
      "version":"2016.2.4"
    }
  },
  "run_list":[
    "recipe[idea::default]"
  ]
}

provisioning settings (uses xubuntu 16.04 box we created at previous entry, it's on my github repository)

$ vi Vagrantfile

write

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure(2) do |config|
  config.vm.box = "xubuntu-16.04-desktop-amd64.box"
  config.vm.box_url = "https://github.com/akzero53/xubuntu-16.04-vagrant-box/releases/download/v1.0.0/xubuntu-16.04-desktop-amd64.box"

  config.omnibus.chef_version=:latest
  config.vm.provision "chef_solo" do |chef|
    chef.roles_path = ["roles"]
    chef.add_role("java")
    chef.add_role("idea")
  end

  config.vm.provider "virtualbox" do |vb|
    vb.gui = true
    vb.memory = "2048"
  end
end

at last

$ vagrant up --provision