« cuiなCentOS7ホストでVirtualBox仮想サーバーインポート | メイン | Microsoft Edge で仮想サーバ(VirtualBoxゲストOS)にアクセスできない »

UNIX

cuiなCentOS6ホストでVirtualBox仮想サーバーインポート

 前回『cuiなCentOS7ホストでVirtualBox仮想サーバーインポート』のCentOS6版。
 マシン等は前回と全く同じ。  CentOSは
# cat /etc/redhat-release
CentOS release 6.9 (Final)
 カーネルは
# uname -r
2.6.32-696.30.1.el6.x86_64
 手順は...▼
 wget がなければインストール
# yum -y install wget
 ヴァーチャルボックスのリポジトリを取得
# wget  http://download.virtualbox.org/virtualbox/rpm/el/virtualbox.repo
 指定時のみ利用するようリポジトリを修正
# vi virtualbox.repo
[virtualbox]
name=Oracle Linux / RHEL / CentOS-$releasever / $basearch - VirtualBox
baseurl=http://download.virtualbox.org/virtualbox/rpm/el/$releasever/$basearch
enabled=0 ★
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://www.virtualbox.org/download/oracle_vbox.asc
 リポジトリを正規の位置へ配置
# mv virtualbox.repo /etc/yum.repos.d/.
 インストール可能なパッケージを調査
# yum --enablerepo virtualbox search virtualbox
VirtualBox-3.2.x86_64 : Oracle VM VirtualBox
VirtualBox-4.0.x86_64 : Oracle VM VirtualBox
VirtualBox-4.1.x86_64 : Oracle VM VirtualBox
VirtualBox-4.2.x86_64 : Oracle VM VirtualBox
VirtualBox-4.3.x86_64 : Oracle VM VirtualBox
VirtualBox-5.0.x86_64 : Oracle VM VirtualBox
VirtualBox-5.1.x86_64 : Oracle VM VirtualBox
VirtualBox-5.2.x86_64 : Oracle VM VirtualBox
 VirtualBox-5.2をインストール
# yum --enablerepo virtualbox install -y VirtualBox-5.2
 この段階では、VBoxManageコマンドで vboxconfigを実行するようメッセージされ、いくつかのパッケージインストールを求められて停止する
# vboxconfig
vboxdrv.sh: Stopping VirtualBox services.
vboxdrv.sh: Building VirtualBox kernel modules.
This system is currently not set up to build kernel modules.
Please install the gcc make perl packages from your distribution.	★
Please install the Linux kernel "header" files matching the current kernel	★
for adding new hardware support to the system.
The distribution packages containing the headers are probably:
    kernel-devel kernel-devel-2.6.32-696.el6.x86_64
This system is currently not set up to build kernel modules.
Please install the gcc make perl packages from your distribution.
Please install the Linux kernel "header" files matching the current kernel
for adding new hardware support to the system.
The distribution packages containing the headers are probably:
    kernel-devel kernel-devel-2.6.32-696.el6.x86_64

There were problems setting up VirtualBox.  To re-start the set-up process, run
  /sbin/vboxconfig
as root.
 gcc, perl, make, kernel-develをインストール
# yum -y install gcc perl make kernel-devel
 カーネルをアップデートしている場合、再起動(reboot)しないと、やみくもにパッケージをインストールする羽目に。
 カーネルが古い場合は
# yum -y update kernel
 :
# reboot
 vboxconfig に成功する
# vboxconfig
vboxdrv.sh: Stopping VirtualBox services.
vboxdrv.sh: Building VirtualBox kernel modules.
vboxdrv.sh: Starting VirtualBox services.
vboxdrv.sh: Starting VirtualBox services.
 後でリモートメンテする為、拡張パックを取得
# wget https://download.virtualbox.org/virtualbox/5.2.12/Oracle_VM_VirtualBox_Extension_Pack-5.2.12-122591.vbox-extpack
 拡張パックをインストール
# VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-5.2.12-122591.vbox-extpack
 拡張パックの確認
# VBoxManage list extpacks
Extension Packs: 1
Pack no. 0:   Oracle VM VirtualBox Extension Pack
Version:      5.2.12
Revision:     122591
Edition:
Description:  USB 2.0 and USB 3.0 Host Controller, Host Webcam, VirtualBox RDP, PXE ROM, Disk Encryption, NVMe.
VRDE Module:  VBoxVRDP
Usable:       true
Why unusable:
 仮想イメージ(test.ova)インポートの事前確認
# VBoxManage import test.ova --dry-run
 仮想イメージ(test.ova)のインポート
# VBoxManage import test.ova
Successfully imported the appliance.
 ホームディレクトリの"VirtualBox VMs"に仮想サーバの実体
# ll
合計 635376
drwx------. 3 root root      4096  6月 29 10:37 2018 VirtualBox VMs	★
-rw-------. 1 root root      1180  6月 29 08:30 2018 anaconda-ks.cfg
-rw-r--r--. 1 root root     11715  6月 29 08:30 2018 install.log
-rw-r--r--. 1 root root      3384  6月 29 08:29 2018 install.log.syslog
-rw-r--r--. 1 root root 650594304  6月 28 11:44 2018 test.ova
他の環境でエクスポートした仮想イメージをインポート時にネットワークデバイス名が変わる為、確認
# VBoxManage list bridgedifs
Name:            eth0	★
GUID:            30687465-0000-4000-8000-1078d287aacf
DHCP:            Disabled
IPAddress:       192.168.0.29
NetworkMask:     255.255.255.0
IPV6Address:     fe80::1278:d2ff:fe87:aacf
IPV6NetworkMaskPrefixLength: 64
HardwareAddress: 10:78:d2:87:aa:cf
MediumType:      Ethernet
Wireless:        No
Status:          Up
VBoxNetworkName: HostInterfaceNetworking-eth0
 ネットワークデバイス名が異なると起動に失敗する為、上記の名称に変更
# VBoxManage modifyvm test --nic1 bridged --bridgeadapter1 eth0
 Windowsのリモートデスクトップで仮想サーバをモニタすることができる。3389以外のポートを指定
# VBoxManage modifyvm test \
--vrde on \
--vrdeport 33389 \
--vrdeaddress 192.168.0.29 \
--vrdereusecon on
CentOS6ではiptablesで上記のポートに穴を開ける
# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 33389 -j ACCEPT
# service iptables save
iptables: ファイアウォールのルールを /etc/sysconfig/iptable[  OK  ]中:
iptables -L
service iptables restart
 headlessオプションで仮想サーバを起動
# VBoxManage startvm test --type headless
Waiting for VM "test" to power on...
VM "test" has been successfully started.
192.168.0.29:33389 でリモートデスクトップ接続可能。

トラックバック

このエントリーのトラックバックURL:
https://www.remix.asia/cgi/mt/mt-tb.cgi/7679

コメントを投稿

(いままで、ここでコメントしたことがないときは、コメントを表示する前にこのブログのオーナーの承認が必要になることがあります。承認されるまではコメントは表示されません。そのときはしばらく待ってください。)