LoginSignup
0
0

Movable Type 8をOracle Linux 9にインストール

Last updated at Posted at 2024-01-07

環境条件

動作に必要な環境

サーバ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

ディレクトリの構成

以下の構成は構成例で、実運用時は環境と照らし合わせて設計する必要がある

種類 ディレクトリパス 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

ウェブサイトディレクトリの権限を、777 に設定

sudo chmod 777 /var/www/html

mt-static ディレクトリ内の support ディレクトリの権限を、777 に設定

sudo chmod 777 /var/www/html/mt-static/support

インストールする必要があるモジュールを確認

ブラウザから以下のサイトにアクセスしてシステム情報を表示
http://<ドメイン名>/cgi-bin/mt/mt-check.cgi
6.jpg

この時、Checking for Required ModulesChecking 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等でインストールする必要あり

HTML::Entities
sudo cpan install HTML::Entities
DBD::mysql
sudo cpan install DBD::mysql

実行内容の最下部にが表示されればモジュールのインストールは完了である。

実行結果
/usr/bin/make install  -- OK

また、DBD::mysqlのインストール時に以下のエラーが表示される場合、

エラー
Can't exec "mysql_config": そのようなファイルやディレクトリはありません at Makefile.PL line 85.

以下のコマンドを使用して、MySQL開発ファイルパッケージを導入後にモジュールをインストールする事が可能

MySQLのリポジトリを追加
sudo dnf localinstall -y https://dev.mysql.com/get/mysql80-community-release-el9-1.noarch.rpm
MySQLをインストール
sudo dnf install -y mysql 
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

スクリーンショット 2024-01-06 11.14.32.png

補足で、Movable Typeのインストールに必須ではないが、アップロードした画像のサムネイルを作成する場合に以下のいずれかのモジュールが必要

  • GD
  • Graphics::Magick
  • Image::Magick
  • Imager
  • NetPBM

今回はGraphics::Magickを以下の手順でインストール

ol9_developer_EPELを有効化
sudo dnf config-manager --set-enabled ol9_developer_EPEL
GraphicsMagickとGraphicsMagick-perlをインストール
sudo dnf install -y GraphicsMagick GraphicsMagick-perl

インストール後、http://<ドメイン名>/cgi-bin/mt/mt-check.cgiのページで以下が表示されればOK
スクリーンショット 2024-01-06 11.31.30.png

MySQL で Movable Type 用のデータベースとユーザーを作成

以下のコマンドで MySQL にログイン

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/
スクリーンショット 2024-01-06 11.42.22.png

以下の画面が表示された場合、
スクリーンショット 2024-01-06 11.34.16.png

/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)を作成

最初に「Movable Type にサインイン」を選択
スクリーンショット 2024-01-06 11.42.22.png

以下の画面が表示、
スクリーンショット 2024-01-06 12.27.30.png
今回はスタティックウェブパスを/mt-staticに変更、「開始」を選択
スクリーンショット 2024-01-06 12.30.25.png

追加のパス設定を省略する場合はチェックを入れて、「次へ」を選択
スクリーンショット 2024-01-06 12.34.45.png

以下の画面が表示されるので、「次へ」を選択
スクリーンショット 2024-01-06 12.36.52.png

MySQLの設定画面が表示されるので、各項目を入力、「接続テスト」を選択
(データベースポートは空白の場合、3306番を使用、
データベースソケットはMySQL と Perl で使用する UNIX ソケットが違う場合に設定を行う)
スクリーンショット 2024-01-06 12.43.32.png

接続テストが成功した場合、以下が表示されるので「次へ」を選択
スクリーンショット 2024-01-06 12.54.22.png

メール設定画面が表示されるので、メールアドレスを入力、「次へ」を選択
メール送信プログラムを未選択状態のまま進むと "Sendmail" が選択され、以下の 4 つの場所に sendmail の本体があるか探す。
sendmail が別の場所にある場合は、プルダウンから明示的に "Sendmail" を選択する。

  • /usr/lib/sendmail
  • /usr/sbin/sendmail
  • /usr/ucblib/sendmail
  • /usr/local/bin/sendmail

スクリーンショット 2024-01-06 12.56.10.png

構成ファイルの設定画面で、Movable Typeの構成ファイルを保存できませんでした。と表示される場合、
スクリーンショット 2024-01-06 13.01.11.png
ウィザードで作成されたmt-config.cgiを表示する」を選択、
スクリーンショット 2024-01-06 13.06.36.png

表示されたテキストファイルをコピーして、mt.cgiがあるディレクトリにmt-config.cgiとして新規作成
(この場合、mt-config.cgiの権限を755にする必要がある)
スクリーンショット 2024-01-06 13.10.04.png

作成後、mt-config.cgiを手動で作成しました。にチェックを入れ、「次へ」を選択
スクリーンショット 2024-01-06 13.12.11.png

Movable Typeの設定を完了しました。と表示されるので、「次へ」を選択
スクリーンショット 2024-01-06 13.14.05.png

アカウントの作成画面が表示されるので、各項目を入力、「次へ」を選択
スクリーンショット 2024-01-07 9.34.25.png

サイトの作成画面が表示されるので、各項目を入力、「インストール」を選択
スクリーンショット 2024-01-07 9.42.02.png

サイトの作成時に以下のエラーが表示された場合、
スクリーンショット 2024-01-07 9.37.10.png
mt-static ディレクトリ内の support ディレクトリの権限を、777 に設定

# chmod 777 /var/www/cgi-bin/mt/mt-static/support

同様に以下のエラーが表示された場合、
スクリーンショット 2024-01-07 9.44.32.png
サイトパスが正しいか検証、もしくはサイトパスの権限を変更する必要がある。

Movable Typeのインストールの実行が走り、以下の画面が表示されたら「Movable Type にサインイン」を選択
スクリーンショット 2024-01-07 9.48.16.png

インストール後、Movable Typeのログイン画面が表示されるので、アカウントの作成時に入力したユーザー名とパスワードを入力、、「サインイン」を選択
スクリーンショット 2024-01-07 9.49.39.png

ログイン後、以下の画面のようにダッシュボードの画面が表示されれば全ての作業は完了となる。
スクリーンショット 2024-01-07 9.51.21.png

参考サイト

Movable Type 8 スタートガイド
CentOS 7 にMovable Type 7 をインストール

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0