免费定制logo网站,pvtc2c平台,做个小程序需要花多少钱,能不能用自己的主机做网站文章目录 一、下载Virtualbox和Vagrant1、下载2、安装 二、安装虚拟机1、新建目录D:\VirtualMachine2、执行vagrant init centos/7命令#xff0c;就会在该目录下创建Vagrantfile文件3、执行vagrant up命令4、查看当前主机分给虚拟机的网关网段5、找到D:\VirtualMachine下的Va… 文章目录 一、下载Virtualbox和Vagrant1、下载2、安装 二、安装虚拟机1、新建目录D:\VirtualMachine2、执行vagrant init centos/7命令就会在该目录下创建Vagrantfile文件3、执行vagrant up命令4、查看当前主机分给虚拟机的网关网段5、找到D:\VirtualMachine下的Vagrantfile文件6、重启虚拟机7、测试ssh连接 三、 遇到的问题1、VBoxManage.exe: error: VT-x is disabled in the BIOS for all CPU modes2、vagrant127.0.0.1: Permission denied (publickey,gssapi-keyex,gssapi-with-mic3、SSH用户身份证验证无法选择password 一般虚拟机安装我们可以通过VMWare来安装但是通过VMWare安装经常会碰到网络ip连接问题为了减少额外的环境因素影响可以通过VirtualBox结合Vagrant来安装虚拟机 一、下载Virtualbox和Vagrant
1、下载
Virtualbox下载地址https://www.virtualbox.org/wiki/Downloads Vagrant下载地址https://developer.hashicorp.com/vagrant/downloads?product_intentvagrant
本文下载的版本是Virtualbox7.0.12和Vagrant2.4.0
2、安装
1都是傻瓜式安装一直点确定即可 特殊选型需要的话可以更改下Virtualbox的安装位置 2安装后重启电脑即可 3验证是否安装成功 打开cmd命令窗口输入vagrant 命令弹出如下内容表示 vagrant 安装成功
二、安装虚拟机
1、新建目录D:\VirtualMachine
切换到该目录
2、执行vagrant init centos/7命令就会在该目录下创建Vagrantfile文件
这里其实就是安装了镜像仓库具体可以查看Vagrant镜像仓库https://app.vagrantup.com/boxes/search
3、执行vagrant up命令
第一次执行的时候会去远程下载相关的镜像文件并启动虚拟机 默认安装位置如下
4、查看当前主机分给虚拟机的网关网段
这里的网段为56
5、找到D:\VirtualMachine下的Vagrantfile文件
去掉注释配置ip192.168.56.100
6、重启虚拟机
执行vagrant reload命令
7、测试ssh连接
执行vagrant ssh命令 登录xshell验证输入用户名和密钥文件 切换到root用户sudo su root 修改密码sudo passwd root
[rootlocalhost vagrant]# sudo passwd root
Changing password for user root.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.三、 遇到的问题
1、VBoxManage.exe: error: VT-x is disabled in the BIOS for all CPU modes
D:\VirtualMachinevagrant up
Bringing machine default up with virtualbox provider...default: Importing base box centos/7...default: Matching MAC address for NAT networking...default: Checking if box centos/7 version 2004.01 is up to date...default: Setting the name of the VM: VirtualMachine_default_1698299496463_78949default: Clearing any previously set network interfaces...default: Preparing network interfaces based on configuration...default: Adapter 1: natdefault: Forwarding ports...default: 22 (guest) 2222 (host) (adapter 1)default: Booting VM...
There was an error while executing VBoxManage, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.Command: [startvm, a70cf490-d998-42ad-b3f0-930bca39ef07, --type, headless]Stderr: VBoxManage.exe: error: Not in a hypervisor partition (HVP0) (VERR_NEM_NOT_AVAILABLE).
VBoxManage.exe: error: VT-x is disabled in the BIOS for all CPU modes (VERR_VMX_MSR_ALL_VMX_DISABLED)
VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component ConsoleWrap, interface IConsole原因电脑没开启CPU虚拟化如图 解决重启电脑进入BIOS界面进入“CPU Configuration”找到“Intel Virtual Technology”设置为启用
2、vagrant127.0.0.1: Permission denied (publickey,gssapi-keyex,gssapi-with-mic
网上的方案找到初始化目录下的 private_key 文件右键-属性-安全-高级勾上所有权限我试了没用大家可以试试 最终的解决方案找到D:\VirtualMachine下的Vagrantfile文件配置ip重启即可
3、SSH用户身份证验证无法选择password 修改/etc/ssh/sshd_config的PasswordAuthentication设置为yes 注需要重启虚拟机