Web サーバの構築(2)Movable Type のインストール

AWS Debian

Web コンテンツ管理のために、Movable Type をインストールする

MySQLのインストール

Movable Type が使用する RDB として、MySQL(MariaDB) をインストールする

パッケージのインストール

yasunari@aws:~$ sudo apt-get install mysql-client mysql-server
[sudo] password for yasunari:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  default-mysql-client default-mysql-server galera-3 gawk libcgi-fast-perl libcgi-pm-perl
  libdbd-mysql-perl libdbi-perl libencode-locale-perl libfcgi-perl libhtml-parser-perl
  libhtml-tagset-perl libhtml-template-perl libhttp-date-perl libhttp-message-perl
  libio-html-perl libjemalloc1 liblwp-mediatypes-perl libmpfr4 libreadline5
  libterm-readkey-perl libtimedate-perl liburi-perl mariadb-client-10.1
  mariadb-client-core-10.1 mariadb-common mariadb-server-10.1 mariadb-server-core-10.1 socat
Suggested packages:
  gawk-doc libclone-perl libmldbm-perl libnet-daemon-perl libsql-statement-perl
  libdata-dump-perl libipc-sharedcache-perl libwww-perl mariadb-test netcat-openbsd tinyca
The following NEW packages will be installed:
  default-mysql-client default-mysql-server galera-3 gawk libcgi-fast-perl libcgi-pm-perl
  libdbd-mysql-perl libdbi-perl libencode-locale-perl libfcgi-perl libhtml-parser-perl
  libhtml-tagset-perl libhtml-template-perl libhttp-date-perl libhttp-message-perl
  libio-html-perl libjemalloc1 liblwp-mediatypes-perl libmpfr4 libreadline5
  libterm-readkey-perl libtimedate-perl liburi-perl mariadb-client-10.1
  mariadb-client-core-10.1 mariadb-common mariadb-server-10.1 mariadb-server-core-10.1
  mysql-client mysql-server socat
0 upgraded, 31 newly installed, 0 to remove and 0 not upgraded.
Need to get 25.7 MB of archives.
After this operation, 189 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
	:
	:
Setting up default-mysql-client (1.0.2) ...
Setting up default-mysql-server (1.0.2) ...
Setting up mysql-server (5.5.9999+default) ...
Setting up mysql-client (5.5.9999+default) ...
Processing triggers for libc-bin (2.24-11+deb9u1) ...
Processing triggers for systemd (232-25+deb9u1) ...
yasunari@aws:~$

DB のセットアップ

MySQLの設定に従ってセットアップする
root@aws:~# mysql -u root
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 21
Server version: 10.1.26-MariaDB-0+deb9u1 Debian 9.1

Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> create database mt character set utf8;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> grant all on mt.* to mtuser@localhost identified by '内緒';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> exit;
Bye
root@aws:~#

DB のコピー

自宅サーバで DB のダンプをとる
yasunari@xhl:~$ sudo /usr/bin/mysqldump -a --user=root --password=内緒 mt | gzip > /tmp/mysqldump.gz
yasunari@xhl:~$ 
AWS 側にコピーする
yasunari@xhl:~$ rsync -rtuvpogtlH --timeout=360 -e "ssh -p 内緒 -i /home/yamasita/yasunari/.ssh/aws1.pem" /tmp/mysqldump.gz aws.yamasita.jp:/tmp
sending incremental file list
mysqldump.gz

sent 9256218 bytes  received 31 bytes  2644642.57 bytes/sec
total size is 9254988  speedup is 1.00
yasunari@xhl:~$
AWS 側で取り込む
root@aws:~# zcat /tmp/mysqldump.gz | mysql --user=mtuser --password=内緒 mt
root@aws:~#

Movable Type のインストール

続いて、Movable Type 本体

Movable Type のダウンロード

Movable Type 個人無償版ダウンロードから Movable Type のダウンロードを申し込み、 届いたメールのURLからダウンロードする
yasunari@aws:~$ cd /usr/lib/cgi-bin/
yasunari@aws:/usr/lib/cgi-bin$ wget https://www.movabletype.jp/downloads/release/内緒/MT-6.3.6.zip
--2017-12-28 12:19:13--  https://www.movabletype.jp/downloads/release/内緒/MT-6.3.6.zip
Resolving www.movabletype.jp (www.movabletype.jp)... 13.33.28.38, 13.33.28.52, 13.33.28.114, ...
Connecting to www.movabletype.jp (www.movabletype.jp)|13.33.28.38|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 15554363 (15M) [application/zip]
Saving to: 睛T-6.3.6.zip

MT-6.3.6.zip            100%[=============================>]  14.83M  37.9MB/s    in 0.4s

2017-12-28 12:19:14 (37.9 MB/s) - 睛T-6.3.6.zip 碵aved [15554363/15554363]

yasunari@aws:/usr/lib/cgi-bin$
なお、個人無償版は1インストールに制限されているが、
以前サポートに問い合わせして、 「リプレース作業中は複数インストールしても致し方ない」旨の 回答をいただいている。

パッケージの展開

yasunari@aws:/usr/lib/cgi-bin$ unzip MT-6.3.6.zip
-bash: unzip: command not found
yasunari@aws:/usr/lib/cgi-bin$ 
unzip をインストールする
yasunari@aws:/usr/lib/cgi-bin$ sudo apt-get install unzip
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
  zip
The following NEW packages will be installed:
  unzip
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 170 kB of archives.
After this operation, 547 kB of additional disk space will be used.
Get:1 http://cdn-aws.deb.debian.org/debian stretch/main amd64 unzip amd64 6.0-21 [170 kB]
Fetched 170 kB in 0s (369 kB/s)
Selecting previously unselected package unzip.
(Reading database ... 35706 files and directories currently installed.)
Preparing to unpack .../unzip_6.0-21_amd64.deb ...
Unpacking unzip (6.0-21) ...
Processing triggers for mime-support (3.60) ...
Setting up unzip (6.0-21) ...
Processing triggers for man-db (2.7.6.1-2) ...
yasunari@aws:/usr/lib/cgi-bin$
もう一度
yasunari@aws:/usr/lib/cgi-bin$ unzip MT-6.3.6.zip
Archive:  MT-6.3.6.zip
   creating: MT-6.3.6/
  inflating: MT-6.3.6/mt-testbg.cgi
  inflating: MT-6.3.6/mt-cp.cgi
  inflating: MT-6.3.6/mt.psgi
  inflating: MT-6.3.6/index.html
	:
	:
   creating: MT-6.3.6/lib/MT/I18N/
  inflating: MT-6.3.6/lib/MT/I18N/ja.pm
  inflating: MT-6.3.6/lib/MT/I18N/en_us.pm
  inflating: MT-6.3.6/lib/MT/I18N/default.pm
  inflating: MT-6.3.6/mt.cgi
yasunari@aws:/usr/lib/cgi-bin$
名前を変更する
yasunari@aws:/usr/lib/cgi-bin$ mv MT-6.3.6 mt
yasunari@aws:/usr/lib/cgi-bin$

CGI を使えるようにする

yasunari@aws:~$ cd /etc/apache2/
yasunari@aws:/etc/apache2$ cd mods-enabled/
yasunari@aws:/etc/apache2/mods-enabled$ sudo ln -s ../mods-available/cgid.* .
yasunari@aws:/etc/apache2/mods-enabled$
こんなのでいいのか??
正しくは、a2enmod cgid を実行するとのこと。。。

mt-config.cgi をコピー

自宅サーバから、mt-config.cgi をコピーする
yasunari@xhl:~$ rsync -rtuvpogtlH --timeout=360 -e "ssh -p 8022 -i /home/yamasita/yasunari/.ssh/aws2.pem" /home/httpd/cgi-bin/mt/mt-config.cgi aws.yamasita.jp:/tmp
sending incremental file list
mt-config.cgi

sent 809 bytes  received 31 bytes  560.00 bytes/sec
total size is 718  speedup is 0.85
yasunari@xhl:~$
yasunari@aws:/usr/lib/cgi-bin/mt$ cp /tmp/mt-config.cgi .
yasunari@aws:/usr/lib/cgi-bin/mt$

ブラウザからアクセス

http://aws.yamasita.jp/mt/mt.cgi にアクセスする

Community Pack バージョン 2.16 のアップグレードってナニ???

「アップグレードの開始」をクリック

ユーザ名とパスワードを入力してサインイン

データベースがアップグレードされて、、、

できた!!

cronの設定

指定日投稿や公開キュー等のスケジュール処理の設定を行う。

まずは手動で実行してみる。

root@aws:~# (cd /home/httpd/cgi-bin/mt ; tools/run-periodic-tasks)
root@aws:~#
特にエラーもなし。

cron に登録する

root@aws:~# crontab -e
root@aws:~# crontab -l
	:
	:
# m h  dom mon dow   command
*/10 * * * * (cd /home/httpd/cgi-bin/mt ; tools/run-periodic-tasks) 2>/dev/null 1>/dev/null


Web サーバの構築(1)apache のインストールとセットアップ
山下康成の
雲の上

オチ

Copyright (C) 2003-2018 Yasunari Yamashita. All Rights Reserved.
yasunari @ yamasita.jp 山下康成@京都府向日市/東京都新宿区