環境条件
動作に必要な環境
- サーバOS
- Linux、Solaris / Unix、BSD
- Mac OS X
- Windows Server 2012 R2 / 2016 / 2019
- ウェブサーバ
- nginx 1.2.0 以上(CGI もしくは PSGI 実行環境が別途必要)
- Apache HTTP Server 2.0 以上
- Microsoft IIS(Internet Information Services) 8.5 以上
- データベース
- MySQL 5.1 以上(5.7.x を推奨 / 8.0.x まで検証済み)
- MariaDB 5.5 以上(10.3.x を推奨)
- Perl
- 5.16.3 以上
- 文字コード
- UTF-8
- ブラウザ
- Google Chrome(最新版の iOS / iPadOS、Android も含む)
- Mozilla Firefox
- Safari(最新版の iOS / iPadOS も含む)
- Microsoft Edge
- ※Internet Explorer 11 は、サポート終了に伴い、Movable Type のサポート対象ブラウザからも除外
- サーバOS
- Oracle Linux 9
- VM.Standard.E5.Flexを使用 ウェブサーバ
- Apache 2.4.57 (Oracle Linux Server)
- データベース
- MySQL 8.0.35
- Perl
- 5.32.1
- 文字コード
- UTF-8
- ブラウザ
- Google Chrome
- GD
- Graphics::Magick
- Image::Magick
- Imager
- NetPBM
- /usr/lib/sendmail
- /usr/sbin/sendmail
- /usr/ucblib/sendmail
- /usr/local/bin/sendmail
実環境
ディレクトリの構成
以下の構成は構成例で、実運用時は環境と照らし合わせて設計する必要がある
種類 | ディレクトリパス | URL |
---|---|---|
アプリケーションディレクトリ | /var/www/cgi-bin/mt | http://www.example.com/cgi-bin/mt |
スタティックディレクトリ | /var/www/html/mt-static | http://www.example.com/mt-static |
ウェブサイトディレクトリ | /var/www/html | http://www.example.com |
事前準備
任意の Web サーバ(ここではhttpd
)をインストールを実行後、
「ディレクトリの構成」で設計したディレクトリを作成
sudo mkdir /var/www/cgi-bin/mt
sudo mkdir /var/www/html/mt-static
本作業
zip ファイルの解凍と適切なディレクトリに移動
最初に zip ファイルを解凍
unzip MT-8.0.2.zip
解凍後、作成されたディレクトリに移動、ls -l
コマンドで確認
ls -l
合計 24260
drwxr-xr-x 15 opc opc 4096 10月 25 14:28 MT-8.0.2
-rw-r--r-- 15 opc opc 24835288 4月 5 09:20 MT-8.0.2.zip
zip ファイルは不要なので削除
sudo rm -rf MT.zip
ls -l
合計 4
drwxr-xr-x 15 opc opc 4096 10月 25 14:28 MT-8.0.2
解凍したディレクトリに移動、ls -l
で配下のファイルを確認
cd MT-8.0.2
ls -l
-rw-r--r-- 1 root root 444031 10月 25 14:28 CHECKSUMS
drwxr-xr-x 3 root root 29 10月 25 14:28 addons
drwxr-xr-x 2 root root 6 10月 25 14:28 alt-tmpl
drwxr-xr-x 2 root root 4096 10月 25 14:28 default_templates
drwxr-xr-x 46 root root 4096 10月 25 14:28 extlib
drwxr-xr-x 2 root root 6 10月 25 14:28 import
-rw-r--r-- 1 root root 21017 10月 25 14:27 index.html
drwxr-xr-x 3 root root 29 10月 25 14:28 lib
-rwxr-xr-x 1 root root 350 10月 25 14:27 mt-cdsearch.cgi
-rwxr-xr-x 1 root root 33940 10月 25 14:28 mt-check.cgi
-rwxr-xr-x 1 root root 433 10月 25 14:27 mt-comments.cgi
-rw-r--r-- 1 root root 1571 10月 25 14:27 mt-config.cgi-original
-rwxr-xr-x 1 root root 337 10月 25 14:27 mt-data-api.cgi
-rwxr-xr-x 1 root root 336 10月 25 14:27 mt-search.cgi
-rwxr-xr-x 1 root root 253 10月 25 14:28 mt-shared-preview.cgi
drwxr-xr-x 24 root root 4096 10月 25 14:28 mt-static
-rwxr-xr-x 1 root root 338 10月 25 14:27 mt-upgrade.cgi
-rwxr-xr-x 1 root root 336 10月 25 14:27 mt-wizard.cgi
-rwxr-xr-x 1 root root 333 10月 25 14:27 mt.cgi
-rw-r--r-- 1 root root 405 10月 25 14:27 mt.psgi
drwxr-xr-x 6 root root 72 10月 25 14:28 php
drwxr-xr-x 20 root root 4096 10月 25 14:28 plugins
drwxr-xr-x 2 root root 173 10月 25 14:28 search_templates
drwxr-xr-x 7 root root 95 10月 25 14:28 themes
drwxr-xr-x 9 root root 126 10月 25 14:28 tmpl
drwxr-xr-x 3 root root 4096 10月 25 14:28 tools
mt-staticディレクトリを作成した/var/www/html/mt-static
に移動
その後に ls -l
で確認
sudo mv mt-static/* /var/www/html/mt-static
ls -l /var/www/html/mt-static
drwxr-xr-x 5 root root 43 1月 6 10:13 a-table.js
drwxr-xr-x 3 root root 29 1月 6 10:13 addons
drwxr-xr-x 4 root root 27 1月 6 10:13 bootstrap
drwxr-xr-x 4 root root 27 1月 6 10:13 bootstrap5
drwxr-xr-x 4 root root 89 1月 6 10:13 chart-api
drwxr-xr-x 8 root root 79 1月 6 10:13 codemirror
drwxr-xr-x 6 root root 4096 1月 6 10:13 css
drwxr-xr-x 8 root root 66 1月 6 10:13 data-api
drwxr-xr-x 2 root root 32 1月 6 10:13 htc
drwxr-xr-x 2 root root 51 1月 6 10:13 html
drwxr-xr-x 17 root root 4096 1月 6 10:13 images
-rw-r--r-- 1 root root 98 1月 6 10:13 index.html
drwxr-xr-x 3 root root 4096 1月 6 10:13 jquery
drwxr-xr-x 3 root root 171 1月 6 10:13 jqueryui
drwxr-xr-x 11 root root 4096 1月 6 10:13 js
drwxr-xr-x 2 root root 30 1月 6 10:13 js-cookie
-rw-r--r-- 1 root root 100156 1月 6 10:13 mt.js
-rw-r--r-- 1 root root 97 1月 6 10:13 mt_en_us.js
-rw-r--r-- 1 root root 17188 1月 6 10:13 mt_ja.js
drwxr-xr-x 12 root root 4096 1月 6 10:13 plugins
drwxr-xr-x 2 root root 4096 1月 6 10:13 popper
drwxr-xr-x 2 root root 111 1月 6 10:13 riot
-rw-r--r-- 1 root root 434 1月 6 10:13 styles.css
-rw-r--r-- 1 root root 0 1月 6 10:13 styles_ja.css
drwxr-xr-x 2 root root 6 1月 6 10:13 support
drwxr-xr-x 2 root root 58 1月 6 10:13 svg4everybody
drwxr-xr-x 9 root root 152 1月 6 10:13 themes
drwxr-xr-x 2 root root 39 1月 6 10:13 themes-base
mt-static ディレクトリ以外の残りのファイルを、作成したアプリケーションディレクトリに移動
sudo mv * /var/www/cgi-bin/mt
ls -l /var/www/cgi-bin/mt
-rw-r--r-- 1 root root 444031 1月 6 10:17 CHECKSUMS
drwxr-xr-x 3 root root 29 1月 6 10:17 addons
drwxr-xr-x 2 root root 6 1月 6 10:17 alt-tmpl
drwxr-xr-x 2 root root 4096 1月 6 10:17 default_templates
drwxr-xr-x 46 root root 4096 1月 6 10:17 extlib
drwxr-xr-x 2 root root 6 1月 6 10:17 import
-rw-r--r-- 1 root root 21017 1月 6 10:17 index.html
drwxr-xr-x 3 root root 29 1月 6 10:17 lib
-rwxr-xr-x 1 root root 350 1月 6 10:17 mt-cdsearch.cgi
-rwxr-xr-x 1 root root 33940 1月 6 10:17 mt-check.cgi
-rwxr-xr-x 1 root root 433 1月 6 10:17 mt-comments.cgi
-rw-r--r-- 1 root root 1571 1月 6 10:17 mt-config.cgi-original
-rwxr-xr-x 1 root root 337 1月 6 10:17 mt-data-api.cgi
-rwxr-xr-x 1 root root 336 1月 6 10:17 mt-search.cgi
-rwxr-xr-x 1 root root 253 1月 6 10:17 mt-shared-preview.cgi
drwxr-xr-x 24 root root 4096 1月 6 10:17 mt-static
-rwxr-xr-x 1 root root 338 1月 6 10:17 mt-upgrade.cgi
-rwxr-xr-x 1 root root 336 1月 6 10:17 mt-wizard.cgi
-rwxr-xr-x 1 root root 333 1月 6 10:17 mt.cgi
-rw-r--r-- 1 root root 405 1月 6 10:17 mt.psgi
drwxr-xr-x 6 root root 72 1月 6 10:17 php
drwxr-xr-x 20 root root 4096 1月 6 10:17 plugins
drwxr-xr-x 2 root root 173 1月 6 10:17 search_templates
drwxr-xr-x 7 root root 95 1月 6 10:17 themes
drwxr-xr-x 9 root root 126 1月 6 10:17 tmpl
drwxr-xr-x 3 root root 4096 1月 6 10:17 tools
MT-8.0.2
ディレクトリは以降の作業では不要となるので、削除を行う。
cd ..
sudo rm -rf MT-8.0.2
コピーした以下のファイルやディレクトリに対して、適切な権限を設定
アプリケーションディレクトリ内のスクリプト (拡張子が cgi のファイル) の権限を、755
に設定
sudo chmod 755 /var/www/cgi-bin/mt/*.cgi
mt-static ディレクトリ内の support ディレクトリの権限を、777
に設定
sudo chmod 777 /var/www/html/mt-static/support
インストールする必要があるモジュールを確認
ブラウザから以下のサイトにアクセスしてシステム情報を表示
http://<ドメイン名>/cgi-bin/mt/mt-check.cgi
この時、Checking for Required Modules
とChecking for Data Storage Modules
の箇所で以下のメッセージが表示された場合、モジュールをインストールする必要がある
Either your server does not have HTML::Entities installed, the version that is installed is too old, or HTML::Entities requires another module that is not installed. Please consult the installation instructions for help in installing HTML::Entities.
今回は以下のコマンドで必要なモジュールをインストール
※CPANがサーバにインストールされていない場合、dnf install cpan
等でインストールする必要あり
sudo cpan install HTML::Entities
sudo cpan install DBD::mysql
実行内容の最下部にが表示されればモジュールのインストールは完了である。
/usr/bin/make install -- OK
また、DBD::mysqlのインストール時に以下のエラーが表示される場合、
Can't exec "mysql_config": そのようなファイルやディレクトリはありません at Makefile.PL line 85.
以下のコマンドを使用して、MySQL開発ファイルパッケージを導入後にモジュールをインストールする事が可能
sudo dnf localinstall -y https://dev.mysql.com/get/mysql80-community-release-el9-1.noarch.rpm
sudo dnf install -y mysql
sudo dnf install -y mysql-community-devel
また上記のパッケージのインストール時に以下のエラーが発生した場合、
file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022 (0x3A79BD29) の GPG 鍵はインストール済みです
"MySQL 8.0 Community Server" リポジトリーに一覧表示されている GPG 鍵はインストール済みですが、このパッケージには適切ではありません。
正しい鍵 URL がこのリポジトリー用に設定されているか確認してください。. 失敗したパッケージは: mysql-community-client-8.0.36-1.el9.x86_64
GPG 鍵が設定されています: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022
mysql-community-client-plugins-8.0.36-1.el9.x86_64.rpm の公開鍵がインストールされていません. 失敗したパッケージは: mysql-community-client-plugins-8.0.36-1.el9.x86_64
GPG 鍵が設定されています: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022
mysql-community-common-8.0.36-1.el9.x86_64.rpm の公開鍵がインストールされていません. 失敗したパッケージは: mysql-community-common-8.0.36-1.el9.x86_64
GPG 鍵が設定されています: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022
mysql-community-libs-8.0.36-1.el9.x86_64.rpm の公開鍵がインストールされていません. 失敗したパッケージは: mysql-community-libs-8.0.36-1.el9.x86_64
GPG 鍵が設定されています: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022
ダウンロード済みのパッケージは、次の正常なトランザクションまでキャッシュに保存されました。
'dnf clean packages' を実行することでキャッシュパッケージを削除できます。
エラー: GPG の確認に失敗しました
以下のコマンドで2023年版のGPGキーのインポートを行う
sudo rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2023
必要なモジュールをインストール後、再度http://<ドメイン名>/cgi-bin/mt/mt-check.cgi
のページを確認、最下部に以下が表示されればOK
補足で、Movable Typeのインストールに必須ではないが、アップロードした画像のサムネイルを作成する場合に以下のいずれかのモジュールが必要
今回はGraphics::Magick
を以下の手順でインストール
sudo dnf config-manager --set-enabled ol9_developer_EPEL
sudo dnf install -y GraphicsMagick GraphicsMagick-perl
インストール後、http://<ドメイン名>/cgi-bin/mt/mt-check.cgi
のページで以下が表示されればOK
MySQL で Movable Type 用のデータベースとユーザーを作成
以下のコマンドで MySQL にログイン
mysql -h 10.0.1.119 -u admin -p
# -h は mysql のプライベート IP アドレスを指定
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 318
Server version: 8.0.36-u1-cloud MySQL Enterprise - Cloud
Copyright (c) 2000, 2024, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
以下のクエリで、Movable Type 用のデータベース(ここではmt_database
)の作成を行う。
mysql> CREATE DATABASE mt_database;
Query OK, 1 row affected (0.00 sec)
以下のクエリを実行して、データベースが作成されている事を確認する。
mysql> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| mysql_audit |
| performance_schema |
| sys |
| mt_database |
+--------------------+
6 rows in set (0.00 sec)
同様に以下のクエリで Movable Type 用のユーザーの作成(ここではmt_user
)を行う。
mysql> CREATE USER 'mt_user'@'%' IDENTIFIED BY 'u9hT5E_WAv';
Query OK, 0 rows affected (0.01 sec)
IDENTIFIED BY ~ の後ろは任意のパスワードを使用
以下のクエリを実行して、ユーザーが作成されている事を確認する。
mysql> SELECT USER, HOST FROM mysql.user;
+--------------------+-----------+
| User | Host |
+--------------------+-----------+
| administrator | % |
| ocirpl | % |
| root | % |
| mt_user | % |
| mysql.infoschema | localhost |
| mysql.session | localhost |
| mysql.sys | localhost |
| oracle-cloud-agent | localhost |
+--------------------+-----------+
16 rows in set (0.00 sec)
以下のクエリで mt_user
に、mt_database
に関する全ての権限を付与する。
mysql> GRANT all privileges ON mt_database.* TO 'mt_user'@'%';
Query OK, 0 rows affected (0.01 sec)
付与後、以下のクエリで確認する。
mysql> SHOW GRANTS FOR 'mt_user'@'%';
+-----------------------------------------------------------+
| Grants for wp_admin@% |
+-----------------------------------------------------------+
| GRANT USAGE ON *.* TO `mt_user`@`%` |
| GRANT ALL PRIVILEGES ON `mt_database`.* TO `wp_user`@`%` |
+-----------------------------------------------------------+
2 rows in set (0.00 sec)
管理画面にアクセス
アプリケーションディレクトリのURLから、以下の管理画面が表示されればOK
http://<ドメイン名>/cgi-bin/mt/
/etc/httpd/conf/httpd.conf
の<Directory "/var/www/cgi-bin">
にAddHandler text/html .html
を追記する必要あり
<Directory "/var/www/cgi-bin">
AllowOverride None
Options None
Require all granted
AddHandler text/html .html
設定後、httpd の再起動を実施し管理画面が表示されればOK
systemctl restart httpd
インストールウィザードで環境設定ファイル(mt-config.cgi)を作成
以下の画面が表示、
今回はスタティックウェブパスを/mt-static
に変更、「開始」を選択
追加のパス設定を省略する場合はチェックを入れて、「次へ」を選択
MySQLの設定画面が表示されるので、各項目を入力、「接続テスト」を選択
(データベースポートは空白の場合、3306番を使用、
データベースソケットはMySQL と Perl で使用する UNIX ソケットが違う場合に設定を行う)
接続テストが成功した場合、以下が表示されるので「次へ」を選択
メール設定画面が表示されるので、メールアドレスを入力、「次へ」を選択
メール送信プログラムを未選択状態のまま進むと "Sendmail" が選択され、以下の 4 つの場所に sendmail の本体があるか探す。
sendmail が別の場所にある場合は、プルダウンから明示的に "Sendmail" を選択する。
構成ファイルの設定画面で、Movable Typeの構成ファイルを保存できませんでした。
と表示される場合、
「ウィザードで作成されたmt-config.cgiを表示する」を選択、
表示されたテキストファイルをコピーして、mt.cgiがあるディレクトリにmt-config.cgi
として新規作成
(この場合、mt-config.cgiの権限を755
にする必要がある)
作成後、mt-config.cgiを手動で作成しました。
にチェックを入れ、「次へ」を選択
Movable Typeの設定を完了しました。
と表示されるので、「次へ」を選択
アカウントの作成画面が表示されるので、各項目を入力、「次へ」を選択
サイトの作成画面が表示されるので、各項目を入力、「インストール」を選択
サイトの作成時に以下のエラーが表示された場合、
mt-static ディレクトリ内の support ディレクトリの権限を、777 に設定
# chmod 777 /var/www/cgi-bin/mt/mt-static/support
同様に以下のエラーが表示された場合、
サイトパスが正しいか検証、もしくはサイトパスの権限を変更する必要がある。
Movable Typeのインストールの実行が走り、以下の画面が表示されたら「Movable Type にサインイン」を選択
インストール後、Movable Typeのログイン画面が表示されるので、アカウントの作成
時に入力したユーザー名とパスワードを入力、、「サインイン」を選択
ログイン後、以下の画面のようにダッシュボードの画面が表示されれば全ての作業は完了となる。