Skip to content

Instantly share code, notes, and snippets.

@learncodeacademy
Last active February 24, 2021 14:48
Show Gist options
  • Star 75 You must be signed in to star a gist
  • Fork 38 You must be signed in to fork a gist
  • Save learncodeacademy/5f84705f2229f14d758d to your computer and use it in GitHub Desktop.
Save learncodeacademy/5f84705f2229f14d758d to your computer and use it in GitHub Desktop.
Getting Started with Vagrant, SSH & Linux Server Administration

###Let's install Vagrant###

###Select a Vagrant Box from https://vagrantcloud.com###

#add it to your list of boxes
vagrant box add hashicorp/precise32
#create a new folder for your project & init vagrant
vagrant init hashicorp/precise32
#run your new machine
vagrant up
#ssh into your new machine
vagrant ssh

Now you are connected to a new machine!

  • hit exit to disconnect

###Let's make this feel like the real world by adding a fake domain name###

  • open the Vagrantfile and uncomment the private_network line & change to your desired IP
    • config.vm.network "private_network", ip: "22.22.22.22"
    • run vagrant reload
  • make a fake domain for that ip
    • run sudo open /etc/hosts -a "Sublime Text" to open your /etc/hosts file in Sublime Text
    • add this line to the end of the file and save 22.22.22.22 mytestsite.com

Nice! Now going to mytestsite.com will connect to our machine!

###Let's install nginx so we can see if our "domain" is working###

#always update apt-get on a new machine
sudo apt-get update
#install nginx
sudo apt-get install nginx
#start-er up
sudo service nginx start

Now, go to mytestsite.com...you should see Welcome to nginx!

@sudhatumuluru
Copy link

After installing virtualbox, what OS should I install in it ? Ubuntu Linux/Oracle Linux ? Server version or desktop version ?

@RAMTO
Copy link

RAMTO commented Jun 28, 2016

You should install hashicorp/precise32 (Ubuntu)
https://atlas.hashicorp.com/hashicorp/boxes/precise32/

@husnulhamidiah
Copy link

I got this error when run vagrant up

/sbin/mount.vboxsf: mounting failed with the error: No such file or directory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment