Install VirtualBox Virtual Machine on CentOS minimal

Source: Internet
Author: User
Tags epel repo nameserver

VirtualBox 4.3 can be configured to automatically start a virtual machine. The following steps are performed on the CentOS 6.5x86 64-bit system. The minimal version is used to make the host into a Headless PC (Headless host, that is, no display, no keyboard and mouse ), connect the network cable to the host system, install VitrualBox, and create several virtual machines. After configuration, several virtual machine systems (such as Windows 2003 and Ubuntu) are automatically started after the host is powered on)

1. Install the host system

First, install CentOS 6.5 minimal x86_64 on the hardware host. Download the ISO file from the official website to complete system installation. As the host of VirtualBox, if you do not run other services, you can select the Minimal version. After installation, the Minimal version is only several hundred MB in size, which is much lighter than other versions or systems with several GB of capacity.

1.1 start the NIC
After the default installation is complete, only one lo local network interface is enabled. After the physical NIC Driver is enabled, it is disabled by default. You need to modify the configuration file to open it.
Use ifconfig to view only one lo, but use ifconfig-a to view other NICs. If you still cannot see it, the NIC system does not know it and has no driver. You need to install the driver first.
Modify the configuration file:

# Vi/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE = "eth0"
NM_CONTROLLED = "yes"
ONBOOT = no
HWADDR = A4: BA: DB: 37: F1: 04
TYPE = Ethernet
BOOTPROTO = dhcp change ONBOOT = no to ONBOOT = yes

 


The default IP address is DHCP. If you want to change it to a static IP address, as follows:

DEVICE = "eth0"
NM_CONTROLLED = "yes"
ONBOOT = yes
HWADDR = A4: BA: DB: 37: F1: 04
TYPE = Ethernet
BOOTPROTO = static
NAME = "System eth0"
UUID = 5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03
IPADDR = 192.168.1.44
NETMASK = 255.255.255.0 use static address, you also need to continue configuring the gateway and DNS

# Vi/etc/sysconfig/network
NETWORKING = yes
HOSTNAME = centos6
GATEWAY = 192.168.1.1 restart the network interface to make the above configuration changes take effect

# Service network restart continue to configure DNS

# Vi/etc/resolv. conf
Nameserver 8.8.8.8 # Replace with your nameserver ip
Nameserver 192.168.1.1 # Replace with your nameserver ip Address, the latter may be a gigabit Nic)

 


1.2 configure the firewall
The created virtual machine does not have a GUI in Command-Line mode. to install a graphical operating system such as Windows, you need to use remote desktop to connect to the virtual machine, therefore, you must enable the port for Remote Desktop Connection.

# Vi/etc/sysconfig/iptables
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
* Filter
: Input accept [0: 0]
: Forward accept [0: 0]
: Output accept [0: 0]
-A input-m state -- state ESTABLISHED, RELATED-j ACCEPT
-A input-p icmp-j ACCEPT
-A input-I lo-j ACCEPT
-A input-m state -- state NEW-m tcp-p tcp -- dport 22-j ACCEPT
-A input-m state -- state NEW-m tcp-p tcp -- dport 3389-j ACCEPT
-A input-j REJECT -- reject-with icmp-host-prohibited
-A forward-j REJECT -- reject-with icmp-host-prohibited
In the example above, we added a line to enable the default port 3389 of VRDP.
Restart the firewall to make the configuration take effect.

# Service iptables restart


1.3 Mount CDROM

For example, to install a Windows virtual machine, you must have a Windows installation disc. If you are using a physical disc, you must mount it to CentOS.
Create a mount point

# Mount cdrom with mkdir/mnt/CDROM

# Mount/dev/cdrom/mnt/cdrom view cdrom

# Df-h
Filesystem Size Used Avail Use % Mounted on
/Dev/mapper/VolGroup-lv_root 14G 1.6G 12G 13%/
Tmpfs 246 M 0 246 M 0%/dev/shm
/Dev/sda1 485 M 54 M 407 M 12%/boot
/Dev/sr0 626 M 626 M 0 100%/mnt/cdrom (Note: Parameter-h indicates human, displayed in the unit of M and G. Specifically,/dev/cdrom actually points to/dev/sr0, which is related to the interface on which the optical drive is inserted)

 


1.4 mount a mobile storage device in ntfs format
You may also store the ISO file of the installation disc on the mobile hard disk, and may be in NTFS format. Before mounting, you need to install the ntfs-3g for support.
There is no ntfs-3g in the official software warehouse, and EPEL third-party software warehouse is recommended here.

# Cd/tmp
# Wget http://dl.Fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
# Rpm-uv h epel-release-6 *. rpm
# Ls/etc/yum. repos. d/
CentOS-Base.repo CentOS-Media.repo epel. repo
CentOS-Debuginfo.repo CentOS-Vault.repo epel-testing.repo can be seen, in addition to CentOS, with two more epel repo, third-party software warehouse can already be used, if you want to try beta software, open the epel-testing.repo, change enabled = 0 to enabled = 1.

 


# Yum install ntfs-3g install the ntfs-3g with the simple command above

 


Insert the mobile hard disk into the USB port and check the device:

# Fdisk-l in the list, you can see the name of the USB disk device, such as/dev/sdc1. Mount with mount:

# Mkdir/mnt/usb
# Mount-t ntfs-3g/dev/sdc1/mnt/usb
# Ls/mnt/usb/hard disk to be removed:

# Umount/mnt/usb

VirtualBox details: click here
VirtualBox: click here

Use Virtualbox in Ubuntu 12.10 to install Win7

Complete Windows XP installation using VirtualBox Virtual Machine in Ubuntu

Install Ubuntu 13.10 On VirtualBox Virtual Machine

  • 1
  • 2
  • 3
  • Next Page

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.