To install a VirtualBox VM on CentOS 6

Source: Internet
Author: User
Tags centos


1. Preparations

Install kernel updates

Yum install kernel-devel
Yum update kernel *
If the kernel is updated, restart the operating system.

2. Install VirtualBox

Wget http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc
Rpm -- import oracle_vbox.asc
Wget http://download.virtualbox.org/virtualbox/rpm/el/virtualbox.repo-O/etc/yum. Repos. d/virtualbox. repo
Yum install VirtualBox-4.3
3. Install the extension package to remotely log on to the operating system using RDP protocol 3389

Wget http://download.virtualbox.org/virtualbox/4.3.2/Oracle_VM_VirtualBox_Extension_Pack-4.3.2-90405.vbox-extpack
VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.3.2-90405.vbox-extpack
4. Create a virtual machine

Create a 2.6 or 3.0 kernel operating system virtual machine named centos6. The VM file is stored in/opt/virtualbox/

VBoxManage createvm -- name centos6 -- ostype Linux26_64 -- register -- basefolder/opt/virtualbox/
Before creation, you can view the supported types of customer operating systems:

VBoxManage list vms
5. Create a virtual disk

Create a GB virtual disk

VBoxManage createvdi -- filename/opt/virtualbox/centos6.vdi -- size 150000
6. Create a VM's hard disk controller

VBoxManage storagectl centos6 -- name storage_controller_1 -- add ide
7. Hanging on a virtual hard disk and a virtual optical drive

VBoxManage storageattach centos6 -- storagectl storage_controller_1 -- type hdd -- port 0 -- device 0 -- medium/opt/virtualbox/centos6.vdi
VBoxManage storageattach centos6 -- storagectl storage_controller_1 -- type dvddrive -- port 1 -- device 0 -- medium/opt/setup/CentOS-6.3-x86_64-LiveCD.iso
Mount the virtual disks created in step 5 to the virtual machine, attach them to a virtual optical drive, and load the ISO image file.

8. Set the startup sequence

Set the optical drive to the first boot sequence to install the operating system.

VBoxManage modifyvm centos6 -- boot1 dvd
VBoxManage modifyvm centos6 -- boot2 disk
9. Create a bridge network

VBoxManage modifyvm centos6 -- nic1 bridged -- cableconnected1 on -- nictype1 82540EM -- bridgeadapter1 em1 -- intnet1 brigh1 -- macaddress1 auto
View the nic name of the current host machine before creation. For example, em1 is used.

10. Start the vrde module

The VRDE module is used to start the RDP protocol and can be connected using Microsoft's 3389 client.

VBoxManage modifyvm centos6 -- vrde on
After the operating system is installed and configured, you can disable the screen output.

VBoxManage modifyvm centos6 -- vrde off
11. Adjust System parameters

You can adjust the CPU, memory, and other parameters of the virtual machine at this time.

VBoxManage modifyvm centos6 -- memory 4096
VBoxManage modifyvm centos6 -- cpus 2
12. Start a virtual machine

VBoxHeadless-startvm centos6
13. 3389 remote connection to install the operating system

After installing the operating system, you can use it normally.

FAQs

'Warning: The vboxdrv kernel module is not loaded .'

Make sure that the current kernel and kernel header file version are consistent:

Yum list installed | grep kernel
Then use vboxdrv for configuration

/Etc/init. d/vboxdrv setup
Start and shut down virtual machines

You can start the virtual machine https://www.virtualbox.org/manual/ch08.html#vboxmanage-startvm in the following ways

VBoxManage startvm centos6 -- type headless
VBoxHeadless-startvm centos6
Shut down the VM. If it is a VBoxHeadless running on the foreground, press CTRL + C. For VBoxHeadless or VBoxManage startvm running in the background, use

VBoxManage controlvm centos6 poweroff
Cannot use port 3389 to connect?

Check whether the port is alive:

Netstat-nap | grep 3389
Ss-snap | grep 3389
Check whether the firewall is allowed to pass.

Common VM control operations

Common operation address https://www.virtualbox.org/manual/ch08.html#vboxmanage-controlvm

VBoxManage controlvm pause | resume | poweroff | savestate centos6
Cannot log on using rsa publickey?

Check whether selinux prohibits logon.

Related Article

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: info-contact@alibabacloud.com 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.