Download VirtualBox for Linux Hosts
Add the following line to your /etc/apt/sources.list:
deb http://download.virtualbox.org/virtualbox/debian trusty contrib
Run command:
$ wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -
$ sudo apt-get update
$ sudo apt-get install virtualbox-5.0
$ sudo apt-get install dkms
Install Vagrant( on HostMachine )
Please download vagrant from http://www.vagrantup.com/downloads.html
.
Then run command:
$ vagrant box add centos6_5 https://github.com/2creatives/vagrant-centos/releases/download/v6.5.3/centos65-x86_64-20140116.box
Setup Vagrant( on HostMachine )
$ vagrant init centos6_5
Please set ip address into Vagrantfile.
Vagrant::Config.run do |config|
config.vm.box = "centos6_5"
config.vm.network "public_network", ip:"192.168.1.156"
...
Install sahara( on HostMachine )
Sahara can shot a snap for OS-image. You can commit your operations and rollback your operations.
$ vagrant plugin install sahara
$ vagrant plugin install vagrant-vbguest
$ vagrant plugin install vagrant-omnibus
$ vagrant plugin install vagrant-berkshelf
$ vagrant plugin install vagrant-chef-zero
if you have an error, please install c++ compiler( debian:g++, redhat:gcc-c++ )
Wake up GuestMachine:
$ vagrant up
$ vagrant ssh
change super user:
$ su -
Default password of root user is vagrant
.
Create user:
$ useradd chefsfarms
$ passwd chefsfarms
Changing password for user chefsfarms.
New password: chefsfarms
Retype new password: chefsfarms
passwd: all authentication tokens updated successfully.
Add a user in super users:
$ visudo
Then please add below.
chefsfarms ALL=(ALL) NOPASSWD:ALL
Change mode home directory of the guest user:
$ chmod 755 /home/chefsfarms
Install Chef-Solo( on GuestMachine )
$ curl -L http://www.opscode.com/chef/install.sh | sudo bash
Go to https://downloads.chef.io/chef-dk/redhat/#/
. Get link download.
$ wget https://opscode-omnibus-packages.s3.amazonaws.com/el/6/x86_64/chefdk-0.6.2-1.el6.x86_64.rpm
$ sudo rpm -Uvh chefdk-0.6.2-1.el6.x86_64.rpm
$ which chef
$ chef -v
Then run:
$ chef generate repo chef-repo
$ cd chef-repo
$ vi Berksfile
Chèn source code sau vào.
source "https://supermarket.chef.io"
cookbook 'application_ruby'
cookbook 'apt'
cookbook 'build-essential'
cookbook 'user'
cookbook 'ssh_known_hosts'
cookbook 'ruby_build'
cookbook 'vim'
Chạy command:
$ berks vendor cookbooks
Thế là đã cài đặt xong. And now, all the needed cookbooks are downloaded into folder chef-repo/cookbooks