程序安装:安装顺序
1、下载并安装virtualbox
https://www.virtualbox.org/wiki/Downloads
下载并安装vagrant
2、https://www.vagrantup.com/downloads.html
vagrant box add <boxName> <boxFilePath>中
<boxName>为自己指定的box名字(默认为base)
<boxFilePath>为下载的box文件本地路径
启动步骤:
一、vagrant box add ubuntu1804 D:\SelfInfo\ubuntu1804.box
vagrant box list
二、vagrant init ubuntu1804
删除box:vagrant box remove <boxName>
三、vagrant up
四、vagrant ssh
问题总结:
安装时遇到:
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.
Command: ["startvm", "a8c7eeee-6ac9-467a-89bd-3615887f20d6", "--type", "headless"]
Stderr: VBoxManage.exe: error: RawFile#0 failed to create the raw output file D:/proj/vm/ubuntu/ubuntu-bionic-18.04-cloudimg-console.log (VERR_PATH_NOT_FOUND)
VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component ConsoleWrap, interface IConsole
增加日志打印目录后重新执行vagrant up 后出现其他异常:
default: Warning: Authentication failure. Retrying......
配置文件修改明码后报异常:
config.ssh.username = "vagrant"
config.ssh.password = "vagrant"
然后使用 vagrant reload
default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
default: flag to force provisioning. Provisioners marked to run always will still run.
jenkins下载
wget http://mirrors.jenkins.io/war/latest/jenkins.war
vagrant ssh 登录提示无权限:
第一种是通过配置vagrantfile改成输入密码登录,我配置了几次,还是登不进去。
第二种是说让通过远程ssh工具(如xshel,putty等)使用:用户名:vagrant,密码:vagrant(系统默认的密码)的方式进入虚拟机修改密钥,就能实现vagrant ssh登录。但我尝试好多次,根本无法使用远程工具+密码登录的方式连接虚拟机,应该是虚拟机默认权限不支持导致的。
#无法进入虚拟机,就更不要谈修改里面的配置文件了。
## 下面说一下我的解决办法:
第一步.通过virtual Box + 用户名:vagrant,密码:vagrant的方式进入虚拟机。
既然vagrant ssh和远程登录都是权限不够,那我直接使用虚拟机本机登录总可以吧,成功登录!
第二步.需要修改虚拟机 /etc/ssh/sshd_config文件,注释 PasswordAuthentication no 这一行,或者将no该为yes也可以。
第三步.重启虚拟机 vagrant reload ,然后在使用 vagrant ssh 就可以了。
## 这个方法我没有去配置密钥,发现也可以登录。大家如果发现还是无法使用vagrant ssh命令,可以自行配置密钥,百度搜索vagrant如何配置密钥即可。
https://blog.youkuaiyun.com/aichirourou_66/article/details/84331407
https://docker_practice.gitee.io/install/mirror.html