Ubuntu Server Virtual Machine with SSH using VirtualBox on Mac OS X // under My laptop is a late 2011 MacBook Pro running OS X 10.9 Mavericks. It's my personal laptop, so I use it for everything - browsing, e-mail, and programming. While the OS X experience is wonderful, application development can be frustrating. For example, right now I'm trying to develop a Boost Python module, and I am having trouble compiling it on OS X. I intend to run my application in a Linux environment, so instead of learning the intricacies of porting my code and makefile to Mac OS X, I decided to install a local Ubuntu Server virtual machine (VM) on my MacBook. I installed Ubuntu Server instead of Ubuntu Desktop because I wanted to run a lightweight Linux environment, which should save laptop resources. I simply run the VM in the background, and ssh into it from the Mac terminal.
Easy and awesome! This entire tutorial should take approximately 20 minutes (not including download times). Install VirtualBox Download and install VirtualBox. The instructions below were testing with VirtualBox 4.3.18 on OS X 10.9.5. Download Ubuntu Download the iso image. Setting up the Virtual Machine (VM) You can configure your virtual machine (VM) using the VirtualBox graphical program, but it's quicker to set it up from the command line.
Step 1: Download VirtualBox installer for Windows. On the next screen, click Install to begin installing the program. When prompted with a message to install (Trust) Oracle Universal Serial Bus, click Install to continue. Continue with the wizard until you’re done. After that, VirtualBox should be installed.
I've adapted these commands in part from this. The commands below will create a virtual machine called 'UbuntuServer', attach a 32 GB virtual hard drive, attach a DVD drive loaded with the Ubuntu Server disk image, and allocate 1 GB of RAM. We also attach a network card and set up port forwarding. Cd /VirtualBox VMs/ # Change these variables as needed VMNAME = 'UbuntuServer' UBUNTUISOPATH =/Downloads/ubuntu-14.04.1-server-amd64.iso VMHDPATH = 'UbuntuServer.vdi' # The path to VM hard disk (to be created).
Vboxmanage startvm UbuntuServer The VM will boot from the DVD Drive, which has the Ubuntu Server installation CD image loaded. Install Ubuntu Server Install Ubuntu Server using the installation wizard with the default settings. The installer is interactive - it should take about 10 minutes to complete the installation. As part of the installation you will be asked to select a username and a password.
After installation is complete, the machine will reboot. Log in at the prompt. Hint: If you accidentally click on the VM GUI window, VirtualBox may 'hijack' your mouse pointer to try passing it to the VM. If this happens and you lose your mouse pointer, press the left command key to get your mouse pointer back. Install the OpenSSH Server After installing the Ubuntu operating system and logging in to VM, to install the ssh server, issue the following command in the Ubuntu VM.
Ssh -p 2222 @localhost Congrats!:-) For the rest of this installation guide, I recommend issuing all VM commands over ssh because the display is better than the VM GUI console, and you can easily paste commands into the Mac ssh terminal. Install VirtualBox Guest Additions (for shared folders) To share a folder from your host machine (i.e. Mac) with the VM, you need to install the VirtualBox Guest Additions in the VM. Before you can install the Guest additions, you need to install gcc and make into the VM.
Make sure your laptop is connected to the internet ( in the VM). Sudo usermod -g vboxsf For the GuestAdditions installation to take effect, you need to reboot the VM. We'll take care of that in the next section when we boot the VM without a GUI. Starting the VM without GUI. Now that ssh has been installed and configured, you can run the VM in the background without a GUI window.
First, shutdown the VM using one of these methods:. From the VM GUI, close the window and select 'Send Shutdown Signal', OR. From the VM GUI menu, select 'Machine - ACPI Shutdown' OR. From the Mac terminal, issue vboxmanage controlvm UbuntuServer poweroff Next, start the VM without a GUI from the OS X terminal. Ssh -p 2222 @localhost Additional Tweaks Here are some solutions to other issues that may arise: Configure the Grub Boot Loader On one occasion I powered off the VM while it was booting. The next time time I tried to start the VM without the GUI, I could not log in over ssh because, unknown to me at the time, the VM was sitting in the GRUB bootloader menu waiting for my input.
You can configure GRUB to timeout by editing the VM's GRUB configuration file at /etc/default/grub with the line.
Here in this tutorial, we use the FreeNAS ISO image to create a FreeNAS VM (virtual machine) using the VirtualBox on Windows, Linux, and MacOS. FreeNAS is the open source NAS based on FreeBSD and doesn’t need any introduction. Using the FreeNAS, a user can create its own personal NAS box using some old computer or even a virtual machine. Moreover, if you forward your local IP address of the FreeNAS to the public IP (to access remotely) of yours then you can use it as a kind of personal cloud server where you can install and access different kind of software like, WordPress and more. It comes with ZFS to protect, store, backup, all of your data. The ZFS is an enterprise-ready open source file system, RAID controller, and volume manager.
FreeNAS comes with features like File Sharing (NFS, FTP, AFP, iSCSI, WebDAV), Web Interface, Data Protection, Snapshots, Replication, Encryption, Backup services (Windows Backup, rsync, Apple Time Machine, TrueOS Life Preserver, and Plugins. Also, point to be noted that the FreeNAS installation needs a separate hard drive for storing the data apart from the device hard drive where you are about to install it.
This means if you have only drive attached to PC or virtual machine you only able to install the FreeNAS and for storing any data you require a separate one. Moreover, before using the FreeNAS as the commercial or permanent solution you can install it on the USB storage/pen drive too; so that you can use your computer hard drive for storage purpose.
Other best way to test or use the FreeNAS is the Virtual environment where you can install FreeNAS for testing and learning purpose. But as per the official website for the commercial or production purpose, the installation of FreeNAS on the virtual machine is not recommended.
To install and run the FreeNAS VM (Virtual machine) on the Virtual box you have to create a virtual machine that fulfils the following minimum requirements of FreeNAS OS:. FreeNAS ISO image. 8GB RAM at least. Minimum 8GB virtual disk to install and boot the FreeNAS OS.
One spare virtual drive at least 4GB to store content. Let’s start with the step by step tutorial to install the FreeNAS virtual machine on VirtualBox: For this tutorial, we used VirtualBox and FreeNAS 11.2 ISO image. And the process of installation will be the same for Windows, Linux or MacOS. Step 1: Download the FreeNAS ISO image: First of all, go to the freenas.org and download the open source FreeNAS operating system ISO image. You can also use this link: During performing this tutorial the latest version was Freenas 11.2. Step 2: Download VirtualBox If you already have VirtualBox then skip this step. Otherwise, use this link to get VirtualBox for Windows, Linux or MacOS.
On Linux Like Ubuntu OS, you can install the Virtual Box with just one command on command terminal. Step 3: Create VM (Virtual Machine) for FreeNAS on VirtualBox. After downloading and installing the VirtualBox, its time to create a Virtual machine for FreeNAS.
Open the Virtual Box. Click on the New button. Enter some name for your FreeNAS virtual machine and the from type drop-down box select the Other and Version- Other/Unkown(64-bit). Set the Memory size, we set it 4Gb, here because of our testing system limitations, but recommended is 8GB. So, if you have that much free memory on your machine then go ahead and assign it for your FreeNAS.
Now Click on the Create button. Create a Virtual Hard Disk for your FreeNAS VM. At least 4Gb should be there but we assigned it 57GB and you can assign according to the availability on your machine. Once the Drive created click on the Create button. Now select you created FreeNAS virtual machine from the left side and then click on the Settings option given in the menu of the VirtualBox. From the Settings click on the Storage option and the on the CD icon given on the right as shown in the below given screenshot. Click on the Choose Virtual Optical Disk File option and browse the FreeNAS ISO image downloaded above.
Now you can see the FreeNAS ISO image will be showing under the Storage Devices. As I told you above that we can’t use the hard drive for storage where we installing the F reeNAS. SO, for storage, we need to attach one other virtual hard drive to our FreeNAS VM. For that under the Storage click on the Controller: IDE option and then on the plus icon + hard disk icon. Click on the Create New Disk button 14. Set the Disk Space you want to assign to the storage of your FreeNAS and then click on the Create button. Now click on the OK button.
Step 4: Network Configuration Once you did with the Virtual Harddrive configuration click on the Network option and select the Attached to: Bridged Adapter. You need to select this option because only then you can communicate t he FreeNAS from the host or other computer presents in your local network. Press the OK button. Now, Select your FreeNAS VM from the left side pan of the VirtualBox and then click on the START button given in the Menu. Step 5: Install FreeNAS on VirtualBox as Virtual Machine. Press Enter button to start the installation of the FreeNAS.
If you have assigned a lower amount of RAM to your system as recommended then you will see a message pointing that. Just select the YES and press the ENTER. Now select the Install/Upgrade option using Keyboard and press Enter. Use the arrow keys and spacebar button from the keyboard to select the drive in which you want to install the FreeNAS. Select the YES to erase the partition and start the FreeNAS installation. FreeNAS has both the capabilities of booting either from BIOS or UEFI mode. Select the Boot via Bios option.
During the installation, the FreeNAS will ask you to set the root password. Once the installation is done. Press the Enter button and remove installation media which is a FreeNAS.ISO image by right-clicking on the CD icon given at the bottom of your VirtualBox.
After the installation has done you will see a couple of options including the IP address that you can use to access the FreeNAS in your browser (web interface). In case you want to change the root password: Type ‘ 7′ from your keyboard and press the Enter button. And type the new password you want to assign to your FreeNAS box. Step 6: Access FreeNAS web user interface.
To access the web user interface of the FreeNAS just type the IP address which shown on the Console setup of the FreeNAS.