Virtualbox is a virtual machine software provided by Oracle company. It provide both Windows, Linux and MacOS version. This article will tell you how to install it’s MacOS version and install Ubuntu Linux virtual machine in virtualbox. It also tell you how to resolve some common issues when you use virtual machine with ubuntu OS for the first time like below.
- How to enable copy & paste between host and guest (ubuntu virtual machine) os.
- How to search and run ubuntu application.
- How to resolve can not ping guest (ubuntu virtual machine) os from host os error.
1. Install Virtualbox In MacOS.
- Download Virtualbox MacOS version.
- Click the download dmg file to install virtualbox. The process is very easy, just follow the instructions.
2. Install Ubuntu Virtual Machine In Virtualbox.
- Double click the virtualbox icon to open it.
- Click New button to create a virtual machine, input the virtual machine name and select Linux in the Type drop down list. Then select Ubuntu(64 – bit) in Version drop down list.
- Click Continue button and specify the memory size, hard disk and storage information in the next wizard dialog.
- After all those steps, a new virtual machine has been created.
- Download ubuntu iso file and save it to a local folder.
- Right click the virtual machine, click Settings… menu item in the popup menu list, then click Storage button. Click the laser disk icon after Optical Drive label and click Choose Virtual Optical Disk File… menu item to select the downloaded ubuntu iso file.
- Now right click the virtual machine, then click Start —> Normal Start menu item to start ubuntu os installation.
- In the first install wizard, you can click Try Ubuntu button to try it from the iso file ( This action will not do any change to the virtual machine), or Install Ubuntu to install it in the virtual machine.
- In the next wizard just select the os language that you preferred.
- Choose Normal installation in the next wizard dialog if you are new to this.
- If you are a newbie, you can choose Erase disk and install Ubuntu radio button, this will use all default settings(partition settings etc) for this ubuntu os. If you have used other Linux version before, you can choose Something else radio button to customize the ubuntu os installation.
- The last step is to specify a username and password for you to login ubuntu.
- Now ubuntu has been installed correctly. Our version is ubuntu 18.04.1 desktop version. When you start it and login with your account, you can find it is stable like MacOS and it is easy to operate like Windows. In the next article, we will tell you how to configure SSH in the ubuntu OS and how to remote login into it.
3. Run Application In Ubuntu.
When you want to run ubuntu applications, you can follow below steps.
- Click the Show Applications button at the left bottom of ubuntu desktop.
- Input application name ( for example : Terminal ) in the search box at top, then related application will be displayed at below. Click the application icon to start it.
4. Enable Copy & Paste Between Host (Local Machine) And Guest (Virtual Machine) OS.
To enable copy and paste between host and guest OS, you need follow below steps.
- Start the virtual machine, and click Devices —> Insert Guest Additions CD image… menu item at top VirtualBox VM toolbar.
- Then it will mount a disk in the guest ubuntu virtual machine OS like below, it will prompt you to auto run it, click Run button and this will install the guest additions cd image.
- If you meet below error messages when click the Devices —> Insert Guest Additions CD image… menu item, this means the cd image has been mounted in the guest os already, so you just need to run it in the ubuntu virtual OS.
Unable to insert the virtual optical disk /Applications/VirtualBox.app/Contents/MacOS/VBoxGuestAdditions.iso into the machine Ubuntu.
Could not mount the media/drive ‘/Applications/VirtualBox.app/Contents/MacOS/VBoxGuestAdditions.iso’ (VERR_PDM_MEDIA_LOCKED).
- You can also run
sudo apt-get install virtualbox-guest-utilscommand in terminal to install the guest additions support packages to enable copy & paste function.
- Now to enable Copy & Paste between host and guest OS, you also need to set shared clipboard configuration value in the vm general advanced settings.
- Right click the virtual machine in left panel and click Settings… menu item in the popup menu item list.
- Click General —> Advanced, then select Bidirectional menu item in both Shared Clipboard and Drag’n’Drop drop down list. Click OK to save the settings and restart the virtual machine, now you can copy and paste data between host and guest OS successfully.
5. Resolve Can Not Ping Virtual Machine OS Issue.
Now the Ubuntu virtual machine has been installed and you have created an admin account for it. You can login to the system with that account. But when you want to access it from other machine, you should first find the ubuntu virtual machine’s external ip address with command
- Open a terminal in ubuntu, and run
ifconfigcommand in it.
[email protected]:~$ ifconfig enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.0.107 netmask 255.255.255.0 broadcast 192.168.0.255
- If you get error message Command ‘ifconfig’ not found, you can run
$ sudo apt install net-toolscommand to install it.
- The ip address after inet ( in red color ) is just the ip v4 ip address of this virtual machine.
- But when you ping this ip address from your host os, it will tell you request timeout error, this is because your virtual machine is not configured correctly.
- Open the virtual machine Settings dialog again, then click Network —> Adapter1. Change the Attached to value from NAT to Bridged Adapter. Then restart the ubuntu os, then you can ping the ubuntu os from host os.