Vagrant occupied by a box…

Occupied with installing a Virtual Vagrant Box

How Vagrant occupied my mind…

I wanted to give Ruby (on Rails) and some PHP and JavaScript frameworks
a try and Windows might just not be the best OS for starting some
of these up…

As my Linux Mint 17 installation had just broken after installing a new
Graphic Card (used the update by apt from 15 to 17, so of courseit did ;),
using a Virtual Machine (VM) seemed obvious.

Wanting the setup of the VM to be a “new experience” and one
job ad spoke about “Vagrant”, I thought – let’s do this!

And here we go.

You already have VirtualBox up and running, don’t you?
Otherwise, you can get it from here: https://www.virtualbox.org/.

Next we have to download the .ISO image of Mint from one
of the locations listed in their blog-Post to “Rebecca” (LM 17.1).
I used 64bit Cinnamon, but you can choose others, of course.

Create your Virtual Machine.

Create a Linux Machine [Type: Linux, Version: Linux 2.6/3.x (64bit)]
with a dynamically allocated Virtual Disk (VDMX) of at least 20GB
available space and a minimum of 512MB RAM.
1024MB would speed things up.
The Network-Adapter should already be NAT, if not, change it.

Now select your Linux Mint .ISO file as source for the VirtualBox
CD/DVD Drive in “Storage”.

Start up your VM and install Linux Mint using “vagrant”
as Username and Password (for convenience).

To get even more cozy while working with the system (and some
parts of Vagrant {like SSH} even expect the next step), we’re
going to set our “vagrant” user to access “sudo” without password
(ok, now you’ll have to type “vagrant” as pwd one last time ;).
In a Terminal Window, write:

sudo visudo

And add the following line to the end of the File:

vagrant ALL=(ALL) NOPASSWD: ALL

Press Ctrl+O and Ctrl+X, restart the system and you’re done
(with sudo Passwords ;).

Install VirtualBox Guest-Additions and setup SSH.

Before we can install the Guest-Additions, we have to get the
Linux headers and the basic development tools like this in a
Terminal Window:

sudo apt-get install linux-headers-generic build-essential dkms

Next put the Guest-Additions in the Virtual CD/DVD-ROM Drive
using the GUI [Devices -> Insert Guest Additions CD image…].
Mint now should ask you, if you want to install the Additions,
if it doesn’t, go back to the Terminal and type:

sudo mount /dev/cdrom /media/cdrom
sudo /media/cdrom/VBoxLinuxAdditions.run
sudo umount /media/cdrom

Now let’s prepare for open-SSH by adding Vagrant’s insecure keypair:

mkdir ~/.ssh
wget https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub -O ~/.ssh/authorized_keys
chmod 0700 ~/.ssh
chmod 0600 ~/.ssh/authorized_keys
chown -R vagrant ~/.ssh

Everything prepared, let’s move on to installing…

sudo apt-get install -y openssh-server

…and configuring the SSH-Server:

sudo gedit /etc/ssh/sshd_config

Make sure the following lines are present in the file and no # precedes them
(we are not on twitter right now, are we? ;) :

Port 22
PubkeyAuthentication yes
AuthorizedKeysFile %h/.ssh/authorized_keys
PermitEmptyPasswords no
UseDNS no

Now save the file and restart the SSH-server:

sudo service ssh restart

That’s all for now. You could try out your vagrant box now,
or proceed to installing our Development Tools.
(We’ll come to this in the next part :).

That’s all for now!

0 comments

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