スポンサーサイト
上記の広告は1ヶ月以上更新のないブログに表示されています。
新しい記事を書く事で広告が消せます。
新しい記事を書く事で広告が消せます。
homebrewを使ってMacにMongoDBとPostgreSQLをインストールする
PHPのyiiフレームワークでは、ソースの自動生成をWebインターフォースで行います。そのため、ローカルでPHPやデータベースが動作する環境が必要になります。
homebrewを使ってMacでyiiが動作する環境を構築してみます。
今回はまずMongoDBとPostgreSQLをインストールします。
最初にhomebrewのインストール。リンク先を参照してください。
インストール後にbrew自体のupdateをします。
brew update
MongoDBを探します。
brew search mongodb
→
mongodb
適用できるオプションの一覧を確認します。
brew options mongodb
→
mongodb
--32-bit
Build 32-bit only.
64bitで問題無いのでそのままインストールします。
brew install mongodb
インストールすると自動起動の方法が出力されるので、それに従って設定します。
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/mongodb/2.0.3-x86_64/homebrew.mxcl.mongodb.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist
動作確認してみます。
mongo
→
MongoDB shell version: 2.0.3
connecting to: test
次にPostgreSQLの検索
brew search postgresql
→
postgresql
オプションの確認
brew options postgresql
→
--32-bit
Build 32-bit only.
--no-python
Build without Python support.
--no-perl
Build without Perl support.
--enable-dtrace
Build with DTrace support.
PythonとPerlはいらないので除いてインストールします。
brew install postgresql --no-python --no-perl
自動起動の方法が示されるので適用します。
initdb /usr/local/var/postgres
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/postgresql/9.1.3/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
PostgreSQL用のスーパーユーザを作成します。
createuser -s -P
DBを作成します。
createdb -h localhost -U superuser -E=UTF-8 test
接続します。
psql -h localhost -U superuser test
バックスラッシュqで抜けます。
\q
以上です。
homebrewを使ってMacでyiiが動作する環境を構築してみます。
今回はまずMongoDBとPostgreSQLをインストールします。
最初にhomebrewのインストール。リンク先を参照してください。
インストール後にbrew自体のupdateをします。
brew update
MongoDBを探します。
brew search mongodb
→
mongodb
適用できるオプションの一覧を確認します。
brew options mongodb
→
mongodb
--32-bit
Build 32-bit only.
64bitで問題無いのでそのままインストールします。
brew install mongodb
インストールすると自動起動の方法が出力されるので、それに従って設定します。
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/mongodb/2.0.3-x86_64/homebrew.mxcl.mongodb.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist
動作確認してみます。
mongo
→
MongoDB shell version: 2.0.3
connecting to: test
次にPostgreSQLの検索
brew search postgresql
→
postgresql
オプションの確認
brew options postgresql
→
--32-bit
Build 32-bit only.
--no-python
Build without Python support.
--no-perl
Build without Perl support.
--enable-dtrace
Build with DTrace support.
PythonとPerlはいらないので除いてインストールします。
brew install postgresql --no-python --no-perl
自動起動の方法が示されるので適用します。
initdb /usr/local/var/postgres
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/postgresql/9.1.3/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
PostgreSQL用のスーパーユーザを作成します。
createuser -s -P
DBを作成します。
createdb -h localhost -U superuser -E=UTF-8 test
接続します。
psql -h localhost -U superuser test
バックスラッシュqで抜けます。
\q
以上です。
スポンサーサイト
<<homebrewを使ってMacにNginxとPHPをインストールする | HOME | nginxでhttpsなんて変数知らないと言われた時の対応>>
COMMENTS
COMMENT FORM
TRACKBACK
| HOME |