Using Vagrant and Linode to create a VPS in minutes

Automation is now becoming more popular and given a standard in some places. The best place to start learning is by using Vagrant and Linode a Virtual Private Server(VPS) that will host our content.

Our goal in this project will be to use Vagrant to provision an image of Ubuntu 16.04LTS onto our Linode. In return this process will give you fully functional Ubuntu Server in less then 5 minutes. Here are the things you will need:

  1. Install Vagrant on your PC.
  2. Get yourself a Linode plan.

With Vagrant installed you will need to create a folder called “vagrant-linode” and be sure to change directory into it. Next we’ll be to have vagrant install a plugin for Linode provision to do this we simply enter this:

vagrant plugin install vagrant-linode

Once it’s done installing you will need to crate a file called Vagrantfile inside our vagrant-linode folder which Vagrant will use.

touch Vagrantfile

Copy and paste this into the Vagrant file and be sure to change anything that has CHANGE ME Example:

Vagrant.configure('2') do |config|

  config.vm.provider :linode do |provider, override|
    override.ssh.private_key_path = '~/.ssh/id_rsa' = 'linode/ubuntu1604'
    override.vm.box_url = ""

    provider.token = ''
    provider.distribution = 'Ubuntu 16.04 LTS'
    provider.datacenter = 'CHANGE ME Example: newark'
    provider.plan = 'CHANGE ME Example: Linode 1024'
    provider.label = 'CHANGE ME'
    # provider.planid = 1
    # provider.paymentterm = <*1*,12,24>
    # provider.datacenterid = 6
    # provider.image = 
    # provider.imageid = 
    # provider.kernel = 
    # provider.kernelid = 
    # provider.private_networking = 
    # provider.stackscript =  # Not Supported Yet
    # provider.stackscriptid =  # Not Supported Yet
    # provider.distributionid = 

Now kick off Vagrant by  using:

vagrant up

After it is done provision you can access the VPS by:

vagrant ssh

You will now have SSH access to your VPS to begin installing software, creating users,

You can take this to the next step and use Vagrant along side Ansible to get a full install along with installing all software you want such as: MySQL, Postfix, Dovecot, UFW, OpenVPN, user accounts, creating the config files so everything works right out of the box but I will go over that another time.

Tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.