How to install Vagrant
sudo apt update && sudo apt upgradesudo apt install virtualbox
sudo apt install vagrant -y
How to test the install has worked
vagrant --versionCreate a sub-directory
I create a directory into which I will put all my boxes (virtual machines)mkdir ~/vagrant
cd ~/vagrant
i686 example
Installing the box
As mentioned, I have an old laptop and therefore I can only run i686 boxes on it. You can find lots of boxes at https://app.vagrantup.com/boxes/search It was here that I searched for the term 'i686' and came up with the box 'herroffizier/centos-6.5-i686' which will be used in the example below. Still in the '~/vagrant' directory, create another sub-directory and change to it.mkdir centos65i686
cd centos65i686
Now let's install the box.
vagrant init herroffizier/centos-6.5-i686
The installation takes place and a file called Vagrantfile is created. I like to make a few changes to this file for my own purposes. Here is my example Vagrant file below.
Vagrant.configure("2") do |config|
config.vm.boot_timeout = 600
config.vm.box = "herroffizier/centos-6.5-i686"
config.vm.provider "virtualbox" do |vb|
vb.gui = true
vb.memory = "1024"
end
end
I extended the timeout because I have an old laptop. I also load the GUI and give it a decent amount of memory.
Running the box
Now I'm ready to run my box. Still in the 'centos65i686' directory type the following.
vagrant up
A new window starts up and the box loads within it.
Once the loading process has completed you are presented with a login screen. Use the following credentials:
username : vagrant
password : vagrant
Now you should be in.
Tidying up
If you've finished with your box, you can close it down with the following command.vagrant halt