Windows 下 使用 Vagrant 来管理 Linux 虚机开发环境(3)

在linux系统下没有root权限是很不舒服的,所以查了下root用户登录的配置,在vagrantfile 中增加配置:

config.ssh.username = 'root' config.ssh.password = 'vagrant' config.ssh.insert_key = 'true'

启动后看到日志 :

D:\vagrant\worker>vagrant up Bringing machine 'default' up with 'virtualbox' provider... ==> default: Clearing any previously set forwarded ports... ==> 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 => 2222 (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: root default: SSH auth method: password default: Warning: Connection timeout. Retrying... default: Warning: Connection timeout. Retrying... ==> default: Machine booted and ready! ==> default: Checking for guest additions in VM... default: The guest additions on this VM do not match the installed version of default: VirtualBox! In most cases this is fine, but in rare cases it can default: prevent things such as shared folders from working properly. If you see default: shared folder errors, please make sure the guest additions within the default: virtual machine match the version of VirtualBox you have installed on default: your host and reload your VM. default: default: Guest Additions Version: 4.3.28 default: VirtualBox Version: 5.0 ==> default: Configuring and enabling network interfaces... ==> default: Mounting shared folders... default: /vagrant => D:/vagrant/dev ==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision` ==> default: flag to force provisioning. Provisioners marked to run always will still run. 3.4 一个vagrantfile 文件管理多台虚机

1、先使用 box 初始化: vagrant init

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/14522.html