【Linux】安装 virtualbox 增强功能
安装 virtualbox 增强功能
参考链接:
VirtualBoX下linux中安装增强功能 01
VirtualBoX下linux中安装增强功能 02
建议:先看完参考链接,再查看后续文章内容
挂载 VBoxLinuxAdditions 镜像
方法1:使用虚拟机自带功能 - 安装增强功能来安装镜像
会自动mount镜像到虚拟机中
方法2:通过寻找iso镜像手动mount
未尝试
本机目录: C:\Program Files\Oracle\VirtualBox\VBoxGuestAdditions.iso
[root@WOM ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_xcdw-lv_root
493G 212G 256G 46% /
tmpfs 4.9G 1.2G 3.7G 25% /dev/shm
/dev/sda1 477M 41M 411M 9% /boot
/dev/mapper/vg_xcdw-lv_home
493G 225G 243G 48% /home
/dev/sr0 56M 56M 0 100% /media/VBox_GAs_5.2.12 # 增强功能镜像
VBoxLinuxAdditions被自动mount到/media/VBox_GAs_5.2.12
复制文件:cp /media/VBox_GAs_5.2.12/VBoxLinuxAdditions.run /tmp/VBoxLinuxAdditions.run
安装前置依赖包
安装 yum install kernel sources kernel-devel gcc -y
等包
[root@WOM ~]# yum install kernel sources kernel-devel gcc -y
已加载插件:fastestmirror, refresh-packagekit, security
设置安装进程
Loading mirror speeds from cached hostfile
* base: mirrors.huaweicloud.com
* epel: ftp.cuhk.edu.hk
* extras: mirrors.huaweicloud.com
* updates: mirrors.shu.edu.cn
No package sources available.
包 gcc-4.4.7-18.el6_9.2.x86_64 已安装并且是最新版本解决依赖关系
--> 执行事务检查
---> Package kernel.x86_64 0:2.6.32-696.28.1.el6 will be 安装
--> 处理依赖关系 kernel-firmware >= 2.6.32-696.28.1.el6,它被软件包 kernel-2.6.32-696.28.1.el6.x86_64 需要
---> Package kernel-devel.x86_64 0:2.6.32-696.28.1.el6 will be 安装
--> 执行事务检查
---> Package kernel-firmware.noarch 0:2.6.32-696.el6 will be 升级
---> Package kernel-firmware.noarch 0:2.6.32-696.28.1.el6 will be an update
--> 完成依赖关系计算
依赖关系解决
===========================================================================================================================================================================================
软件包 架构 版本 仓库 大小
===========================================================================================================================================================================================
正在安装:
kernel x86_64 2.6.32-696.28.1.el6 updates 32 M
kernel-devel x86_64 2.6.32-696.28.1.el6 updates 11 M
为依赖而更新:
kernel-firmware noarch 2.6.32-696.28.1.el6 updates 29 M
事务概要
===========================================================================================================================================================================================
Install 2 Package(s)
Upgrade 1 Package(s)
总下载量:72 M
下载软件包:
(1/3): kernel-2.6.32-696.28.1.el6.x86_64.rpm | 32 MB 00:14
(2/3): kernel-devel-2.6.32-696.28.1.el6.x86_64.rpm | 11 MB 00:16
http://mirrors.shu.edu.cn/centos/6.9/updates/x86_64/Packages/kernel-firmware-2.6.32-696.28.1.el6.noarch.rpm: [Errno 12] Timeout on http://mirrors.shu.edu.cn/centos/6.9/updates/x86_64/Packages/kernel-firmware-2.6.32-696.28.1.el6.noarch.rpm: (28, 'Operation too slow. Less than 1 bytes/sec transfered the last 30 seconds')
尝试其他镜像。
(3/3): kernel-firmware-2.6.32-696.28.1.el6.noarch.rpm | 29 MB 00:43
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
总计 234 kB/s | 72 MB 05:15
运行 rpm_check_debug
执行事务测试
事务测试成功
执行事务
正在升级 : kernel-firmware-2.6.32-696.28.1.el6.noarch 1/4
正在安装 : kernel-2.6.32-696.28.1.el6.x86_64 2/4
正在安装 : kernel-devel-2.6.32-696.28.1.el6.x86_64 3/4
清理 : kernel-firmware-2.6.32-696.el6.noarch 4/4
VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel modules.
Verifying : kernel-firmware-2.6.32-696.28.1.el6.noarch 1/4
Verifying : kernel-devel-2.6.32-696.28.1.el6.x86_64 2/4
Verifying : kernel-2.6.32-696.28.1.el6.x86_64 3/4
Verifying : kernel-firmware-2.6.32-696.el6.noarch 4/4
已安装:
kernel.x86_64 0:2.6.32-696.28.1.el6 kernel-devel.x86_64 0:2.6.32-696.28.1.el6
作为依赖被升级:
kernel-firmware.noarch 0:2.6.32-696.28.1.el6
完毕!
运行镜像安装脚本
目录:/tmp
运行命令sh VBoxLinuxAdditions.run
[root@WOM tmp]# sh VBoxLinuxAdditions.run
Verifying archive integrity... All good.
Uncompressing VirtualBox 5.2.12 Guest Additions for Linux........
VirtualBox Guest Additions installer
Removing installed version 5.2.12 of VirtualBox Guest Additions...
You may need to restart your guest system to finish removing the guest drivers.
Copying additional installer modules ...
Installing additional modules ...
VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel modules.
This system is currently not set up to build kernel modules.
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
VirtualBox Guest Additions: Starting.
VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel modules.
This system is currently not set up to build kernel modules.
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
由上述可知,需要重启系统
重启之前,先配置好共享文件夹
添加共享文件夹
配置完成,效果展示
* 查看 共享盘是否已经mount上去 *
[root@WOM ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_xcdw-lv_root
493G 212G 256G 46% /
tmpfs 4.9G 0 4.9G 0% /dev/shm
/dev/sda1 477M 79M 374M 18% /boot
/dev/mapper/vg_xcdw-lv_home
493G 225G 243G 48% /home
share_file 1.9T 1.7T 128G 94% /media/sf_share_file
发现多了一个盘share_file
文字文件可以在虚拟机和本机互相复制,则配置成功