LoginSignup
6
6

More than 5 years have passed since last update.

vagrant up が遅い問題を解決した方法【KUSANAGI for Vagrant】

Last updated at Posted at 2018-11-08

概要

  • KUSANAGI for Vagrant マニュアルを参考に Vagrant と VirtualBox で KUSANAGI の開発環境の構築中に発生した問題の解決方法です
  • vagrant up 後 ==> default: Machine booted and ready! で小一時間止まりました
  • 原因はゲスト OS から名前解決に失敗していることでした
  • Vagrantfile の config.vm.provider :virtualbox do |vb| ~ end 内に vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"] を追記したりパソコンを再起動したりしたところ解決しました

環境

  • MacBook Pro (Retina, 15-inch, Mid 2015)
  • macOS Mojave
  • Vagrant 2.2.0
  • VirtualBox 5.2.20

Vagrantfile

  • config.vm.synced_folder は変更して欲しいんですが、コピペで動作するかもしれません
  # `vagrant box outdated`. This is not recommended.
  # config.vm.box_check_update = false

  # Create a forwarded port mapping which allows access to a specific port
  # within the machine from a port on the host machine. In the example below,
  # accessing "localhost:8080" will access port 80 on the guest machine.
  # NOTE: This will enable public access to the opened port
  config.vm.network "forwarded_port", guest: 22, host: 12222, id: "ssh"

  # Create a forwarded port mapping which allows access to a specific port
  # within the machine from a port on the host machine and only allow access
  # via 127.0.0.1 to disable public access
  # config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"

  # Create a private network, which allows host-only access to the machine
  # using a specific IP.
  config.vm.network "private_network", ip: "192.168.33.10"

  # Create a public network, which generally matched to bridged network.
  # Bridged networks make the machine appear as another physical device on
  # your network.
  # config.vm.network "public_network"

  # Share an additional folder to the guest VM. The first argument is
  # the path on the host to the actual folder. The second argument is
  # the path on the guest to mount the folder. And the optional third
  # argument is a set of non-required options.
  config.vm.synced_folder "/Users/username/kusanagi/repository/wp-content", "/home/kusanagi/FQDN/DocumentRoot/wp-content",
    owner: "httpd", group: "www"

  # Provider-specific configuration so you can fine-tune various
  # backing providers for Vagrant. These expose provider-specific options.
  # Example for VirtualBox:
  #
  config.vm.provider "virtualbox" do |vb|
      vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
      vb.gui = false
      vb.memory = "2048"
  end
  #
  # View the documentation for the provider you are using for more
  # information on available options.

  # Enable provisioning with a shell script. Additional provisioners such as
  # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
  # documentation for more information about their specific syntax and use.
  # config.vm.provision "shell", inline: <<-SHELL
  #   apt-get update
  #   apt-get install -y apache2
  # SHELL
end

当該問題を解決した記述

  config.vm.provider "virtualbox" do |vb|
      vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
      vb.gui = false
      vb.memory = "2048"
  end
6
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
6