VirtualBox安装Centos6.8虚拟机

0. VirtualBox版本

本安装过程在Win10系统,VirtualBox 6.1.38版本上进行顺利,最终可实现虚拟机桌面可自动随VirtualBox窗口大小调整分辨率,粘贴板双向共享功能正常。但在VirtualBox 7.0.14版本上安装后,粘贴板共享功能无效,需要替换旧版本VBoxGuestAdditions_*.iso增强工具(我用的是VBoxGuestAdditions_6.1.2.iso)才变正常,另外虚拟机桌面无法随窗口大小自动调整分辨率,即使替换旧版增强工具也无效。问题原因不明。

1. 安装虚拟机

选择使用完整硬盘空间,而非替换原有linux系统(此步骤可能非必须,只是我自己的习惯,未测试替换原有系统选项)

2. 更换yum源

/etc/yum.repos.d/CentOS-Base.repo更换成可用版本(目前阿里云的centos-6.10版本可用)

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the 
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-6.10
enabled=1
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
[updates]
name=CentOS-6.10
enabled=1
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
[extras]
name=CentOS-6.10
enabled=1
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
enabled=1
failovermethod=priority
baseurl=http://mirrors.aliyun.com/epel-archive/6/$basearch
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/epel-archive/RPM-GPG-KEY-EPEL-6

3. 安装增强工具

安装增强工具前,需要先更新kernel,并安装kernel-headers,否则会报kernel headers not found for target kernel错误

3.1 安装kernel-headers

依次运行下列命令,非root用户前面需要加sudo

先更新kernel

yum update kernel -y

再安装kernel-hearders

yum install kernel-headers kernel-devel gcc make -y

然后重启

reboot

3.2 安装增强工具

点击VB菜单栏设备-安装增强功能,弹出的窗口可直接叉掉

在这里插入图片描述

桌面出现VBox-GAs-6.1.38,双击该图标,打开相应文件夹

在这里插入图片描述

在该文件夹内右键,选择open in terminal唤起终端,切换至root账户,运行./VBoxLinuxAdditions.run,等待安装完成。

3.3 设置虚拟机自适应窗口大小调整分辨率

增强工具安装完成后,reboot

再次进入系统后,点击VB菜单栏视图-自动调整显示尺寸,先取消勾选,再点一次重新勾选,此时虚拟机界面应该可以自适应至VB窗口大小。

在这里插入图片描述

3.4 设置共享文件夹

设置共享文件夹前或后,需要给非root用户添加共享文件读写权限,运行

sudo usermod -aG vboxsf $(whoami)
reboot

重新进入系统后,共享文件夹设置的共享文件夹即可使用

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值