$ vagrant box add centos7 CentOS-7-x86_64-Vagrant-1907_01.VirtualBox.box ==> box: Box file was not detected as metadata. Adding it directly... ==> box: Adding box 'centos7' (v0) for provider: box: Unpacking necessary files from: file://E:/work/box/CentOS-7-x86_64-Vagrant-1907_01.VirtualBox.box box: ==> box: Successfully added box 'centos7' (v0) for 'virtualbox'!
box 初始化
新建一个目录,用来保存虚拟机配置文件,以后的操作都是在这里进行了,我这里是E:/work/box/
1
$ vagrant init
示例:
1 2 3 4 5
$ vagrant init A `Vagrantfile` has been placed in this directory. You are now ready to `vagrant up` your first virtual environment! Please read the comments in the Vagrantfile as well as documentation on `vagrantup.com` for more information on using Vagrant.
$ vagrant up Bringing machine 'default' up with 'virtualbox' provider... ==> default: Importing base box 'centos7'... ==> default: Matching MAC address for NAT networking... ==> default: Setting the name of the VM: box_default_1566287914381_38916 ==> default: Clearing any previously set network interfaces... ==> default: Preparing network interfaces based on configuration... default: Adapter 1: nat default: Adapter 2: hostonly ==> default: Forwarding ports... default: 22 (guest) => 2222 (host) (adapter 1) ==> default: Booting VM... ==> default: Waiting for machine to boot. This may take a few minutes... default: SSH address: 127.0.0.1:2222 default: SSH username: vagrant default: SSH auth method: private key default: default: Vagrant insecure key detected. Vagrant will automatically replace default: this with a newly generated keypair for better security. default: default: Inserting generated public key within guest... default: Removing insecure key from the guest if it's present... default: Key inserted! Disconnecting and reconnecting using new SSH key... ==> default: Machine booted and ready! ==> default: Checking for guest additions in VM... default: No guest additions were detected on the base box for this VM! Guest default: additions are required for forwarded ports, shared folders, host only default: networking, and more. If SSH fails on this machine, please install default: the guest additions and repackage the box to continue. default: default: This is not an error message; everything may continue to work properly, default: in which case you may ignore this message. ==> default: Configuring and enabling network interfaces... default: SSH address: 127.0.0.1:2222 default: SSH username: vagrant default: SSH auth method: private key ==> default: Rsyncing folder: /cygdrive/e/work/box/ => /vagrant ==> default: Mounting shared folders... default: /home/wwwroot => E:/work/www Vagrant was unable to mount VirtualBox shared folders. This is usually because the filesystem "vboxsf" is not available. This filesystem is made available via the VirtualBox Guest Additions and kernel module. Please verify that these guest additions are properly installed in the guest. This is not a bug in Vagrant and is usually caused by a faulty Vagrant box. For context, the command attempted was:
mount -t vboxsf -o uid=1000,gid=1000 home_wwwroot /home/wwwroot
The error output from the command was:
mount: unknown filesystem type 'vboxsf'
好像看到不得了的东西,出问题了!!!
不要慌,问题不大
打开浏览器
飞快的键入问题”mount: unknown filesystem type ‘vboxsf”
回车,会发现原来有很多人跟咱们一样,哈哈哈,心理平衡了
解决 mount: unknown filesystem type ‘vboxsf’
其实就是缺少了挂载插件,装上就好了
1、我们先关闭虚拟机
1 2
$ vagrant halt ==> default: Attempting graceful shutdown of VM...
2、安装插件
1 2 3
$ vagrant plugin install vagrant-vbguest Installing the 'vagrant-vbguest' plugin. This can take a few minutes... Installed the plugin 'vagrant-vbguest (0.19.0)'!
$ ssh -p 2222 root@127.0.0.1 The authenticity of host '[127.0.0.1]:2222 ([127.0.0.1]:2222)' can't be established. ECDSA key fingerprint is SHA256:sLcP3X75TMzTjmeolLXX7BqpD+Psrq6vU7haTYyM//4. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '[127.0.0.1]:2222' (ECDSA) to the list of known hosts. root@127.0.0.1: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
Starting Bt-Panel... Bt-Panel (pid 3757 3776) already running Starting Bt-Tasks... Bt-Tasks (pid 3790) already running ================================================================== Congratulations! Installed successfully! ================================================================== Bt-Panel: http://116.18.22.120:8888/0dafbc37 username: c0ryrxbk password: fde1ff6a Warning: If you cannot access the panel, release the following port (8888|888|80|443|20|21) in the security group ================================================================== Time consumed: 2 Minute!
config.vm.provider "virtualbox" do |vb| # # Display the VirtualBox GUI when booting the machine # vb.gui = true # # # Customize the amount of memory on the VM: # vb.memory = "1024" vb.memory = "2048" end