Installing ubuntu12.04/ubuntu14.04 virtual machines in VirtualBox

Source: Internet
Author: User
Tags switches hosting root access virtualbox shared folder oracle vm virtualbox vm virtualbox

Note: The Ubuntu12.04, which was first installed, was later reinstalled by 14.04. The basic use of the installation of 12.04, and later installed 14.04 added several. The installation process is applicable to both Ubuntu12.04 and 14.04.

1. Choose the difference between version 1.1 Ubuntu desktop and Server Edition

Desktop and server editions, as long as the release version number is consistent, the two are the same from the core, the only difference is their intended use. Desktop layout for PC users, you can do word processing, Web browsing, multimedia playback and play games. Essentially, this is a multi-purpose operating system tailored to the average user. On the other hand, the server Edition is designed to serve as a Web server for hosting files, Web pages, and similar content. "1"

The essential component of a PC is the GUI (graphical user interface). The desktop version of Ubuntu comes with the Gnome GUI, but you can also convert to KDE or X if you want. The server Edition does not install a GUI. In addition to routine maintenance, the server is not intended to be used for local interaction, so the GUI is not only necessary, but also consumes the server's excess resources. For other software, such as Office software, media Player software, browser, and so on, the same reason. None of these can be found on the server version.

Because it is server-facing, the server version of Ubuntu contains all the software you need to launch the hosting site. LAMP (Linux, Apache, MySQL, and PHP), listing the software associated with the Web server. Unless you install it yourself, these are not found on the desktop version.

The difference is not immutable, and by installing and uninstalling the package, you can also customize the desktop version to the server version and vice versa. Most of the people who want to install the server still need GUI convenience, then can start from any version, then just install GUI or lamp.


1. The desktop version is configured for personal computers, and the server version is available for Web servers.
2. The desktop version is preinstalled with the GUI, and the server version does not.
3. The desktop version has installed many of the software that the server Edition does not have.
4. The desktop version is missing Apache, MySQL, and PHP, which are standard in the server edition.

So, let's choose the desktop version.

1.2 I386 vs AMD64

On the Ubuntu website, if you download 32-bit, then the ISO file ends with I386.iso. If the download is 64-bit, then the ISO file ends with Amd64.iso.

The i386 is a 32-bit processor in the x86 series.
The AMD64 is a 64-bit processor. Intel has its own 64-bit, but not backwards-compatible, 64 to AMD64 first launch, custom known as AMD64.

2 installation process

1. Click New to bring up a window to create a new virtual machine.

2. Allocate memory size to the virtual machine.

The memory allocated to the VM is allocated only when the VM is power-up and will not be allocated when it is not started.

3. Create a virtual hard disk file.

4. Select the VDI format, which is VirtualBox's own format.

5. Type of virtual hard disk File: Select dynamic assignment.

6. Select the location where the disk files are stored, and the maximum capacity of the disks.

By default, under "C:\Users\xxx\VirtualBox vms\ubuntu_14_04", to not occupy the C space, you can move it to the new folder on the disk.

(Note: With regard to the maximum capacity of the disk, it was assigned 32G when the Ubuntu14.04 was installed, but the display is still 20G because it is not re-displayed.) )

7. Summary information for virtual disks

8. Summary information throughout the creation process.

9. When you click Create, you will return to the main window of VirtualBox.

10. Modify the Boot order: remove the floppy drive and put the hard drive in front of the drive

11. Insert disc image to Virtual PC

12. After clicking OK, go back to the main window

13. Click Start to start the installation

(1) Select language: 中文版

(2) Click Install Ubuntu.

Prepare to install Ubuntu

Leave the default option, Continue.

. Install Type

Select other options (Something else) to customize the manual partitioning.

16. The following are the most important partitions.

(1) Click "New Partition Table ..." and a dialog will pop up asking if you want to create an entire disk as an empty partition and choose Continue.

(2) At this point, a 20G free space will be created.

17. Click "Add" to add the disk.

Point your mouse to "free space" and then click "Add".

Refer to the procedure "2" of the Linux private dish of bird brother, do the following partition:

(This is allocated according to the size of the 32G hard disk space.) )

Here are 2 points to note:

A. If the/boot is partitioned separately, make sure that the split slot is at the front of the entire hard drive. Therefore, we select "Primary" for/boot to make it the primary partition. , and the "/" partition does not have to be a primary partition.

B. Partitioning cannot refer to the partition order given in "2":

"/" Partition (logic), "/boot" partition (primary partition), "swap" partition (logic), "/Home" Partition (logic)

Because Ubuntu does not actively adjust the position of the primary partition to the front. After partitioning the partition, the last remaining free space will be displayed as unavailable, and no further partitioning can be made.

In Ubuntu, you should follow the steps to create a "primary partition" before creating a "logical Partition", and generally put the swap partition at the end, so the order of the partitions should be:

"/boot" partition (primary partition), "/" Partition (logic), "/Home" Partition (logic), "swap" Partition (logic)

(1)/boot split slot

Allocate 102M space. (Fill in 100M or 101M, the final allocation of 99M, so fill in 102M, the system will eventually assign the root directory 100M)

(2) split slot for root directory (/)

The root directory allocates a size of 10001M

(3) The partition slot of the/home directory

Allocate 10001M space

(4) Memory replacement space (swap)

Allocate 2002M space (typically 1.5 to twice times the allocated memory size)

Because swap is a memory displacement space, there is no need for a mount point. So, please select "Swap" as shown in "File system type"!

(5) The final distribution result.

Finally, the remaining 12253M is reserved for later use as a command to practice disk operations.

When the partition is complete, click Install Now to begin installing the system.

As you can see, after creating the partition in the order of the "/" Partition (logical), "/" Partition (logic), "/" (logical) partition (logical), "/boot" (primary partition), the SDA naming order is: SDA1, Sda5 Sda6, Sda7.

If you create a partition in the order of "/" Partition (logical), "/boot" partition (primary partition), "swap" partition (logic), "/Home" partition (logical), the SDA naming order is: Sda5, sda2, Sda3- > sda4. The last remaining free space will be displayed as unavailable, and no further partitioning can be made.

18. After starting the installation, place select "Shanghai"

19. Keyboard Layout Select "Chinese".

20. Then enter the computer name and create a user name.

21. Installation of the system is now started.

22. After the installation is complete, the system needs to be restarted. Note that you need to click the ENTER key to complete the restart.

23. Activating the root account

(1) When the Ubuntu 12.04 installation is complete, the system's default root account is turned off.

This is primarily to protect the security of the system, but sometimes it is necessary to use the root account in order to install the software or perform other operations that require root access.

First you need to open HyperTerminal: Ctrl + Alt + T shortcut to open HyperTerminal

Then enter sudo passwd root

You will be prompted to enter the current user's password first, then prompt you to enter a new password for the root account, and then enter a confirmation.

(2) Switch between root user and normal user

Normal user switch to root user: Execute sudo root, it will prompt you to enter the root password.

The root user switches back to the normal user, there are 3 ways: su xxx (xxx is your own installation time user name), or directly enter exit, you can also ctrl+d key combination exit.

24. How do I log on as root user?

When the environment is installed, you can restart the system with only 2 users to choose from: The user who was set up when the system was installed, and a guest user, cannot log on with the root user. However, only the root user has permission to set up and install enhancements. So we need to get the root user out.

(1) The first reference is the method in "4":

Since the Ubuntu 12.04 login has been changed to LIGHTDM, the root user has been blocked, you need to change the login to GDM, in order to use the other option.

Installing Gdm:sudo apt-get Install GDM

After execution, the following dialog will eventually pop up and select GDM. (If you do not automatically pop up the following dialog box, execute sudo dpkg-reconfigure GDM, this will pop up the following dialog, change the login manager to GDM,)

(2) But the above "4" problem is very large, and finally to the "5" scheme.

But the VI editor used in step vi/etc/lightdm/lightdm.conf of "5". But the VI editor of the next key does not work (press the UP key will play the letter D), after the data "6", only in Ubuntu will appear this situation, need to install VIM.

(3) Install Vim:

sudo apt-get install vim

Make sure the virtual function is online. Because Apt-get requires root privileges, add sudo, and then prompt for the current user's password. Of course, first switch to the root user, and then directly execute Apt-get install Vim can also.

(4) After the installation is complete, follow the "5" scheme setting:

A. Switch to root login,

Su Root

B. Input vim/etc/lightdm/lightdm.conf

The position in Ubuntu14.04 is changed to "7":/usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf

C. Edit the file.

First, use the down button to move the cursor to the last line.

Then, type the command "O": a new line below the current line.

Then, add the following 2 lines:

# Manually input user when login, so root can inputgreeter-show-manual-login=true# disable guest Userallow-guest=false

Then, after editing the ESC key, press: W is saved does not exit, press: WQ is saved to exit, press: Q is no file to edit the case of exit, press: q! is the edited file does not save exit. Here, press: Wq Save to exit. The modified file is:

[Seatdefaults] greeter-session=unity-greeter User-session=ubuntu # Manually input user when login, so root can be inputgre eter-show-manual-login=true# Disable Guest Userallow-guest=false

D. Restart the login.

Shutdown-h now shuts down immediately

Shutdown-r now restarts immediately

Shutdown-r +3 three minutes after restart

E. After restarting, click Login and enter your username: root. Enter the password again after entering the carriage. You can log into the system.

Ctrl + Alt + t shortcut opens HyperTerminal. At this point, you can see that the interface prompt appears as the root user.

25. Installation Enhancements

25.1 Desktop Installation Enhancements

Devices->install Guest Additions Installation enhancements. However, the general prompt for installation enhancements fails with a general prompt to force the release. This is because the virtual CD-ROM already has a CD (ISO), and is not umount in use, resulting in addition.iso can not mount, shut down the virtual machine, the virtual machine management interface to release virtual discs.

Then launch the virtual machine into Ubuntu, reboot, click Login, enter username: root. Enter the password again after entering the carriage. You can log into the system. Then choose the Install Enhancement feature.

However, there was an error during installation, and the error message is:

Verifying Archive Integrity ... All good.
uncompressing VirtualBox 3.2.6 Guest additions for Linux .....
VirtualBox Guest Additions Installer
Removing installed version 3.2.6 of VirtualBox Guest additions ...
Building the VirtualBox Guest Additions kernel modules
Building The main Guest additions module ... fail.
Installing the Window System drivers
Warning:unknown version of the X Window System installed. Not installing
X Window System drivers.

This is because the version of VirtualBox is too old to cause "8". My VirtualBox version is: 4.1.18.

You need to download the latest 4.3.2 version of Virutalbox and VirtualBox Extension Pack. Overwrite the installation.

25.2 Server Edition installation Enhancements

Reference: Virtualbox Ubuntu Server 14.04 Installation Guest Additions (HTTP://WWW.BINARYTIDES.COM/VBOX-GUEST-ADDITIONS-UBUNTU-14-04/)

25.3 Update: Install enhancements.

20160303: It was later verified that there was no need to "24." How do I log on as root? "This step is done. Because you can switch the command line to the root user first, and then perform an enhanced installation under the command line. Reference: Virtual box Installation Enhancements (Ubuntu10.04) (

(1) First the command line switches to the root user (Su root),

(2) Click Devices->install Guest Additions,

(3) Then execute the ' mount ' command to see which directory the Enhanced Feature Pack is attached to (for example, in the/media/vboxadditions_4.0.4_69518/directory),

(4) Then switch to the directory (' cd/media/vboxadditions_4.0.4_69518/');

(5) Locate the file in this directory and execute the file (./

(6) After the execution, restart the system.

26. Upgrade VirtualBox version

Upgrading the VirtualBox version is simple, and the next installation is complete. At this point, if you "Start" the virtual machine, it will prompt you with the following information:

"Implementation of the USB 2.0 controller not found!

The device would be disabled. You can ignore this warning but there'll be a no USB 2.0 support in your VM. To fix this issue, either install the ' Oracle VM VirtualBox Extension Pack ' or disable USB 2.0 support in the VM settings "

This is due to the "9" that was caused by not installing the corresponding version of the VirtualBox Extension pack. Install the VirtualBox Extension Pack for the corresponding version of 4.3.2 version.

Open the VirtualBox program,file->preferences-> Select the Extensions option.

Click "Remove Package" to delete the previous 4.1.18 Version of VirtualBox Extension Pack, then click "ADD Package" and select the 4.3.2 version of the VirtualBox Extension pack that you just downloaded. Press OK and it will be installed automatically. It's ready to install.

27. Continue to install enhancements.

At this point, start the Ubuntu virtual machine. Note: Before starting the virtual machine, open the settings of the Ubuntu virtual machine and select "Storage" to remove the previously loaded virtual image. Then start the Ubuntu virtual machine.

After you start the virtual machine, select the Devices menu, select the Insert Guest additions CD Images option, and it will prompt you to install the enhanced feature. Click "Run" and it will be installed automatically. After the installation is successful, the following information is displayed:

28. Set up a shared directory with the host OS

Select "Devices", "Share Folder Settings", click the "+" button to add a shared

29. Restart Ubuntu to complete installation and setup

After the setup is complete, restart Ubuntu, this time you can see that the screen size and resolution of Ubuntu is getting bigger, and the same as the host OS. Indicates that the enhanced feature was installed successfully.

In addition, the/media directory can access the host OS's D drive, indicating that the shared success was set.

29.1 Setting up shared Updated:

Later found that using a normal user login to Ubuntu, the settings of the shared directory can not be accessed, prompting insufficient permissions. Here's another way to set it up.

A. Mount the folder you want to share to a file on a virtual machine "10"

(1) First, it is necessary to ensure that the VirtualBox enhancements are installed, as the latter vboxsf is provided in the enhanced functionality.

(2) First create a folder under MNT, as the target folder mounted, and then execute sudo mount-t vboxsf shared folder name of the virtual machine mount point

sudo mkdir/mnt/sharedsudo mount-t vboxsf f_drive/mnt/shared/

After entering/mnt/shared, you can find that the files under the shared folder can be copied.

Note: the name of the shared folder should not be the same as the name of the mount point, as above, f_drive and the shared folder under MNT cannot be the same. Otherwise, the following error will occur:

/sbin/mount.vboxsf:mounting failed with the Error:protocol error

(3) Uninstall command

sudo umount-f/mnt/shared

(4) After each use, you need to mount it manually, sudo mount-t vboxsf f_drive/mnt/shared/

It's too much trouble, is there a way to mount it automatically? Some. Add a "11" at the end of the/etc/fstab:

f_drive/mnt/shared vboxsf Rw,gid=1001000,uid=1000,auto 0 0

Then reboot the system.


(1) The above groupid=100 is wrong and should be 1000. After modifying to 1000, restart and verify that the discovery does not work.

(2) possible reasons for modifying the/etc/fstab method and the solution: the solution I found is to force the VBOXSF module to be loaded early, before The mounting of file systems. Just add vboxsf on a line of its own in/etc/modules. "13"

The modified/etc/modules file is:

#/etc/modules:kernel modules to load on boot time.## This file contains the names of kernel modules that should be Loade d# at boot time, one per line. Lines beginning with "#" is ignored.lprtcvboxsf

Restart the system after modification, still not working properly.

(3) continue to check the information, there may be that the current user is not added to the VBOXSF user group in the "14".

First look at the user group and discover that the current user is really not in vboxsf.


Then add the current user to the user group:

sudo usermod-a-G vboxsf Leige

Check again to see that the current user has been added to the user group.

Cat/etc/group-> Resultvboxsf:x:1001:leige

After restarting the computer, it still does not work properly.

(4) "15" by viewing VirtualBox official documentation:

Starting with version 4.0, VirtualBox can mount Gkfx folders automatically, at your option. IF automatic mounting is enabled for a specific shared folder, the Guest additions would automatically mount that folder as Soon as a user logs into the guest OS. The details depend on the guest OS type:
With Linux guests, auto-mounted shared folders is mounted into The/media directory, along with the prefix sf_. For example, the shared folder Myfiles would is mounted to /media/sf_myfiles on Linux and /mnt/sf_my Files on Solaris.

The guest property/virtualbox/guestadd/sharedfolders/mountprefix determines the prefix is used. Change this guest property to a value other than "SF" to the change of that prefix; See sections 4.6, "Guest properties" for details.

Access to auto-mounted gkfx folders is a granted to the user group vboxsf, which is created by the VirtualBox Guest Additions installer. Hence Guest users has the to being member of that group to has read/write access or to has read-only access in case the folder is not mapped writable.
To change the mount directory to something other Than/media, you can set the guest Property/virtualbox/guestadd/shar Edfolders/mountdir.
to has any changes to auto-mounted GKFX folders applied while a VM are running, the guest OS needs to Be  rebooted . (This applies auto-mounted gkfx folders, not the ones which is mounted manually.)

Since VirtualBox 4.0, the function of auto mount is provided, when you click the "+" button on the rightmost "Devices", "Share Folder Settings", when you add a share, if you select Auto Mount check box, the share is automatically mount to the/media directory and a sf_ prefix is added to the shared directory. If there is no automatic mount, it may be because the user is not added to the vboxsf user Group, and then follow the method in (3) above to add it to the vboxsf user group. Once added, restart the system (automatic mount requires a reboot, manual mount is not required), you can access the shared directory in the media directory.

Through verification, above updated (1) (2) is not necessary, I will/etc/fstab and/etc/modules restore, found/media directory still can normal auto mount.

(5) Why is the change fstab not auto mount? Someone with the same problem I encountered "16".

I use the sudo mount command to view and also find that the shared folders you set are mapped to a different place.

sudo mount->e_drive on/mnt/e_shared type vboxsf (UID=1000,GID=1000,RW) e_drive on/media/sf_e_drive type vboxsf (gid=1 001,RW)

The author thinks: tick "auto-mount" disturbed (messes with) things: Apparently, I had "Auto-mount" enabled in VirtualBox configuration for the Instan Ce. This messes with things, so I simply added my user to the vboxsf group (in addition to www-data ) and pointed Apache to /media/sf_web .


Re-verify, add a new share, in the settings "Devices", "Share Folder Settings", click on the right "+" button, add a share, do not tick the "Auto Mount" check box (only tick "make Permanent ") while maintaining another share tick the" Auto Mount "check box.

Then follow the steps in UPDATED1 (1) (2) (3) and discover that/mnt/d_shared can be shared. And/mnt/e_shared cannot be shared. Description The Auto Mount check box overrides the mount under/etc/fstab. It can also be seen through the sudo mount command in UPDATED1 (5).

B. Access "12" over the network

No attempt, interested students can refer to the "12" setting.

30. Set clipboard sharing between host OS and Guest OS

The Ubuntu14.04 between the virtual machine and the host cannot replicate content to each other, because VirtualBox is disabled by default.

Click "Machine"->settings->general->advanced->shared Clipboard

Select bidirectional, which can be replicated in both directions.

31. Modify the default folder

Virtual box After installing the VM, the default folder is placed under the C drive, you can change it to another disk.

Modify File->preferences->general->default Machine Folder:

C:\Users\msi\VirtualBox VMs


Modify "Machine"->settings->general->advanced->snapshot Folder:

C:\Users\msi\VirtualBox Vms\ubuntu_14_04\snapshots


3. The problem of unable to start virtual mirror after upgrading VirtualBox

After upgrading the VirtualBox to 4.3.16, when start starts the virtual machine image in the VirtualBox, it finds that it cannot be started and jumps out of an error box:

Failed to open a session of the virtual machine. The virtual machine ' ubuntu_14_04 ' have terminated unexpectedly during startup with exit code 1 (0x1).  More details is available in ' C:\Users\Administrator\VirtualBox vms\ubuntu_14_04\logs\vboxstartup.log '. Result Code:    e_fail (0x80004005)    Component:    machine    Interface:    imachine { 480cf695-2d8d-4256-9c7c-cce4184fa048}

The reason is that VirtualBox 4.3.14 added security detection, affecting the startup of the virtual machine, 4.3.14 later version seems to have the problem "17".

Re-overwriting the version that installs VirtualBox 4.3.12 will solve the problem. Note After you overwrite the installation, to follow steps 26 and 27 above, continue to install the 4.3.12 version corresponding to the enhanced Feature pack.

4. WIN10 installation 4.3. Version 12 cannot set the bridging network mode

Win10 Install VirtualBox4.3.12 Unable to set the bridge mode, VirtualBox cannot recognize the network card.

Overwrite the installation of the latest version of Virtualbox-5.0.14-105127-win.exe.


The difference between "1" Ubuntu Desktop Edition and Server Edition (

"2" Disk partition (Http://

"3" large hard drive with old host (Http://

"4" Ubuntu 12.04 how to log in using root user (

"5" authentic ubuntu 12.04 12.10 Root Login (

"6" I use the virtual machine Linux, the command interface, want to hit something in the VI editor, how always error (

"7" Ubuntu 14.04 root User login (

"8" About installation enhancements for Ubuntu in virtual machines (

"9" VirtualBox4.1.0 installs VirtualBox Extension Pack, supports USB 2.0 (

"10" VirtualBox Ubuntu Virtual Machine shared folder settings ( DXUKZ7RLFSKEMAAE7V2FIZVAP6TJZ18YFEPRBET15PZ7LXTN8NVEWPJXFMRDGJVMN-JYB0IL6FJG8VXAX-33N3GQG)

"11" VirtualBox implementation of Ubuntu virtual machine and Win7 host file sharing (Http:// Zgefj5dfgjd0kwfp3il_vzj7mrqgdz93ehgokl9lsg-xc0ayrgnspuz432n97_vmvgr58bz9e-8kai)

"12" How to copy the host files to VirtualBox's BT5 (Ubuntu) (

"13" Virtualbox shared folder mount from Fstab fails; Works once bootup is complete ( Virtualbox-shared-folder-mount-from-fstab-fails-works-once-bootup-is-complete)

"14" auto-mounting Shared Folders in VirtualBox ( Auto-mounting-shared-folders-in-virtualbox)

"15" 4.3.2. Automatic Mounting (Https://

"16" Fstab not mounting VirtualBox shared folder? ( Fstab-not-mounting-virtualbox-shared-folder)

"17" in the Win7 environment with VirtualBox installed Ubuntu after the start of the Times wrong (

Installing ubuntu12.04/ubuntu14.04 virtual machines in VirtualBox

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.