Movable TypeをPostgreSQLと使う。

 http://www.sixapart.jp/movabletype/download-mt.html
から、サイトに適合したライセンスのパッケージをダウンロード又は購入する。

 今回はVMware上のFreeBSD 6.0へインストールしての評価なので、個人用の無償パッケージにさせてもらった。

動作環境

また、ダイナミック・パブリッシング機能をお使いいただく場合、次の環境が必要です。

  • PHP 4.0.6以降
  • Smarty Template Engine
  • ezSQLライブラリー

なので、現在の環境をチェックする。

Server側

Client

Apache側でバーチャルホストとcgiが動作するように設定。

  1. user example1.jpとexample2.comを作成。
  2. それぞれのhomeディレクトリにpublic_htmlとpublic_html/cgi-binを作成。
  3. /usr/local/etc/apache22/httpd.confのInclude etc/apache22/extra/httpd-vhosts.confのコメントアウトを外す。
  4. /usr/local/etc/apache22/extra/httpd-vhost.confを下記のように設定。
  5. それぞれのpublic_htmlの下に適当なindex.htmlを置いて、/usr/local/etc/rc.d/apache22.sh start
  6. クライアントからhttp://www.example1.jp/http://www.example2.com/でテスト。
  7. cgi-binの下にmtディレクトリを作成。ここにMovable Typeのファイルを置くことにする。

 もちろん、Server側のDNSにexample1.jp zoneとexample2.com zoneの設定も済んでいる。



#
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# url:http://httpd.apache.org/docs/2.2/vhosts/
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# Use name-based virtual hosting.
#
NameVirtualHost *:80

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
...skipping...
#
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# url:http://httpd.apache.org/docs/2.2/vhosts/
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# Use name-based virtual hosting.
#
NameVirtualHost *:80

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any block.
#

ServerAdmin webmaster@example1.jp
DocumentRoot /home/example1.jp/public_html
ServerName www.example1.jp
ServerAlias example1.jp
ErrorLog /var/log/www.example1.jp-error_log
CustomLog /var/log/www.example1.jp-access_log common
ScriptAlias /cgi-bin/mt /home/example1.jp/public_html/cgi-bin/


ServerAdmin webmaster@example2.com
DocumentRoot /home/example2.com/public_html
ServerName www.example2.com
ServerAlias example2.com
ErrorLog /var/log/www.example2.com-error_log
CustomLog /var/log/www.example2.com-access_log common
ScriptAlias /cgi-bin/ /home/example2.com/public_html/cgi-bin/


AllowOverride FileInfo AuthConfig Limit Indexes
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec

Order allow,deny
Allow from all


Order deny,allow
Deny from all


AllowOverride FileInfo AuthConfig Limit Indexes
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec

Order allow,deny
Allow from all


Order deny,allow
Deny from all



Movable Typeの設定。

Clientにダウンロードしたファイルを解凍する。

  1. PerlのPathはディフォルトと同じなので触らない。
  2. mt-config.cgi-originalをmt-config.cgiとしてコピー。
  3. mt-config.cgiの28行目をhttp://www.example1.jp/cgi-bin/mt/に変更
  4. 70行目のDataSourceを/home/example1.jp/public_html/dataへ変更
  5. 85行目のE-mail AddressをWeb masterへ。
  6. 93行目のStaticWebPathをhttp://www.example1.jp/mt-staticに変更。
  7. その他必要な変更箇所を変更して保存する。
  8. FTPクライアントでServerのcigディレクトリへアップロード。
  9. 拡張子cgiのファイルの権限を755にする。
  10. mt-staticディレクトリを/home/example1.jp/public_html/へ移動する。
  11. Berkeley DB用のディレクトリpublic_html/dataを作成する。
  12. Movable TypeApacheのユーザで書き込みなどを行うのでpublic_htmlを775へ変更する。
  13. http://www.example1.jp/cgi-bin/mt-check.cgiへアクセスする。
  14. moduleの欄にDBI (version >= 1.21)、DBD::Pg (version >= 1.32)がないと怒られるので、/usr/ports/database/p5-DBD-PgSPIをmake install clean。
  15. module/optionの欄にHTML::Entitiesがないと怒られたので/usr/ports/www/p5-HTML-Parserをmake install clean。
  16. module/optionの欄にImage::Magickがないと怒られたので/usr/ports/www/imgsizerをmake install clean。
  17. module/optionの欄にCrypt::DSAがないと怒られたので/usr/ports/security/p5-Crypt-DSAをmake install clean。
  18. module/optionの欄にXML::Atomがないと怒られたので/usr/ports/textproc/p5-XML-Atomをmake install clean。
  19. /home/example1/cgi-bin/mt/index.htmlを/home/example1/public_html/へ移動する。
  20. 移動したindex.htmlの95行目の a rel="nofollow" href="mt.cgi"をa rel="nofollow" href="cgi-bin/mt/mt.cgi"に変更
  21. http://www.example1.jp/index.htmlへアクセスし、ログインをクリックする。
  22. インストールを実行をクリック
  23. データベースを初期化中と表示後、インストールが完了で一旦終了する。


DBをPostgreSQLへ変更する。

  1. mt-congig.cgiの48行目からの ObjectDriver DBI::postgres Database movabletype DBUser tester1 DBPassword password DBHost localhostコメントアウトを外し、必要なパラメータに書換える。
  2. PostgreSQLにdatabaseを上記ユーザにてutf-8で作成する。
  3. http://www.travel-canada.jp/cgi-bin/mt/mt-db2sql.cgiを実行する。
  4. Done copying data from Berkeley DB to your SQL database! All went well.で終了。