Install and Running CoreOS with Vagrant & VirtualBox

  • Posted on: 15 September 2014
  • By: oon
CoreOS logo

CoreOS adalah Linux yang dibuat untuk tujuan memudahkan deployment server yang bersifat masif.

Masih bingung juga?

Iya sih, pasti pertanyaannya bermula dari apa bedanya dengan linux yang udah ada (yang yang sudah terbiasa dengan CentOS, Ubuntu, Debian, dls).

biar lebih jelas, aku menemukan satu video, penjelasan dari CEO dan CTO CoreOS tentang apa sih linux distribusi yang dibangunnya itu? video sudah di-embed di bagian bawah artikel ini.

Salah satu hal yang menurutku 'lucu' (baca: lucu untuk geek), versi dari CoreOS ini udah ratusan, kenapa ratusan? karena ternyata versinya adalah jumlah hari sejak 1 Juli 2013. (mengingatkan soal epoch dari 1-1-1970).

Karena tertarik install, akhirnya baca-baca, dan jatuh hati pada cara menginstall menggunakan Vagrant di atas virtual machine VirtualBox [1].

Nah, apalagi itu Vagrant?

Vagrant itu tools, biasa digunakan untuk membangun development environment agar mirip dengan production environment [2].

Nah untuk menyambungkan keduanya, sudah disediakan konfigurasi Vagrant oleh tim CoreOs di https://github.com/coreos/coreos-vagrant.git

bbrp syntax vagrant yang digunakan:

# vagrant up 
# vagrant halt 
# vagrant status
# vagrant box update
# vagrant provision
# vagrant up --provision

Ini ceritaku tentang instalasi CoreOS:

o7:vagrant o$ git clone https://github.com/coreos/coreos-vagrant.git
Cloning into 'coreos-vagrant'...
remote: Counting objects: 296, done.
remote: Total 296 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (296/296), 64.79 KiB | 86.00 KiB/s, done.
Resolving deltas: 100% (128/128), done.
Checking connectivity... done.
o7:vagrant o$ ls -la
o7:vagrant o$ cd coreos-vagrant/
o7:coreos-vagrant o$ ls -la
total 48
drwxr-xr-x   9 o  staff   306 Sep 15 21:26 .
drwxr-xr-x   3 o  staff   102 Sep 15 21:26 ..
drwxr-xr-x  13 o  staff   442 Sep 15 21:26 .git
-rw-r--r--   1 o  staff   117 Sep 15 21:26 .gitattributes
-rw-r--r--   1 o  staff    35 Sep 15 21:26 .gitignore
-rw-r--r--   1 o  staff  4087 Sep 15 21:26 README.md
-rw-r--r--   1 o  staff  3302 Sep 15 21:26 Vagrantfile
-rw-r--r--   1 o  staff  1679 Sep 15 21:26 config.rb.sample
-rw-r--r--   1 o  staff   722 Sep 15 21:26 user-data.sample
o7:coreos-vagrant o$ less Vagrantfile 
o7:coreos-vagrant o$ cp user-data.sample user-data
o7:coreos-vagrant o$ vim user-data
o7:coreos-vagrant o$ cp config.rb.sample config.rb
o7:coreos-vagrant o$ vim config.rb
o7:coreos-vagrant o$ vagrant up
Bringing machine 'core-01' up with 'virtualbox' provider...
Bringing machine 'core-02' up with 'virtualbox' provider...
==> core-01: Box 'coreos-alpha' could not be found. Attempting to find and install...
    core-01: Box Provider: virtualbox
    core-01: Box Version: >= 308.0.1
==> core-01: Loading metadata for box 'http://alpha.release.core-os.net/amd64-usr/current/coreos_production_vagrant.json'
    core-01: URL: http://alpha.release.core-os.net/amd64-usr/current/coreos_production_vagrant.json
==> core-01: Adding box 'coreos-alpha' (v444.0.0) for provider: virtualbox
    core-01: Downloading: http://alpha.release.core-os.net/amd64-usr/444.0.0/coreos_production_vagrant.box
    core-01: Calculating and comparing box checksum...
==> core-01: Successfully added box 'coreos-alpha' (v444.0.0) for 'virtualbox'!
==> core-01: Importing base box 'coreos-alpha'...
==> core-01: Matching MAC address for NAT networking...
==> core-01: Checking if box 'coreos-alpha' is up to date...
==> core-01: Setting the name of the VM: coreos-vagrant_core-01_1411233706019_77465
==> core-01: Clearing any previously set network interfaces...
==> core-01: Preparing network interfaces based on configuration...
    core-01: Adapter 1: nat
    core-01: Adapter 2: hostonly
==> core-01: Forwarding ports...
    core-01: 22 => 2222 (adapter 1)
==> core-01: Running 'pre-boot' VM customizations...
==> core-01: Booting VM...
==> core-01: Waiting for machine to boot. This may take a few minutes...
    core-01: SSH address: 127.0.0.1:2222
    core-01: SSH username: core
    core-01: SSH auth method: private key
    core-01: Warning: Connection timeout. Retrying...
==> core-01: Machine booted and ready!
==> core-01: Setting hostname...
==> core-01: Configuring and enabling network interfaces...
==> core-01: Running provisioner: file...
==> core-01: Running provisioner: shell...
    core-01: Running: inline script
==> core-02: Box 'coreos-alpha' could not be found. Attempting to find and install...
    core-02: Box Provider: virtualbox
    core-02: Box Version: >= 308.0.1
==> core-02: Loading metadata for box 'http://alpha.release.core-os.net/amd64-usr/current/coreos_production_vagrant.json'
    core-02: URL: http://alpha.release.core-os.net/amd64-usr/current/coreos_production_vagrant.json
==> core-02: Adding box 'coreos-alpha' (v444.0.0) for provider: virtualbox
==> core-02: Importing base box 'coreos-alpha'...
==> core-02: Matching MAC address for NAT networking...
==> core-02: Checking if box 'coreos-alpha' is up to date...
==> core-02: Setting the name of the VM: coreos-vagrant_core-02_1411233734398_53046
==> core-02: Fixed port collision for 22 => 2222. Now on port 2200.
==> core-02: Clearing any previously set network interfaces...
==> core-02: Preparing network interfaces based on configuration...
    core-02: Adapter 1: nat
    core-02: Adapter 2: hostonly
==> core-02: Forwarding ports...
    core-02: 22 => 2200 (adapter 1)
==> core-02: Running 'pre-boot' VM customizations...
==> core-02: Booting VM...
==> core-02: Waiting for machine to boot. This may take a few minutes...
    core-02: SSH address: 127.0.0.1:2200
    core-02: SSH username: core
    core-02: SSH auth method: private key
    core-02: Warning: Connection timeout. Retrying...
==> core-02: Machine booted and ready!
==> core-02: Setting hostname...
==> core-02: Configuring and enabling network interfaces...
==> core-02: Running provisioner: file...
==> core-02: Running provisioner: shell...
    core-02: Running: inline script
o7:coreos-vagrant oonarfiandwi$ vagrant status
Current machine states:

core-01                   running (virtualbox)
core-02                   running (virtualbox)

This environment represents multiple VMs. The VMs are all listed
above with their current state. For more information about a specific
VM, run `vagrant status NAME`.
o7:coreos-vagrant oonarfiandwi$ vagrant global-status
id       name    provider   state   directory                                  
-------------------------------------------------------------------------------
1531db8  core-01 virtualbox running /Users/o/vagrant/coreos-vagrant 
08105ce  core-02 virtualbox running /Users/o/vagrant/coreos-vagrant 
 
The above shows information about all known Vagrant environments
on this machine. This data is cached and may not be completely
up-to-date. To interact with any of the machines, you can go to
that directory and run Vagrant, or you can use the ID directly
with Vagrant commands from any directory. For example:
"vagrant destroy 1a2b3c4d"
o7:coreos-vagrant o$ vagrant halt
==> core-02: Attempting graceful shutdown of VM...
==> core-01: Attempting graceful shutdown of VM...
o7:coreos-vagrant o$

Nah masih banyak lagi cerita yang lain soal CoreOS ini, tapi sementara artikel ini segini dulu aja, cuma sampai install doank aja :p

ps: semua cerita ini bermula dari sebuah kalimat "pengen pake Docker" :)

[1]https://coreos.com/docs/running-coreos/platforms/vagrant/
[2]https://www.vagrantup.com/about.html

Media File: 

CenturyLink Labs Interviews CoreOS CEO Alex Polvi and CTO Brandon Philips

Comments

Kece juga om domainnya.. thanks for artikel coreOs nya..

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.