```123```
```php
echo 123;
```
安装vitualbox软件:
https://download.virtualbox.org/virtualbox/5.2.44/VirtualBox-5.2.44-139111-Win.exe
配置vitualbox
下载centos7.iso镜像, 点击新建, 安装虚拟机系统
设置网络模式为桥接模式
进入终端界面, 修改网卡配置, onboot改为yes并设置为静态网卡(static)
设置resolv.conf, 网关为外层主机所用的网关
重启网络, 使用xshell连接上虚拟机, 测试网络状态
我的静态网卡配置参考:
```bash
# 路径 /etc/sysconfig/network-scripts/ifcfg-enp0s3
# 文件内容
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=enp0s3
UUID=ac6920ed-68fc-4e76-b212-cb8a1c1f59b3
DEVICE=enp0s3
IPADDR=192.168.1.102
GATEWAY=192.168.1.1
NETMASK=255.255.255.0
DNS=8.8.8.8
ONBOOT=yes
```
![](https://www.showdoc.com.cn/server/api/attachment/visitfile/sign/cfe9ac5a4f6ed78d70371e2ed4316bea?showdoc=.jpg)
![](https://www.showdoc.com.cn/server/api/attachment/visitfile/sign/86028535a134c8d0ca4efc64026b8801?showdoc=.jpg)
![](https://www.showdoc.com.cn/server/api/attachment/visitfile/sign/dadfcd89ddea97ef3f3ed9f2744a06a0?showdoc=.jpg)
![](https://www.showdoc.com.cn/server/api/attachment/visitfile/sign/8b7ed21a50ac20999f38b352fcb799cb?showdoc=.jpg)
6. ![](https://www.showdoc.com.cn/server/api/attachment/visitfile/sign/8125b312564ccfac349ee2ad4a8248ff?showdoc=.jpg)
![](https://www.showdoc.com.cn/server/api/attachment/visitfile/sign/3176267fb4b2d0f130ba34eff053a490?showdoc=.jpg)
> 接下来就根据开发需要安装, 不要选最小安装, 不然最基础的服务都没有会非常麻烦
> 以下是我的设置, 仅供参考:
![](https://www.showdoc.com.cn/server/api/attachment/visitfile/sign/2342cdb9a36417b12af7c9c0f5eef0a7?showdoc=.jpg)
![](https://www.showdoc.com.cn/server/api/attachment/visitfile/sign/9afaeca20e0ca83f756c36274ec2f788?showdoc=.jpg)
![](https://www.showdoc.com.cn/server/api/attachment/visitfile/sign/0f16d3ec913cbffab1fd96d5f38e12f7?showdoc=.jpg)
##
下载 http://download.virtualbox.org/virtualbox/5.2.44/VBoxGuestAdditions_5.2.44.iso
配置镜像
![](https://www.showdoc.com.cn/server/api/attachment/visitfile/sign/2a319cb0fee48991900d1c2d51e6c016?showdoc=.jpg)
\# 挂载光盘
sudo mkdir /media/cdrom
sudo mount /dev/cdrom /media/cdrom
find / -name VBoxLinuxAdditions.run
\# 输出/media/cdrom/VBoxLinuxAdditions.run
cp /media/cdrom/VBoxLinuxAdditions.run /home
\# 安装依赖
sudo yum install kernel-devel gcc -y
\# 重启virtualBox
![](https://www.showdoc.com.cn/server/api/attachment/visitfile/sign/94337d7eeb7acfcdd1ad4ebb41db495a?showdoc=.jpg)
cd /home
sh ./VBoxLinuxAdditions.run
mount -t vboxsf www /vb/www
\# 查看共享的默认文件夹(路径是: /media/sf_ + 共享的文件夹名称)
cd /media/sf_www&&ll
![](https://www.showdoc.com.cn/server/api/attachment/visitfile/sign/ba561c4e9ebed0fada60859925612cb2?showdoc=.jpg)
[debug]
mount: unknown filesystem type 'vboxsf'
http://zakelfassi.com/2013/08/29/fix-vagrant-osx-mount-unknown-filesystem-type-vboxsf/
mount: /dev/sr0 写保护,将以只读方式挂载
https://blog.csdn.net/zhangsir001/article/details/102985340
no memory reserved for crash kernel
无法卸载virtualBox, 提示"无法访问您试图使用的功能所在的网络位置的解决办法"
方法1. 找到提示所指的.msi文件
方法2: 找到virtualbox.exe, dos命令执行 virtualbox.exe --extract, 生成msi回到方法1
方法3: 重新下载当前版本的安装包, 安装软件并选择修复功能; 重启电脑后就可以卸载了
记得检查注册表是否有遗留的项, 手动删除
获取virtualbox com对象失败(Failed to Acquire the VirtualBox COM Object)
参考以下文章: https://appuals.com/how-to-fix-the-failed-to-acquire-the-virtualbox-com-object-error/ , 卸载并用管理员身份安装, 得到新的配置文件
C:\Users\Administrator\.VirtualBox\VirtualBox.xml
检查文件, 大小为4k;
重启VB, 报错在C:\Users\hasee.VirtualBox\VirtualBox.xml第一行, 检查该文件大小0k;
复制C:\Users\Administrator.VirtualBox\VirtualBox.xml覆盖C:\Users\hasee.VirtualBox\VirtualBox.xml, 重启VB
正常运行!
开机提示"Broken shared folder!"
修改了/etc/fstab文件就会报错, 把改动的内容全部改回来; 包括空格
Host system reported disk full. VM execution is suspended. You can resume after freeing some space.
查看centos7.vdi文件所在的磁盘, 发现磁盘空间不足, 配置30G的虚拟系统只用了2G
迁移vdi文件到另一个磁盘
https://www.cnblogs.com/xwdreamer/p/3363451.html
UUID {5503e069-85ff-4c81-bac0-86bbe2896f0b} of the medium 'F:\Virtual Machines\centos7\centos7.vdi' does not match the value {83c4db83-0b2d-4308-a742-c8e785cff46a} stored in the media registry ('C:\Users\hasee.VirtualBox\VirtualBox.xml').
找到cenros7.vdi, 修改文件名; 在虚拟机存储设置重新添加虚拟磁盘