#ローカル開発環境の作成(LAMP)


practice_cake

Vagrant と virtualBox でローカル開発環境を作ることはじめ

php7.0
mariadb
centos7
を想定して作るときのメモ書き。

アプリケーションとしては、
vagrant
virtualbox
で作成いたします。

setting php

make git project

echo "# [ project name ]" >> README.md
git init
git add README.md
git remote add origin https://github.com/[ User Name ]/[ Project Name ].git
git push -u origin master

setting on terminal

terminal

project_dir   $ pwd
*/project_dir
project_dir   $ mkdir dev

vagrant setting

Vagrantfile

config.vm.box = "centos/7"
config.vm.network "private_network" ,ip:"192.168.33.10"
config.vm.network "forwarded_port" ,guest: 80 ,host: 8181
config.vm.synced_folder "./dev" , "/vagrant_dev"

on terminal

project_dir $ vagrant up
project_dir $ vagrant ssh

vagrant@localhost $ sudo su -
root@localhost    $ timedatectl set-timezone Asia/Tokyo
root@localhost    $ yum -y install httpd.service
root@localhost    $ systemctl start httpd.service
root@localhost    $ getenforce
    Enforcing
root@localhost    $ setenforce 0
root@localhost    $ cd /etc/selinux
root@localhost    $ vi config
root@localhost    $  yum -y install epel-release.noarch
root@localhost    $ rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
root@localhost    $ rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
root@localhost    $ yum -y install php70.x86_64
root@localhost    $ yum -y install php70-php.x86_64
root@localhost    $ yum -y install php70-php-mysqlnd.x86_64
root@localhost    $ yum -y install mariadb.x86_64 
root@localhost    $ yum -y install mariadb-server.x86_64

/etc/selinux/config

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
# SELINUX=enforced
SELINUX=permissive
# SELINUXTYPE= can take one of three two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected. 
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted