OSS Fan ~OSSでLinuxサーバ構築~

このエントリーをはてなブックマークに追加

Movable Typeインストール+設定

カテゴリ:OSSセットアップ | ソフトウェア:Movable Type | タグ:
最終更新日:2020/11/22 | 公開日:2010/03/06

目次

構成

サーバ構成

OSバージョン

CentOS release 5 (Final) 32bit

パッケージ一覧

MT-4_21-ja.zip

クライアント構成

OSバージョン

Windows XP Professional Service Pack 3

ソフトウェア一覧

Firefox 3.5.8

環境構築

インストール

 Movable Typeを導入するために必要なパッケージはありませんが、 Webサーバを利用できることが必須となります。 また、今回はブログを保存するデータベースとして「SQLite」を使用しますので、 必要なPerlモジュールをインストールします。
 PerlモジュールはLinuxのパッケージのようにrpmを使用するのではなく、 CPANからインストールします。初めてCPANを使用する場合は初期設定が 必要なためやや時間がかかりますが、基本的には全て[Enter]キーを押して 先に進めれば問題ありません。
以下のコマンドを実行します。

# perl -MCPAN -e shell
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LANG = "en.US_UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

/usr/lib/perl5/5.8.8/CPAN/Config.pm initialized.


CPAN is the world-wide archive of perl resources. It consists of about
100 sites that all replicate the same contents all around the globe.
Many countries have at least one CPAN site already. The resources
found on CPAN are easily accessible with the CPAN.pm module. If you
want to use CPAN.pm, you have to configure it properly.

If you do not want to enter a dialog now, you can answer 'no' to this
question and I'll try to autoconfigure. (Note: you can revisit this
dialog anytime later by typing 'o conf init' at the cpan prompt.)

Are you ready for manual configuration? [yes]  ←[Enter]


The following questions are intended to help you with the
configuration. The CPAN module needs a directory of its own to cache
important index files and maybe keep a temporary mirror of CPAN files.
This may be a site-wide directory or a personal directory.



First of all, I'd like to create this directory. Where?

CPAN build and cache directory? [/root/.cpan]  ←[Enter]


If you want, I can keep the source files after a build in the cpan
home directory. If you choose so then future builds will take the
files from there. If you don't want to keep them, answer 0 to the
next question.



How big should the disk cache be for keeping the build directories
with all the intermediate files?

Cache size for build directory (in MB)? [10]  ←[Enter]


By default, each time the CPAN module is started, cache scanning
is performed to keep the cache size in sync. To prevent from this,
disable the cache scanning with 'never'.

Perform cache scanning (atstart or never)? [atstart]  ←[Enter]


To considerably speed up the initial CPAN shell startup, it is
possible to use Storable to create a cache of metadata. If Storable
is not available, the normal index mechanism will be used.

Cache metadata (yes/no)? [yes]  ←[Enter]


The next option deals with the charset your terminal supports. In
general CPAN is English speaking territory, thus the charset does not
matter much, but some of the aliens out there who upload their
software to CPAN bear names that are outside the ASCII range. If your
terminal supports UTF-8, you say no to the next question, if it
supports ISO-8859-1 (also known as LATIN1) then you say yes, and if it
supports neither nor, your answer does not matter, you will not be
able to read the names of some authors anyway. If you answer no, names
will be output in UTF-8.

Your terminal expects ISO-8859-1 (yes/no)? [yes]  ←[Enter]


If you have one of the readline packages (Term::ReadLine::Perl,
Term::ReadLine::Gnu, possibly others) installed, the interactive CPAN
shell will have history support. The next two questions deal with the
filename of the history file and with its size. If you do not want to
set this variable, please hit SPACE RETURN to the following question.

File to save your history? [/root/.cpan/histfile]  ←[Enter]
Number of lines to save? [100]  ←[Enter]


The CPAN module can detect when a module that which you are trying to
build depends on prerequisites. If this happens, it can build the
prerequisites for you automatically ('follow'), ask you for
confirmation ('ask'), or just ignore them ('ignore'). Please set your
policy to one of the three values.

Policy on building prerequisites (follow, ask or ignore)? [ask]  ←[Enter]


The CPAN module will need a few external programs to work properly.
Please correct me, if I guess the wrong path for a program. Don't
panic if you do not have some of them, just press ENTER for those. To
disable the use of a download program, you can type a space followed
by ENTER.

Where is your gzip program? [/bin/gzip]  ←[Enter]
Where is your tar program? [/bin/tar]  ←[Enter]
Where is your unzip program? [/usr/bin/unzip]  ←[Enter]
Where is your make program? [/usr/bin/make]  ←[Enter]
Where is your links program? [/usr/bin/links]  ←[Enter]
Where is your wget program? [/usr/bin/wget]  ←[Enter]
Warning: ncftpget not found in PATH
Where is your ncftpget program? []  ←[Enter]
Warning: ncftp not found in PATH
Where is your ncftp program? []  ←[Enter]
Where is your ftp program? [/usr/kerberos/bin/ftp]  ←[Enter]
Where is your gpg program? [/usr/bin/gpg]  ←[Enter]
What is your favorite pager program? [/usr/bin/less]  ←[Enter]
What is your favorite shell? [/bin/bash]  ←[Enter]


Every Makefile.PL is run by perl in a separate process. Likewise we
run 'make' and 'make install' in processes. If you have any
parameters (e.g. PREFIX, LIB, UNINST or the like) you want to pass
to the calls, please specify them here.

If you don't understand this question, just press ENTER.

Parameters for the 'perl Makefile.PL' command?
Typical frequently used settings:

    PREFIX=~/perl       non-root users (please see manual for more hints)

Your choice:  []  ←[Enter]
Parameters for the 'make' command?
Typical frequently used setting:

    -j3              dual processor system

Your choice:  []  ←[Enter]
Parameters for the 'make install' command?
Typical frequently used setting:

    UNINST=1         to always uninstall potentially conflicting files

Your choice:  []  ←[Enter]


Sometimes you may wish to leave the processes run by CPAN alone
without caring about them. As sometimes the Makefile.PL contains
question you're expected to answer, you can set a timer that will
kill a 'perl Makefile.PL' process after the specified time in seconds.

If you set this value to 0, these processes will wait forever. This is
the default and recommended setting.

Timeout for inactivity during Makefile.PL? [0]  ←[Enter]


If you're accessing the net via proxies, you can specify them in the
CPAN configuration or via environment variables. The variable in
the $CPAN::Config takes precedence.

Your ftp_proxy?   ←[Enter]
Your http_proxy?   ←[Enter]
Your no_proxy?   ←[Enter]
You have no /root/.cpan/sources/MIRRORED.BY
  I'm trying to fetch one
LWP not available
CPAN: Net::FTP loaded ok
Fetching with Net::FTP:
  ftp://ftp.perl.org/pub/CPAN/MIRRORED.BY


Now we need to know where your favorite CPAN sites are located. Push
a few sites onto the array (just in case the first on the array won't
work). If you are mirroring CPAN to your local workstation, specify a
file: URL.

First, pick a nearby continent and country (you can pick several of
each, separated by spaces, or none if you just want to keep your
existing selections). Then, you will be presented with a list of URLs
of CPAN mirrors in the countries you selected, along with previously
selected URLs. Select some of those URLs, or just keep the old list.
Finally, you will be prompted for any extra URLs -- file:, ftp:, or
http: -- that host a CPAN mirror.

(1) Africa
(2) Asia
(3) Central America
(4) Europe
(5) North America
(6) Oceania
(7) South America
Select your continent (or several nearby continents) [] 2 ←入力
Sorry! since you don't have any existing picks, you must make a
geographic selection.

(1) China
(2) Hong Kong
(3) Indonesia
(4) Israel
(5) Japan
(6) Korea
(7) Pakistan
(8) Philippines
(9) Republic of Korea
(10) Saudi Arabia
(11) Singapore
(12) Taiwan
(13) Thailand
(14) Turkey
Select your country (or several nearby countries) [] 5 ←入力
Sorry! since you don't have any existing picks, you must make a
geographic selection.

(1) ftp://ftp.dti.ad.jp/pub/lang/CPAN/
(2) ftp://ftp.jaist.ac.jp/pub/CPAN/
(3) ftp://ftp.kddilabs.jp/CPAN/
(4) ftp://ftp.nara.wide.ad.jp/pub/CPAN/
(5) ftp://ftp.riken.jp/lang/CPAN/
(6) ftp://ftp.ring.gr.jp/pub/lang/perl/CPAN/
(7) ftp://ftp.u-aizu.ac.jp/pub/CPAN
(8) ftp://ftp.yz.yamagata-u.ac.jp/pub/lang/cpan/
Select as many URLs as you like (by number),
put them on one line, separated by blanks, e.g. '1 4 5' [] 5 3 ←入力

Enter another URL or RETURN to quit: []  ←[Enter]
New set of picks:
  ftp://ftp.riken.jp/lang/CPAN/
  ftp://ftp.kddilabs.jp/CPAN/


commit: wrote /usr/lib/perl5/5.8.8/CPAN/Config.pm
Terminal does not support AddHistory.

cpan shell -- CPAN exploration and modules installation (v1.7602)
ReadLine support available (try 'install Bundle::CPAN')

cpan> install DBI
CPAN: Storable loaded ok

Trying with "/usr/bin/links -source" to get
    ftp://ftp.riken.jp/lang/CPAN/authors/01mailrc.txt.gz
ELinks: Host not found

System call "/usr/bin/links -source "ftp://ftp.riken.jp/lang/CPAN/authors/01mailrc.txt.gz"  > /root/.cpan/sources/authors/01mailrc.txt"
returned status 1 (wstat 256)
Warning: expected file [/root/.cpan/sources/authors/01mailrc.txt.gz] doesn't exist

(中略)
Installing /usr/share/man/man3/DBI::Gofer::Execute.3pm
Installing /usr/share/man/man3/DBI::Gofer::Request.3pm
Installing /usr/share/man/man3/DBI::Gofer::Serializer::Storable.3pm
Installing /usr/bin/dbilogstrip
Installing /usr/bin/dbiprof
Installing /usr/bin/dbiproxy
Writing /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/DBI/.packlist
Appending installation info to /usr/lib/perl5/5.8.8/i386-linux-thread-multi/perllocal.pod
  /usr/bin/make install  -- OK

cpan> install DBD::SQLite
Running install for module DBD::SQLite
Running make for M/MS/MSERGEANT/DBD-SQLite-1.14.tar.gz

    ftp://ftp.riken.jp/lang/CPAN/authors/id/M/MS/MSERGEANT/DBD-SQLite-1.14.tar.gz

Trying with "/usr/bin/links -source" to get
    ftp://ftp.riken.jp/lang/CPAN/authors/id/M/MS/MSERGEANT/CHECKSUMS
Checksum for /root/.cpan/sources/authors/id/M/MS/MSERGEANT/DBD-SQLite-1.14.tar.gz ok
DBD-SQLite-1.14/
(中略)
Running make install
Installing /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/DBD/SQLite/SQLite.bs
Installing /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/DBD/SQLite/SQLite.so
Files found in blib/arch: installing files in blib/lib into architecture dependent library tree
Installing /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/DBD/SQLite.pm
Installing /usr/share/man/man3/DBD::SQLite.3pm
Writing /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/DBD/SQLite/.packlist
Appending installation info to /usr/lib/perl5/5.8.8/i386-linux-thread-multi/perllocal.pod
  /usr/bin/make install  -- OK

cpan> quit
Terminal does not support GetHistory.
Lockfile removed.
#

設定

 Movable Typeは主にPerlのスクリプトファイル群で構成されています。 いわゆる「設定」作業はブラウザでアクセスして管理者画面から 行いますが、簡単な初期設定作業だけコマンドで実行する必要があります。 以下のURLから「MT-4_21-ja.zip」ファイルをダウンロードします。
 http://www.ecbuyers.com/b2c/link/sixapart/mt_personal/
ftpコマンドを使用してサーバの「/var/www/html/」ディレクトリにファイルを配置します。
 /var/www/html/MT-4_21-ja.zip
以下ではその後の手順を示します。

 まずはインストールモジュールの解凍、設定に必要なディレクトリの作成や権限の設定を 行うため、以下のコマンドを実行します。

# cd /var/www/html/
# unzip MT-4_21-ja.zip
Archive:  MT-4_21-ja.zip
   creating: MT-4.21-ja/
  inflating: MT-4.21-ja/mt-add-notify.cgi  
   creating: MT-4.21-ja/import/
   creating: MT-4.21-ja/php/
(中略)
  inflating: MT-4.21-ja/default_templates/commenter_confirm.mtml  
  inflating: MT-4.21-ja/default_templates/search_results.mtml  
  inflating: MT-4.21-ja/mt-upgrade.cgi  
  inflating: MT-4.21-ja/mt-feed.cgi  
  inflating: MT-4.21-ja/mt.cgi       
# ln -s MT-4.21-ja/ mt
# cd /var/www/html/mt/
# mv mt-static/ ..
# chmod 777 ./*.cgi
# cd /var/www/html/
# mkdir blog
# chmod 777 blog
# cd /var/www/
# mkdir mt-db
# chmod 777 mt-db
# cd /var/www/html/mt-static/
# chmod 777 support

 続いて標準の設定ファイルをコピーして設定ファイルを作成します。

# cd /var/www/html/mt/
# cp -piv mt-config.cgi-original mt-config.cgi
`mt-config.cgi-original' -> `mt-config.cgi'
# vi mt-config.cgi
ファイル名: /var/www/html/mt/mt-config.cgi
※該当箇所のみ変更※
CGIPath    http://www.example.com/cgi-bin/mt/
   ↓変更
CGIPath    http://www.ranonet.ne.jp/mt/

StaticWebPath    http://www.example.com/mt-static
   ↓変更
StaticWebPath    http://www.ranonet.ne.jp/mt-static

ObjectDriver DBI::mysql
Database DATABASE_NAME
DBUser DATABASE_USERNAME
DBPassword DATABASE_PASSWORD
DBHost localhost
   ↓変更
#ObjectDriver DBI::mysql
#Database DATABASE_NAME
#DBUser DATABASE_USERNAME
#DBPassword DATABASE_PASSWORD
#DBHost localhost

ObjectDriver DBI::postgres
Database DATABASE_NAME
DBUser DATABASE_USERNAME
DBPassword DATABASE_PASSWORD
DBHost localhost
   ↓変更
#ObjectDriver DBI::postgres
#Database DATABASE_NAME
#DBUser DATABASE_USERNAME
#DBPassword DATABASE_PASSWORD
#DBHost localhost

Database /path/to/sqlite/database/file
   ↓変更
Database /var/www/mt-db/sqlite.db

設定ファイル

 /var/www/html/mt/mt-config.cgi