Virtualbox with freenas NFS share on Windows

When you run on Windows it is quite hard to use the devtools plugin from the command line. You could use GIT bash or the Ubuntu bash in Windows 10. Both are not working very well if you have your GRAV installation on a freenas share.

Homestead

On the site of the Laravel PHP framework page you find a good recipe for installing a Homestead server on a virtualbox. That is a ready to use Ubuntu appliance for Virtualbox. With some small adjustments you can use it very well for your GRAV command line features from devtools too.

Step 1. Follow the recipe

Follow the recipe for installing the Homestead server on the Laravel page.

Install:

Note about the shared folder configuration:

folders:
    - map: C:/<a directory on your local drive>/Code    
      to: /home/vagrant/Code

That directory on your local drive could be something like c:/users/yourself/Sources. It has no further relevance to the purpose we are aiming for, but it should exist.
We will do the NFS share in the Ubuntu server later on.

Step 2. Create SSL key with Puttygen

You can use Puttygen (from the developers of Putty) to generate SSL keys. Follow the instruction below to generate your own local SSL keys.

The fastest way to download it is with this link.

Save your public and private key on an easy to find folder on your local drive, to avoid long paths (f.e. c:/.ssl-keys, would be good).

A very good instruction you can find here:
WinScp, Obtaining and using Puttygen

Step 3. Launch the Vagrant box

After launching the vagrant box with:

vagrant up

the server will be started. You only have to this once to see if everything is working. If you open the Virtualbox application in Windows, you will notice that a Homestead server has been added. The next time you can start it from there.

By default the credentials are:

To have root access to the server you have to do the following in the terminal of the server:

sudo passwd root

Enter then the credentials for root access with sudo.

Step 4. Define the freenas NFS share

On the freenas server you go the shares option, where you add a Unix (NFS) share.

Then in the following dialog enter the information like below, with the exception of:

Step 5. Define the share in the Homestead Ubuntu server

Make the following changes in the /etc/fstab (sudo nano /etc/fstab) of your Ubuntu Homestead terminal.

xxx.xxx.xxx.xxx:/mnt/hp-freenas/FreenasShareName /mnt/FreenasLocalShare nfs rsize=8192,wsize=8192,nolock,timeo=14,intr,proto=tcp,port=2049  0 0
Explanation
xxx.xxx.xxx.xxx IP Adress or DNS name to your Freenas server
/mnt/hp-freenas/FreenasShareName The path your share on the Freenas Unix share
/mnt/FreenasLocalShare A folder you've created in the /mnt folder that binds to your Freenas share

After you have modified the fstab file and saved it, type:

sudo mount -a

That should mount the newly addes NFS share. Now you can go to the /where/yourshare/is folder and if everything was fine, you could see the contents of the shared location.

Step 6. Use the terminal (TTY) with putty (bonus)

The terminal option in the virtual box is not very friendly and doesn't have the nice copy/paste functions that Putty has. So let's install Putty for connecting to our virtualbox.

Virtualbox

When you look in the Virtual network settings, you see that on the first adapter you can click on port forwarding

After you have clicked on that, you will see a number of forwarded ports:

The first entry is important for use in Putty, it forwards 127.0.0.1 to port 2222. This is what you have to use in Putty.

Putty

When you use Putty as your terminal emulator, you can start the server headless.

Last update: March 15th at 12:36pm