Infrastructure 2017-10-01

Setting Up a CentOS 6.7 Development Environment with Vagrant

Build a CentOS development environment with Vagrant, VirtualBox networking, and Apache configuration for local projects.

Read in: ja
Setting Up a CentOS 6.7 Development Environment with Vagrant

Overview

Recently, when I rebuilt my Box, I thought, "I should properly document the Vagrant development environment workflow," so I decided to summarize it. There is a similar workflow memo in the repository.

github - bmf-san/vagrant-development-workflow

Prerequisites

The following applications should be installed on the host machine (Mac):

Environment

Host Machine (Mac)

Virtual Environment

Setup Procedure

# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
  # Box Name
  config.vm.box = "centos6.7"

  # Network
  config.vm.network "private_network", ip: "192.168.33.10"

  # Synced Folder
  config.vm.synced_folder "/path/to/directory", "/var/www/html",
    :owner => "apache",
    :group => "apache",
    :mount_options => ["dmode=775,fmode=664"]

  # Provider(Optional)
  config.vm.provider "virtualbox" do |vb|
        vb.customize ["modifyvm", :id, "--paravirtprovider", "kvm"]
  end

  # Host Updater
  config.vm.network :private_network, ip: "192.168.33.10"
  config.vm.hostname = "localdev"
  config.hostsupdater.aliases = ["localdev-hoge"]

  # xdebug(Optional)
  config.vm.network :forwarded_port, host: 3000, guest: 3000
end
<VirtualHost *:80>
  ServerName localdev-hoge
  ServerAdmin localhost
  DocumentRoot /var/www/html/path/to/directory

  <Directory "/var/www/html/path/to/directory">
    AllowOverride All
  </Directory>
</VirtualHost>

Learn More

Tags: apache CentOS Vagrant
Share: 𝕏 Post Facebook Hatena
✏️ View source / Discuss on GitHub
☕ Support

If you enjoy this blog, consider supporting it. Every bit helps keep it running!


Related Articles