virtualBox安装CentOS7

下载并安装VirtualBox

注册系统安装镜像

在VirtualBox的主界面点击左上角的“管理”,然后点击“虚拟介质管理”

创建一个虚拟机

新建虚拟机

点击“工具”之后可以看到“新建”选项,点击后开始新建虚拟机的流程。
名称:这个虚拟机在你的电脑中的名字,可以理解为文件名
文件夹:虚拟机存储位置的父目录,会在这个文件夹里新建一个存储虚拟机的文件夹
类型和版本:选择自己想要安装的虚拟机的种类即可,种类不一致会一些问题

内存大小

一般情况下默认分配的内存大小是让这个系统处于“能用”范畴的内存大小,如果要想“流畅地使用”虚拟机,物理机内存较大的情况下建议多分配一些。

 image-20210129131700510

image-20210129131716155

 

可以选择的虚拟硬盘种类:VDI:VirtualBox的专用的磁盘映像种类,仅可供VirtualBox自己使用
VHD:Microsoft Virtual PC的原生格式(本人了解也不多)
VMDK:VMware的虚拟机磁盘种类,除了可供VMware使用以外,可供市面上大部分常用的虚拟机软件使用
如果没有将此虚拟机转移到别的虚拟机软件中使用的需求的话,使用默认的VDI类型即可。即便是此时选择了VDI类型,之后也可以使用VirtualBox自带的VBoxManager更改磁盘类型以适配别的虚拟机软件。

动态分配和固定分配的优缺点如图所示,需要注意的是“固定大小”不仅直接将创建好的空间完全分配给虚拟硬盘,后续也无法改变这块硬盘的大小,我一般选择动态分配

 

 磁盘大小依照自己要装的系统而定,不要盲目信任软件给出的推荐大小,比如CentOS的推荐大小是8GB,如果是安装Server版那么算是绰绰有余,但若是安装带GUI的完全版,则会因为空间太小而无法安装,所以明确自己要装的系统需要多大的空间也是一件非常重要的事。

image-20210129131746654

常规设置

image-20210129132025514

对于有图形界面的虚拟机一般可以开启“共享粘贴板”和“拖放”这两项设置,便于物理机和虚拟机之间的交互(需要安装增强工具),比如我这里的“Win10”虚拟机,当我开启这两个选项并安装“增强工具”之后,就可以实现物理机与虚拟机之间这种较为便捷的交互。

image-20210129132341342

显示设置

显存大小:与内存的分配原则类似
硬件3D加速:如果物理机配置好的话可以开启,能使虚拟机的画面更为流畅甚至绚丽(若要安装的是只是用CUI的Linux系统,则没必要开启),但物理机配置不够好的情况下会导致双方都卡顿

image-20210129132430852

 启动虚拟机安装

下载网络工具,输入指令:yum install net-tools下载网络工具

错误:

Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
 
 One of the configured repositories failed (Unknown),
 and yum doesn't have enough cached data to continue. At this point the only
 safe thing yum can do is fail. There are a few ways to work "fix" this:
     1. Contact the upstream for the repository and get them to fix the problem.
     2. Reconfigure the baseurl/etc. for the repository, to point to a working
        upstream. This is most often useful if you are using a newer
        distribution release than is supported by the repository (and the
        packages for the previous distribution release still work).
     3. Disable the repository, so yum won't use it by default. Yum will then
        just ignore the repository until you permanently enable it again or use
        --enablerepo for temporary usage:
 
            yum-config-manager --disable <repoid>
 
     4. Configure the failing repository to be skipped, if it is unavailable.
        Note that yum will try to contact the repo. when it runs most commands,
        so will have to try and fail each time (and thus. yum will be be much
        slower). If it is a very temporary problem though, this is often a nice
        compromise:
 
            yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true
 
Cannot find a valid baseurl for repo: base/7/x86_64

报错原因:没有配置网卡。

cd /etc/sysconfig/network-scripts/
ls

vi ifcfg-enp0s3
把ONBOOT=no,改为yes,并保存

 

重启虚拟机,再次运行yum install net-tools,全部输入y

使用ifconfig命令或ip addr查看CentOS的IP

 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值