System environment description
deepin
System: deepin V20
Platform:x86_64
CentOS
System: CentOS8
Platform:x86_64
Use vagrant
installcentos6
installation virtualbox
deepin V20
sudo apt install virtualbox-6.1
CentOS8
Create a new /etc/yum.repos.d/virtualbox.repo with the content
[virtualbox]
name=Virtualbox Repository
baseurl=https://mirrors.tuna.tsinghua.edu.cn/virtualbox/rpm/el$releasever/
gpgcheck=0
enabled=1
Just refresh the cache and install virtualbox.
sudo yum makecache
sudo yum install VirtualBox-6.1.x86_64
installationvagrant
vagrant
Software download address- installation
# 下载vagrant软件
wget https://releases.hashicorp.com/vagrant/2.2.10/vagrant_2.2.10_linux_amd64.zip
# 解压安装
mkdir ~/App/vagrant
unzip vagrant_2.2.10_linux_amd64.zip -d ~/App/vagrant
# 配置环境变量
echo "export PATH=~/App/vagrant:$PATH" >> ~/.bashrc
# 立即生效环境变量
source ~/.bashrc
# 安装插件
vagrant plugin install --plugin-clean-sources --plugin-source https://gems.ruby-china.com/ vagrant-vbguest
installationcentos6
# 下载centos6镜像
vagrant box add centos6 http://mirrors.ustc.edu.cn/centos-cloud/centos/6/vagrant/x86_64/images/CentOS-6-x86_64-Vagrant-2004_01.VirtualBox.box
# 初始化
vagrant init centos6
# 启动启动
vagrant up
common problem
- Execution
vagrant up
, the following error occurred :
There was an error when attempting to rsync a synced folder.
Please inspect the error message below for more info.
Host path: /home/dev/vagrant/pixiu-yang/
Guest path: /vagrant
Command: "rsync" "--verbose" "--archive" "--delete" "-z" "--copy-links" "--no-owner" "--no-group" "--rsync-path" "sudo rsync" "-e" "ssh -p 2222 -o LogLevel=FATAL -o ControlMaster=auto -o ControlPath=/tmp/vagrant-rsync-20200902-7232-xv4it4 -o ControlPersist=10m -o IdentitiesOnly=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i '/home/dev/vagrant/pixiu-yang/.vagrant/machines/default/virtualbox/private_key'" "--exclude" ".vagrant/" "/home/dev/vagrant/pixiu-yang/" "[email protected]:/vagrant"
Error: Auto configuration failed
139703436113624:error:25066067:DSO support routines:DLFCN_LOAD:could not load the shared library:dso_dlfcn.c:185:filename(libssl_conf.so): libssl_conf.so: cannot open shared object file: No such file or directory
139703436113624:error:25070067:DSO support routines:DSO_load:could not load the shared library:dso_lib.c:244:
139703436113624:error:0E07506E:configuration file routines:MODULE_LOAD_DSO:error loading dso:conf_mod.c:285:module=ssl_conf, path=ssl_conf
139703436113624:error:0E076071:configuration file routines:MODULE_RUN:unknown module name:conf_mod.c:222:module=ssl_conf
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(235) [sender=3.1.3]
Solution :
echo "export OPENSSL_CONF=/etc/ssl" >> ~/.bashrc
source ~/.bashrc
vagrant
Common commands
# 使用ssh登陆vagrant虚拟机系统
vagrant ssh
# 同步vagrant虚拟机与物理机文件
vagrant rsync-auto
# 重新加载虚拟机
vagrant reload
# 销毁镜像
vagrant destroy
# 启动启动
vagrant up
# 关闭虚拟机
vagrant halt
vagrant
Virtual machine image related information
- vagrant mirror default password
默认普通用户名:vagrant
密码:vagrant
默认root用户名:root
密码:vagrant