Search Suggest

Bài đăng

Vagrant Useful commands

Enable Port forwarding in Vagrant
Open Vagrant file and add parameter
$  vim Vagrantfile

config.vm.network "forwarded_port", guest: 80, host: 8080

Reload changes of Vagrant settings
$ vagrant reload

Test port forwarding in Vagrant
Steps 1: Login in to Vagrant machine
 $ vagrant ssh

Steps 2: Install Apache in Vagrant Machine
 $ sudo apt-get install apache2

Access html page of Vagrant Machine
$ curl http://localhost:8080

or from Web Broser
http://localhost:8080


How to mount local directory to vagrant machine
Add below parameter to Vagrant file
$ vim Vagrantfile
config.vm.synced_folder "SRC/", "Dest_Location/"

How to allocate Memory and CPU to Vagrant machine
Write memory parameter between provider line
$ vim Vagrantfile
 config.vm.provider "virtualbox" do |vb|
     vb.memory = "1024"
     v.cpus = 2
   end

Đăng nhận xét