{"id":15080,"date":"2013-11-11T08:00:15","date_gmt":"2013-11-10T23:00:15","guid":{"rendered":"http:\/\/www.sssg.org\/blogs\/hiro345\/?p=15080"},"modified":"2014-03-22T13:50:15","modified_gmt":"2014-03-22T04:50:15","slug":"centos%e3%81%abcakephp2%e3%81%ae%e7%92%b0%e5%a2%83%e3%82%92%e7%94%a8%e6%84%8f%e3%81%97%e3%81%9fvagrant-box","status":"publish","type":"post","link":"https:\/\/www.hiro345.net\/blogs\/hiro345\/archives\/15080.html","title":{"rendered":"CentOS6\u306bCakePHP2\u306e\u74b0\u5883\u3092\u7528\u610f\u3057\u305fVagrant Box"},"content":{"rendered":"<p>\uff0a 2014\/02\/21\u306bBox\u30d5\u30a1\u30a4\u30eb\u3092\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>CentOS\u306bCakePHP2\u306e\u74b0\u5883\u3092\u7528\u610f\u3057\u305fVagrant Box\u3092\u4f5c\u6210\u3057\u3066\u307f\u307e\u3057\u305f\u3002CakePHP2\u306e\u958b\u767a\u3084\u304a\u8a66\u3057\u306b\u4f7f\u3048\u308b\u3082\u306e\u3067\u3059\u3002\u300c<a href=\"http:\/\/202.133.112.84\/cent6-cakephp2.box\">http:\/\/202.133.112.84\/cent6-cakephp2.box<\/a>\u300d\u304b\u3089\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3067\u304d\u307e\u3059\u3002\u826f\u304b\u3063\u305f\u3089\u3001\u4f7f\u3063\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002\u958b\u767a\u7528\u306a\u306e\u3067\u3042\u3057\u304b\u3089\u305a\u3002Vagrant\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u3044\u308c\u3070\u3001\u4e0b\u8a18\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3060\u3051\u3067CakePHP2\u306e\u74b0\u5883\u304c\u624b\u306b\u5165\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; gutter: true\">\r\n$ mkdir -p ~\/workspace\/vagrant\/cent6-cakephp2\r\n$ vagrant box add cent6-cakephp2 http:\/\/202.133.112.84\/cent6-cakephp2.box\r\n$ cd ~\/workspace\/vagrant\/cent6-cakephp2\r\n$ vagrant init cent6-cakephp2\r\n$ vagrant up\r\n<\/pre>\n<p><strong>\u30e9\u30a4\u30bb\u30f3\u30b9\u306b\u3064\u3044\u3066<\/strong><br \/>\nCentOS\u306e\u5229\u7528\u30e9\u30a4\u30bb\u30f3\u30b9\u3001EPEL\u30ea\u30dd\u30b8\u30c8\u30ea\u3001remi\u30ea\u30dd\u30b8\u30c8\u30ea\u306e\u5229\u7528\u30e9\u30a4\u30bb\u30f3\u30b9\u306b\u540c\u610f\u304c\u5fc5\u8981\u3067\u3059\u3002\u307e\u305f\u3001Apache\u3001MySQL\u3001PHP\u3001CakePHP\u3001VirtualBox\u306eGuest Addition\u3001\u3053\u308c\u3089\u306e\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u306e\u5229\u7528\u30e9\u30a4\u30bb\u30f3\u30b9\u306b\u540c\u610f\u3067\u304d\u308b\u4eba\u3060\u3051\u3001\u5229\u7528\u3092\u3057\u3066\u304f\u3060\u3055\u3044\u3002GNU Public License v2\u3001PHP\u30e9\u30a4\u30bb\u30f3\u30b9\u3001Apache\u30e9\u30a4\u30bb\u30f3\u30b9\u3001<a href=\"https:\/\/www.virtualbox.org\/wiki\/VirtualBox_PUEL\">VirtualBox_PUEL \u2013 Oracle VM VirtualBox<\/a>\u306e\u30e9\u30a4\u30bb\u30f3\u30b9\u306b\u540c\u610f\u304c\u5fc5\u8981\u3067\u3059\u3002\u5927\u96d1\u628a\u306b\u3044\u3046\u3068\u3001\u500b\u4eba\u7528\u9014\u3001\u8a55\u4fa1\u7528\u9014\u3067\u3042\u308c\u3070\u4f7f\u3048\u308b\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u3002<\/p>\n<p><!--more--><br \/>\n<strong>\u30db\u30b9\u30c8\u30aa\u30f3\u30ea\u30fc\u30cd\u30c3\u30c8\u30ef\u30fc\u30af<\/strong><br \/>\n\u30db\u30b9\u30c8\u30aa\u30f3\u30ea\u30fc\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u3068\u3057\u3066192.168.91.10\u3092\u4f7f\u3044\u307e\u3059\u3002\u3059\u3067\u306b\u4f7f\u3063\u3066\u3044\u308b\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u3068\u3076\u3064\u304b\u308b\u5834\u5408\u306f\u8abf\u6574\u3092\u3057\u3066\u304f\u3060\u3055\u3044($HOME\/.vagrand.d\/\u306b\u3053\u306eBox\u7528 _Vagrantfile \u304c\u3042\u308b\u306f\u305a\u306a\u306e\u3067\u3001\u305d\u3061\u3089\u3082\u4fee\u6b63\u304c\u5fc5\u8981\u306b\u306a\u308b\u306f\u305a\u3067\u3059)\u3002Vagrant\u306b\u3088\u308b\u30db\u30b9\u30c8\u30aa\u30f3\u30ea\u30fc\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306e\u8ffd\u52a0\u304c\u3046\u307e\u304f\u3044\u304b\u306a\u3044\u5834\u5408\u306f\u3001VirtualBox\u306e\u74b0\u5883\u8a2d\u5b9a\u3092\u958b\u3044\u3066\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306e\u9805\u76ee\u3067\u30db\u30b9\u30c8\u30aa\u30f3\u30ea\u30fc\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u3092\u8ffd\u52a0\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u307e\u305a\u306f\u3001IP v4\u306b\u306f192.168.91.1\u3001IP v4\u306e\u30cd\u30c3\u30c8\u30de\u30b9\u30af\u306b\u306f255.255.255.0\u3092\u6307\u5b9a\u3057\u305f\u3082\u306e\u3092\u7528\u610f\u3057\u3066\u304f\u3060\u3055\u3044\uff08192.168.91.1 \u3067\u3042\u3063\u3066\u3001192.168.91.10 \u3067\u306f\u306a\u3044\u306e\u3067\u6c17\u3092\u3064\u3051\u3066\u304f\u3060\u3055\u3044\uff09\u3002<\/p>\n<p><strong>ssh\u30a2\u30ab\u30a6\u30f3\u30c8<\/strong><br \/>\nveewee\u3092\u4f7f\u3063\u3066\u30d9\u30fc\u30b9\u3068\u306a\u308bBox\u3092CentOS6.4 minimal\u306eDVD\u30a4\u30e1\u30fc\u30b8\u304b\u3089\u4f5c\u6210\u3057\u307e\u3057\u305f\u3002\u305d\u3053\u3078groupinstall\u3067\u30c7\u30b9\u30af\u30c8\u30c3\u30d7\u3084\u65e5\u672c\u8a9e\u30b5\u30dd\u30fc\u30c8\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u8ffd\u52a0\u3057\u3066\u3042\u308a\u307e\u3059\u3002\u30a2\u30ab\u30a6\u30f3\u30c8\u306f\u3001vagrant\u30a2\u30ab\u30a6\u30f3\u30c8\u3092\u7528\u610f\u3057\u3066\u3042\u308a\u307e\u3059\u3002\u30d1\u30b9\u30ef\u30fc\u30c9\u306f\u30a2\u30ab\u30a6\u30f3\u30c8\u540d\u3068\u540c\u3058\u3067\u3059\u3002\u3053\u306e\u30a2\u30ab\u30a6\u30f3\u30c8\u306fsudo\u6a29\u9650\u3082\u6240\u6709\u3057\u3066\u3044\u307e\u3059\u3002ssh\u306f\u30db\u30b9\u30c8\u306e2222\u756a\u30dd\u30fc\u30c8\u3092\u30dd\u30fc\u30c8\u30d5\u30a9\u30ef\u30fc\u30c9\u3057\u3066\u4eee\u60f3\u30de\u30b7\u30f3\u306e22\u756a\u30dd\u30fc\u30c8\u3078\u3064\u306a\u3052\u308b\u3088\u3046\u306b\u8d77\u52d5\u3057\u3066\u3044\u307e\u3059\uff08\u8907\u6570\u306evagrant box\u3092\u5229\u7528\u3057\u3066\u3044\u308b\u5834\u5408\u306fvagrant\u304c\u8abf\u6574\u3059\u308b\u4e8b\u3082\u3042\u308b\u3088\u3046\u3067\u3059\u3002vagrant ssh\u3067\u30ed\u30b0\u30a4\u30f3\u3059\u308b\u306e\u304c\u78ba\u5b9f\u3067\u3057\u3087\u3046\uff09\u3002<\/p>\n<p>vagrant ssh\u3092\u4f7f\u3046\u5834\u5408\u306f\u3001Vagrantfile\u304c\u3042\u308b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3067\u4e0b\u8a18\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; gutter: true\">\r\n$ vagrant ssh\r\n<\/pre>\n<p>\u666e\u901a\u306bssh\u30b3\u30de\u30f3\u30c9\u3067\u63a5\u7d9a\u3059\u308b\u65b9\u6cd5\u3082\u3042\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; gutter: true\">\r\n$ ssh -l vagrant -p 2222 localhost\r\n<\/pre>\n<p>\u516c\u958b\u9375\u3092\u4f7f\u3046\u5834\u5408\u306f\u3001\u300c\u30d1\u30b9\u30d5\u30ec\u30fc\u30ba\u306a\u3057\u300d\u306e\u79d8\u5bc6\u9375\u304c\u3001\u30db\u30fc\u30e0\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e .vagrant.d\/insecure_private_key \u306b\u3042\u308a\u307e\u3059\u304b\u3089\u3001\u305d\u308c\u3092\u6307\u5b9a\u3057\u3066\u63a5\u7d9a\u3057\u3066\u3082\u826f\u3044\u3067\u3057\u3087\u3046\u3002\u3088\u304f\u308f\u304b\u3089\u306a\u3044\u5834\u5408\u306f\u30d1\u30b9\u30ef\u30fc\u30c9\u3067\u63a5\u7d9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><strong>Apache<\/strong><br \/>\n\/etc\/httpd\/conf\/httpd.conf \u306e\u6700\u5f8c\u306b\u4e0b\u8a18\u3092\u8ffd\u52a0\u3057\u3066\u3001192.168.91.10:80 \u306e\u30d0\u30fc\u30c1\u30e3\u30eb\u30db\u30b9\u30c8\u3092\u8ffd\u52a0\u3057\u3066\u3042\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; gutter: true\">\r\nNameVirtualHost 192.168.91.10:80\r\n&lt;VirtualHost 192.168.91.10:80&gt;\r\n  DocumentRoot \/vagrant\/www\/192.168.91.10\/webroot\r\n  ServerName 192.168.91.10\r\n  ErrorLog logs\/192.168.91.10-error_log\r\n  CustomLog logs\/192.168.91.10-access_log common\r\n  &lt;Directory \/vagrant\/www\/192.168.91.10\/webroot&gt;\r\n    AllowOverride All\r\n  &lt;\/Directory&gt;\r\n  &lt;Location \/&gt;\r\n    Options Indexes FollowSymLinks\r\n    Order allow,deny\r\n    Allow from all\r\n  &lt;\/Location&gt;\r\n&lt;\/VirtualHost&gt;\r\n<\/pre>\n<p>Vagrantfile\u304c\u3042\u308b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306f\u5171\u6709\u30d5\u30a9\u30eb\u30bf\u3099\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002\u305d\u3053\u3078www\/192.168.91.10\/webroot\/\u3092\u4f5c\u6210\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u3053\u3053\u304c\u3001http:\/\/192.168.91.10\/ \u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u30eb\u30fc\u30c8\u3068\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p><strong>\u30b5\u30f3\u30d7\u30ebCakePHP2\u30a2\u30d7\u30ea<\/strong><br \/>\n\u30b5\u30f3\u30d7\u30ebCakePHP2\u30a2\u30d7\u30ea\u7528\u306b\u306f\u4e0b\u8a18\u8a2d\u5b9a\u3092\/etc\/httpd\/conf.d\/cakephp.conf\u306b\u3057\u3066\u3042\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; gutter: true\">\r\nAlias \/cakephp2_apps\/user_app \/var\/www\/cakephp2_apps\/cakephp-2.4.2_apps\/user_app\/app\/webroot\r\n&lt;Directory \/var\/www\/cakephp2_apps\/cakephp-2.4.2_apps\/user_app\/app\/webroot&gt;\r\n    AllowOverride All\r\n&lt;\/Directory&gt;\r\n&lt;Location \/cakephp2_apps\/user_app&gt;\r\n    Options Indexes FollowSymLinks\r\n    Order allow,deny\r\n    Allow from all\r\n&lt;\/Location&gt;\r\n<\/pre>\n<p>\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u898b\u3066\u308f\u304b\u308b\u3088\u3046\u306b\u3001\/var\/www\/cakephp2_apps\/cakephp-2.4.2_apps\/user_app \u304c\u5b9f\u4f53\u3067\u3059\u3002Web\u30d6\u30e9\u30a6\u30b6\u304b\u3089\u306f\u4e0b\u8a18\u3067\u63a5\u7d9a\u3067\u304d\u307e\u3059\u3002CakePHP2\u306ecake bake\u30b3\u30de\u30f3\u30c9\u3067user_app\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306eusers\u30c6\u30fc\u30d6\u30eb\u304b\u3089\u81ea\u52d5\u751f\u6210\u3057\u3066\u3042\u308a\u307e\u3059\u3002<\/p>\n<ul>\n<li>http:\/\/192.168.91.10\/cakephp2_apps\/user_app\/<\/li>\n<li>http:\/\/192.168.91.10\/cakephp2_apps\/user_app\/users\/<\/li>\n<\/ul>\n<p><strong>MySQL<\/strong><br \/>\nMySQL\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u7ba1\u7406\u3092\u3059\u308b\u306b\u306f\u3001vagrant ssh\u3067\u30de\u30b7\u30f3\u3078\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u3001MySQL\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u7ba1\u7406\u8005\u30a2\u30ab\u30a6\u30f3\u30c8root\u3067\u30d1\u30b9\u30ef\u30fc\u30c9\u300c\u306a\u3057\u300d\u3067\u30ed\u30b0\u30a4\u30f3\u3057\u307e\u3059\u3002user_app\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306busers\u30c6\u30fc\u30d6\u30eb\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; gutter: true\">\r\n$ mysql -u root \r\nWelcome to the MySQL monitor.  Commands end with ; or \\g.\r\nYour MySQL connection id is 4\r\nServer version: 5.5.34 MySQL Community Server (GPL) by Remi\r\n\r\nCopyright (c) 2000, 2013, Oracle and\/or its affiliates. All rights reserved.\r\n\r\nOracle is a registered trademark of Oracle Corporation and\/or its\r\naffiliates. Other names may be trademarks of their respective\r\nowners.\r\n\r\nType &#039;help;&#039; or &#039;\\h&#039; for help. Type &#039;\\c&#039; to clear the current input statement.\r\n\r\nmysql&gt; show databases;\r\n+--------------------+\r\n| Database           |\r\n+--------------------+\r\n| information_schema |\r\n| mysql              |\r\n| performance_schema |\r\n| test               |\r\n| user_app           |\r\n+--------------------+\r\n5 rows in set (0.05 sec)\r\n\r\nmysql&gt; use user_app;\r\nReading table information for completion of table and column names\r\nYou can turn off this feature to get a quicker startup with -A\r\n\r\nDatabase changed\r\nmysql&gt; show tables;\r\n+--------------------+\r\n| Tables_in_user_app |\r\n+--------------------+\r\n| users              |\r\n+--------------------+\r\n1 row in set (0.00 sec)\r\n\r\nmysql&gt; desc users;\r\n+----------+----------+------+-----+---------+----------------+\r\n| Field    | Type     | Null | Key | Default | Extra          |\r\n+----------+----------+------+-----+---------+----------------+\r\n| id       | int(11)  | NO   | PRI | NULL    | auto_increment |\r\n| username | tinytext | NO   |     | NULL    |                |\r\n| password | tinytext | NO   |     | NULL    |                |\r\n+----------+----------+------+-----+---------+----------------+\r\n3 rows in set (0.03 sec)\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\uff0a 2014\/02\/21\u306bBox\u30d5\u30a1\u30a4\u30eb\u3092\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u3057\u307e\u3057\u305f\u3002 CentOS\u306bCakePHP2\u306e\u74b0\u5883\u3092\u7528\u610f\u3057\u305fVagrant Box\u3092\u4f5c\u6210\u3057\u3066\u307f\u307e\u3057\u305f\u3002CakePHP2\u306e\u958b\u767a\u3084\u304a\u8a66\u3057\u306b\u4f7f\u3048\u308b\u3082\u306e\u3067\u3059\u3002\u300chttp:\/\/2 &hellip; <a href=\"https:\/\/www.hiro345.net\/blogs\/hiro345\/archives\/15080.html\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[888,26,907,282],"class_list":["post-15080","post","type-post","status-publish","format-standard","hentry","category-linux","tag-cakephp2","tag-centos","tag-vagrant","tag-virtualbox"],"_links":{"self":[{"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/posts\/15080","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/comments?post=15080"}],"version-history":[{"count":7,"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/posts\/15080\/revisions"}],"predecessor-version":[{"id":15886,"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/posts\/15080\/revisions\/15886"}],"wp:attachment":[{"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/media?parent=15080"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/categories?post=15080"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/tags?post=15080"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}