VirtualBox虚拟机成功安装Ubuntu18.04,设置共享文件夹总结

电脑上本来是想安装Vmvare14虚拟机,但是无奈总是提示hcmon.sys无法安装。然后,然后就自动回滚没法安装了。这问题着实烦人,网上的方法试过百遍了都无法解决,算了直接放弃。这里总结下经验,希望以后别在这上面折腾了。

发现有更好用的VirtualBox还免费干嘛不用。我的版本是VirtualBox6.1,直接在360软件管家里下载就行。安装完成后可能遇到个问题,没法进入控制台报错了,提示是VBoxDrv.sys驱动无法安装。这时候不要慌,这个问题好解决。进入D:\Program Files\Oracle\VirtualBox\drivers\vboxdrv目录,右键单击VBoxDrv.inf,安装驱动即可。

接下来安装Ubuntu18.04,也建议安装这个版本,挺好用。至少那个关闭的按钮终于改到了右上角,这可真是明智之举。原来的linux系统非要把关闭按钮放在左上角是彰显个性呢还是咋地,着实别扭。

最后设置文件夹共享,发现咋设置都不生效。网上说是要安装扩展包,我也安装了呀,但还是不生效。正当郁闷时,突然来了灵感,会不会是这扩展包安装失败了哟?以往只管傻瓜式操作,日志和提示都木有看过。这次从新安装下扩展包,在命令行下执行./VBoxLinuxAdditions.run。我靠,仔细一看,果然是报错的,压根扩展包没装成功。于是,按照提示,需要装gcc和make。原来自带的是没有装。装之前呢,先替换下Ubuntu的镜像源,要不会让你等的花儿都谢了。

更新镜像源

我配置了阿里的镜像源,如下:

备份:cp /etc/apt/sources.list /etc/apt/sources.list.bak

清空source.list:echo > /etc/apt/sources.list

再将以下源文件复制到/etc/apt/sources.list

可以使用Vi或者gedit打开。

deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse

华为镜像源

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://repo.huaweicloud.com/ubuntu jammy main restricted
# deb-src http://repo.huaweicloud.com/ubuntu jammy main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://repo.huaweicloud.com/ubuntu jammy-updates main restricted
# deb-src http://repo.huaweicloud.com/ubuntu jammy-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://repo.huaweicloud.com/ubuntu jammy universe
# deb-src http://repo.huaweicloud.com/ubuntu jammy universe
deb http://repo.huaweicloud.com/ubuntu jammy-updates universe
# deb-src http://repo.huaweicloud.com/ubuntu jammy-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://repo.huaweicloud.com/ubuntu jammy multiverse
# deb-src http://repo.huaweicloud.com/ubuntu jammy multiverse
deb http://repo.huaweicloud.com/ubuntu jammy-updates multiverse
# deb-src http://repo.huaweicloud.com/ubuntu jammy-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://repo.huaweicloud.com/ubuntu jammy-backports main restricted universe                                                                                                    multiverse
# deb-src http://repo.huaweicloud.com/ubuntu jammy-backports main restricted uni                                                                                                   verse multiverse

deb http://repo.huaweicloud.com/ubuntu jammy-security main restricted
# deb-src http://repo.huaweicloud.com/ubuntu jammy-security main restricted
deb http://repo.huaweicloud.com/ubuntu jammy-security universe
# deb-src http://repo.huaweicloud.com/ubuntu jammy-security universe
deb http://repo.huaweicloud.com/ubuntu jammy-security multiverse
# deb-src http://repo.huaweicloud.com/ubuntu jammy-security multiverse

  

完成设置后重启一下,启动虚拟机,登录Ubuntu,查看下发现已经能够看到共享文件夹啦。

ubuntu18默认依赖库安装

linx@ubuntu:~$ sudo apt-get install libncurses5:i386 libstdc++6:i386 zlib1g:i386 libc6:i386
// 32位兼容依赖库
//使用网络配置工具和 menuconfig 时还需要安装以下库:
linx@ubuntu:~$ sudo apt-get update //更新下载源信息
linx@ubuntu:~$ sudo apt-get install net-tools //网络配置工具

sudo apt-get install lzop // 安装 lzop 工具,用于生成压缩或解压镜像
sudo apt-get install libncurses* // 安装 ncurese 相关库,U-boot 或者内核菜单显示时需要

QT空工程的编译警告屏蔽

在.pro文件下添加

QMAKE_CXXFLAGS+=-Wno-deprecated-copy

重新编译。无warning,完美。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

特立独行的猫a

您的鼓励是我的创作动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值