Last active
August 29, 2015 14:05
-
-
Save yuki777/2b8144e23af73eeb51a5 to your computer and use it in GitHub Desktop.
vagrant
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
# vars | |
project_name=rdev | |
ip=192.168.33.22 # ip address that you want to use | |
user_name=yuki # user name that you want to create | |
# install, settings | |
cd ~/vagrant/vagrant/ | |
vagrant box add $project_name _base/ubuntu-14.04-amd64-vbox.box | |
mkdir $project_name | |
cd $project_name | |
vagrant init | |
cat << EOF > Vagrantfile | |
VAGRANTFILE_API_VERSION = "2" | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
config.vm.box = "$project_name" | |
config.vm.network "private_network", ip: "$ip" | |
config.vm.network "public_network" | |
config.vm.provider :virtualbox do |vb| | |
vb.customize ["modifyvm", :id, "--memory", "2048", "--cpus", "4"] | |
vb.name = "$project_name" # shown in VirtualBox GUI menu | |
end | |
config.vm.define :$project_name do |t| | |
t.vm.hostname = "$project_name" | |
end | |
end | |
EOF | |
# run | |
vagrant up | |
# update,upgrade,,, | |
vagrant ssh | |
sudo apt-get update | |
sudo apt-get upgrade | |
sudo adduser $user_name | |
exit | |
# change editor from nano to vi. visudo | |
sudo update-alternatives --config editor | |
sudo visudo | |
# add host on your local-mac:/etc/hosts | |
sudo sh -c "echo '$ip $project_name' >> /etc/hosts" | |
# ssh | |
ssh $project_name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment