LoginSignup
0
0

More than 5 years have passed since last update.

今更 vagrantをmacに(LAMP環境で)

Last updated at Posted at 2016-12-05

インストール

インストールされたことを確認

~ ❯❯❯ vagrant -v
Vagrant 1.9.0

Box選び

https://github.com/chef/bento#64-bit
http://www.vagrantbox.es/

Box追加

~ ❯❯❯ vagrant box add centos-6.8 https://atlas.hashicorp.com/bento/boxes/centos-6.8/versions/2.3.0/providers/virtualbox.box
==> box: Box file was not detected as metadata. Adding it directly...
==> box: Adding box 'centos-6.8' (v0) for provider:
    box: Downloading: https://atlas.hashicorp.com/bento/boxes/centos-6.8/versions/2.3.0/providers/virtualbox.box
==> box: Successfully added box 'centos-6.8' (v0) for 'virtualbox'!

Box確認

~ ❯❯❯ vagrant box list
centos-6.8 (virtualbox, 0)

vagrant用のWork Dirを用意〜起動まで

mkdir -p ~/Develop/vagrant
cd ~/Develop/vagrant
vagrant init centos-6.8
vim Vagrantfile
Vagrantfile
 29   config.vm.network "private_network", ip: "192.168.33.10" //コメント外す
sudo vim /etc/hosts
/etc/hosts
192.168.33.10 ore.com
vagrant up

vagrantの中身(LAMP)

sudo su
yum -y update

PHP

yum -y install php php-mbstring php-mysql php-devel  // あ、間違えた
rpm -qa | grep php
rpm -e php-devel-5.3.3-48.el6_8.x86_64... // 全部消す
// php 5.6
rpm -Uvh http://ftp.iij.ad.jp/pub/linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
sudo yum install -y --enablerepo=remi --enablerepo=remi-php56 php php-opcache php-devel php-mbstring php-mcrypt php-mysqlnd php-phpunit-PHPUnit php-pecl-xdebug php-pecl-xhprof

Mysql

yum -y install http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
yum install -y mysql-community-server mysql-community-devel
chkconfig mysqld on
service mysqld start
mysql_secure_installation

Apache

yum -y install vim
yum -y install httpd
chkconfig httpd on
vim /etc/httpd/conf.d/ore.conf
/etc/httpd/conf.d/ore.conf
NameVirtualHost *:80
<Directory "/var/www/html/ore.com">
Options FollowSymLinks
AllowOverride All
</Directory>
<VirtualHost *:80>
ServerAdmin info@ore.com
DocumentRoot /var/www/html/ore.com
ServerName ore.com
ErrorLog /var/log/httpd/ore.com/err.log
CustomLog /var/log/httpd/ore.com/access.log combined env=!no_log
</VirtualHost>
mkdir -p /var/log/httpd/ore.com
mkdir -p /var/www/html/ore.com
echo "<?php phpinfo(); ?>" > /var/www/html/ore.com/index.php

hostname ore.com
vim /etc/hosts
/etc/hosts
127.0.0.1   ore.com localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
vim /etc/httpd/conf/httpd.conf
/etc/httpd/conf/httpd.conf
402 DirectoryIndex index.html index.html.var index.php
service httpd start

下記をクリック👇
http://ore.com

※phpinfo()の出力結果が出たら成功

おしまい

~/D/vagrant ❯❯❯ vagrant halt
==> default: Attempting graceful shutdown of VM...

[参照]
php5.6インストール方法を参照させていただきました。
http://qiita.com/pakiln/items/645e8a97cde46b59f9f8

0
0
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
0
0