目前,我的环境如下: -Windows 7 64位 -无业游民 -虚拟盒子 -Node.js的 -Webdriverio -柴 -鸦片
我想使用流浪汉构建一个数据库服务器(使用mongodb),我将从PC上将其作为客户端进行连接。然后,我可以运行我的脚本在此数据库上创建测试数据。 对于服务器(虚拟机)和客户端(物理机),我只会使用一台PC 。
是否有可能建立这个想法?以及如何实施? 请给我一些建议。
答案 0 :(得分:0)
有些像这样的预装MongoDb的流浪图像 https://app.vagrantup.com/dansweeting/boxes/ubuntu-trusty64-mongo-node
创建一个无业游民的文件 例如:
# created by Andrei Lupuleasa, December 2018.
Vagrant.require_version ">= 2.2.2"
# Automatically installs required plugin on Windows
if Vagrant::Util::Platform.windows?
plugin = 'vagrant-winnfsd'
system "vagrant plugin install #{plugin}" unless Vagrant.has_plugin?(plugin)
end
Vagrant.configure(2) do |config|
config.vm.box = "dansweeting/ubuntu-trusty64-mongo-node" # VM OS version
config.vm.hostname = "vagrantdev"
# set IP and ports
config.vm.network "private_network", ip: "192.168.44.10"
# Sync the sources folder with the machine
# For Windows `nfs` is preferred due to poor performance of default settings.
if Vagrant::Util::Platform.windows?
config.vm.synced_folder "share", "/var/www/html", type: 'nfs'
else
config.vm.synced_folder "share", "/var/www/html", mount_options: ["dmode=777","fmode=777"]
end
# Set to true if you want automatic checks
config.vm.box_check_update = false
# Copy personal private key with access to repository to machine
config.vm.provision "file", source: "~/.ssh/id_rsa", destination: "~/.ssh/id_rsa"
config.vm.provision "file", source: "~/.ssh/id_rsa.pub", destination: "~/.ssh/id_rsa.pub"
end
像这样从cmd到您的流浪文件所在的位置
cd D:\vagrant
并执行vagrant up