Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save hasanhameed07/3f1657e2d44c0f112bcb2a1371aeb99f to your computer and use it in GitHub Desktop.
Save hasanhameed07/3f1657e2d44c0f112bcb2a1371aeb99f 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!

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