LoginSignup
2
5

More than 5 years have passed since last update.

Vagrantで仮想開発環境を作る(CentOS/LAMP)

Last updated at Posted at 2016-11-25

前提

  • Vagrantの使い方は知ってる
  • LAMP知ってる
  • CentOS

VagrantでVMの起動と接続

1.Vagrant up

Vagrantfile
Vagrant.configure("2") do |config|
  config.vm.box = "bento/centos-7.2"
  config.vm.network "forwarded_port", guest: 80, host: 8080
end

2.vagrant sshsu -

初期パスはvagrant

Apacheインストールとアクセス確認

1.yum -y install httpd そして httpd start

これでhttp://www.example.comにアクセスすればつながるんじゃないの :clap:

:skull_crossbones: 「つながんない」

2.vi /etc/httpd/conf/httpd.conf

httpd.conf
#ServerName www.example.com:80

httpd.conf
ServerName localhost:8080

3. httpd restart

http://localhost:8080/でつながった :tada:

補足: chkconfig httpd on

これで、VM起動時にサーバーも立ち上がってくれるので便利そう

MySqlのインストールと動作確認

1. rpm -ivh htt~~

rpm -ivh http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm

これいまいちわかってない。先にやっとかないといけないらしい。

2. yum install -y mysql-community-server

インストール

3.mysql --version

確認

補足:セットアップ

多分この後接続のためのセットアップしなきゃならんと思う
http://qiita.com/ksugawara61/items/336ffab798e05cae4afc

PHPのインストールと動作確認

1. yum -y install php

2. php -v

これが出て終わり

PHP 5.4.16 (cli) (built: Aug 11 2016 21:24:59)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

引き続く?

2
5
1

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
2
5