在 centos 上安裝 virutalbox

簡介

VirtualBox 是一款開源虛擬機軟件。VirtualBox 是由德國 Innotek 公司開發,由Sun Microsystems公司出品的軟件,使用Qt編寫,在 Sun 被 Oracle 收購後正式改名成 Oracle VM VirtualBox。Innotek 以 GNU General Public License (GPL) 釋出 VirtualBox,並提供二進制版本及 OSE 版本的代碼。使用者能夠在VirtualBox上安裝而且執行SolarisWindowsDOSLinux、OS/2 Warp、BSD等系統做爲客戶端操做系統。如今則由甲骨文公司進行開發,是甲骨文公司xVM虛擬化平臺技術的一部份。shell

VirtualBox號稱是最強的免費虛擬機軟件,它不只具備豐富的特點,並且性能也很優異!它簡單易用,可虛擬的系統包括Windows(從Windows 3.1到Windows十、Windows Server 2012,全部的Windows系統都支持)、Mac OS X、Linux、OpenBSDSolaris、IBM OS2甚至Android等操做系統!使用者能夠在VirtualBox上安裝而且運行上述的這些操做系統! 與同性質的VMware及Virtual PC比較下,VirtualBox獨到之處包括遠端桌面協定(RDP)、iSCSI及USB的支持,VirtualBox在客戶端操做系統上已能夠支持USB 2.0的硬件裝置,不過要安裝 VirtualBox Extension Pack。windows

-- 來自百度百科centos

centos 6.x 安裝 virtual box

整個安裝過程主要是參考以下博客。網絡

https://tecadmin.net/install-oracle-virtualbox-on-centos-redhat-and-fedora/oracle

Oracle VirtualBox is a cross-platform virtualization application. It installs on your existing Intel or AMD-based computers, whether they are running Windows, Mac, Linux or Solaris operating systems. It extends the capabilities of your existing computer so that it can run multiple operating systems at the same time. Click hereto read more about VirtualBoxapp

Oracle has released its new major version VirtualBox 6.0.4 . In this release VirtualBox has improves stability and fixes regressions. To read more about this release read changelog. This article will help you to install Oracle VirtualBox 6.0 on CentOS and Redhat systems using Yum.性能

Step 1 – Add Required Yum Repositories

Firstly you are required to add VirtualBox yum repository in your system. Download repository file from its official site and place it under at /etc/yum.repos.d/virtualbox.repo .First navigate to /etc/yum.repos.d/ directory and use one of below commands as per your operating system.ui

cd /etc/yum.repos.d/
wget http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo

The CentOS and RedHat users also required to add EPEL yum repository using one of the following commands.this

### On CentOS/RHEL 7 ### 
rpm -Uvh http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

### On CentOS/RHEL 6 ### 
rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

Step 2 – Install Required Packages

Before installing VirtualBox make sure to install all required packages to run VirtualBox like kernel-headers, kernel-devels etc. Use the following command to install the required packages.

yum install gcc make patch  dkms qt libgomp
yum install kernel-headers kernel-devel fontforge binutils glibc-headers glibc-devel

After installing latest kernel and kernel headers, let’s reboot your system and start with Latest kernel.

reboot

Step 3 – Setup Environment Variable

VirtualBox installation required kernel source code to install required modules, So we need to configure environment variable KERN_DIR to which VirtualBox get kernel source code. In my case latest kernel source is available in 2.6.32-504.3.3.el6.x86_64 directory under /usr/src/kernels/ . Make sure you are using correct source path.

export KERN_DIR=/usr/src/kernels/`uname -r`

Step 4 – Install Oracle VirtualBox and Setup

Use the following command to install VirtualBox using the yum command line tool. It will install the latest version of VirtualBox 5.2 on your system.

yum install VirtualBox-6.0

要開始從新編譯 kernel 模塊,還要安裝下面的軟件

sudo yum install kernel-devel kernel-devel-2.6.32-754.el6.x86_64

After installation, we need to rebuild kernel modules using the following command.

service vboxdrv setup

Step 5 – Launch VirtualBox

Use following command to start VirtualBox from X windows. You can switch to GUI mode using init 5 or startx commands from terminal.

virtualbox

virtual box 中安裝 centos 6 minimum 鏡像

安裝鏡像

鏡像地址: https://mirror.tuna.tsinghua.edu.cn/#

我選的是 centos 6.10 minimum

https://mirror.tuna.tsinghua.edu.cn/centos/6.10/isos/x86_64/CentOS-6.10-x86_64-minimal.iso

在安裝時,網絡模式,我選擇的是橋接模式

網絡設置

在 virtualbox 中安裝好 centos minium 後,默認是沒有開啓網絡的,須要本身設置。

開啓網絡的操做,主要是參考下面連接

https://unix.stackexchange.com/questions/78295/centos-no-network-interface-after-installation-in-virtualbox/78305#78305

核心操做是編輯文件 /etc/sysconfig/network-scripts/ifcfg-eth0

設置下面字段

ONBOOT="yes"
NM_CONTROLLED="no"

橋接模式,設置靜態 ip

選擇了橋接模式,可是每次啓動 centos 後 ip 地址老變,須要將 ip 地址固定住。

參考連接以下 http://www.javashuo.com/article/p-ynwncegb-ev.html

當前 nn02 上的網絡配置以下。 文件/etc/sysconfig/network-scripts/ifcfg-eth0

BOOTPROTO=static
 IPADDR=192.168.1.222
 NETMASK=255.255.255.0
 GATEWAY=192.168.1.255
 DNS1=114.114.114.114

DEVICE=eth0
 HWADDR=08:00:27:5E:74:AE
 TYPE=Ethernet
 UUID=1ee603a9-d6dd-460c-86c2-a74e739193be
 ONBOOT=yes
 NM_CONTROLLED=no
 BOOTPROTO=static
 NAME=eth0

重啓網絡服務後,就會發現 ip 地址固定爲 192.168.1.222 了。

相關文章
相關標籤/搜索