Skip to content

Instantly share code, notes, and snippets.

@rnsk
Created January 3, 2014 21:01
Show Gist options
  • Save rnsk/8246522 to your computer and use it in GitHub Desktop.
Save rnsk/8246522 to your computer and use it in GitHub Desktop.
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "centos64"
config.vm.box_url = "http://developer.nrel.gov/downloads/vagrant-boxes/CentOS-6.4-x86_64-v20130731.box"
config.vm.hostname = "dev.example.com"
config.vm.network :private_network, ip: "192.168.33.30"
#config.vm.synced_folder "../", "/share", :nfs => true
config.vm.synced_folder "../", "/share", \
create: true, owner: 'vagrant', group: 'vagrant', \
mount_options: ['dmode=777,fmode=666']
config.vm.provider :virtualbox do |vb|
vb.name = "ruby-test"
vb.gui = true
#vb.customize ["modifyvm", :id, "--memory", 1024]
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
end
config.vm.provision :shell, :inline => <<-EOT
#
# iptables off
#
/sbin/iptables -F
/sbin/service iptables stop
/sbin/chkconfig iptables off
#
# yum repository
#
rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
cp -a /vagrant/epel.repo /etc/yum.repos.d/
#
# ntp
#
yum install -y ntp
/sbin/service ntpd start
/sbin/chkconfig ntpd on
#
# Apache
#
yum install -y httpd-devel mod_ssl git curl-devel
cp -a /vagrant/httpd.conf /etc/httpd/conf/
cp -a /vagrant/virtualhost.conf /etc/httpd/conf.d/
cp -a /vagrant/passenger.conf /etc/httpd/conf.d/
#
# MySQL
#
yum --enablerepo=remi install -y mysql-server mysql-devel
if [ ! -f /etc/my.cnf ]; then
if [ -f /vagrant/my.cnf ]; then
cp -a /vagrant/my.cnf /etc/my.cnf
fi
fi
/sbin/service mysqld start
/usr/bin/mysqladmin -u root password 'password'
/sbin/service mysqld restart
/sbin/chkconfig mysqld on
EOT
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment