markdown Vagrant Apache2 / PHP5 / MySQL
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown Vagrant Apache2 / PHP5 / MySQL相关的知识,希望对你有一定的参考价值。
#!/usr/bin/env bash
info "Update OS software"
echo "deb http://ftp.ru.debian.org/debian/ wheezy main contrib non-free" >> /etc/apt/sources.list
echo "deb-src http://ftp.ru.debian.org/debian/ wheezy main contrib non-free" >> /etc/apt/sources.list
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get upgrade -y
info "Install LAMP"
apt-get install -y php5 php5-intl php5-mysqlnd php5-gd unzip
info "Prepare root password for MySQL"
debconf-set-selections <<< "mysql-community-server mysql-community-server/root-pass password \"''\""
debconf-set-selections <<< "mysql-community-server mysql-community-server/re-root-pass password \"''\""
echo "Done!"
apt-get install -y mysql-server-5.5 mysql-client mysql-common
apt-get install -y apache2
if ! [ -L /var/www ]; then
rm -rf /var/www
ln -fs /app /var/www
fi
/etc/init.d/apache2 stop
sed -i "s/.*APACHE_RUN_USER.*/export APACHE_RUN_USER=vagrant/" /etc/apache2/envvars
sed -i "s/.*APACHE_RUN_GROUP.*/export APACHE_RUN_GROUP=vagrant/" /etc/apache2/envvars
chown vagrant /var/lock/apache2
/etc/init.d/apache2 start
info "Configure MySQL"
sed -i "s/.*bind-address.*/bind-address = 0.0.0.0/" /etc/mysql/my.cnf
mysql -uroot <<< "GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost'"
mysql -uroot <<< "FLUSH PRIVILEGES"
echo "Done!"
info "Initailize databases for MySQL"
mysql -uroot <<< "CREATE DATABASE aw"
mysql -uroot <<< "CREATE DATABASE aw_test"
echo "Done!"
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
# Образ
config.vm.box = "debian/wheezy64"
config.vm.provider 'virtualbox' do |vb|
# machine cpus count
vb.cpus = 1
# machine memory size
vb.memory = 512
# machine name (for VirtualBox UI)
vb.name = "Virtual Machine"
end
# Запускается при установке
config.vm.provision :shell, path: "./vagrant/bootstrap.sh"
# Port forwarding
config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"
# Local IP
config.vm.network "private_network", ip: "192.168.33.10"
# Синхронизация папки
config.vm.synced_folder '.', '/app', owner: 'vagrant', group: 'vagrant'
config.vm.synced_folder '.', '/vagrant', disabled: true
end
`vagrant init `
`vagrant box add "образ"`
Образы тут https://vagrantcloud.com/boxes/search
以上是关于markdown Vagrant Apache2 / PHP5 / MySQL的主要内容,如果未能解决你的问题,请参考以下文章
markdown [Vagrant] Fedora #linux上的Vagrant和Virtualbox安装
使用 Vagrant 访问日志文件夹
markdown vagrant仮想マシン操作
markdown Magento - Vagrant - Vhost
markdown Magento - Vagrant - Vhost
markdown 使用PHPStorm,Vagrant配置Xdebug