Lets移行プラットホーム
の準備
PostgreSQL 9.6 と Drupal8 CMS のインストール
JPUG 合宿 2016山鹿
2016-10-02
2016-10-04 改訂
2016-11-23 第2訂
改訂履歴
日付
内容
担当
備考
2016-10-02 初版
桑村
2016-10-03 PHPレポジトリ変更(REMI → Webtatic)
桑村
2016-10-04 Drupal8インストールを追加
桑村
2016-11-23 Webatic の前に EPELインストールを追加
桑村
変更時欠落
プラットホーム諸元
• OS: CentOS 7 (CentOS6の開発は2020年終了と間近)
• DBMS: PostgreSQL 9.6(リリース直後だけど、JPUGなので)
• WebServer: Apache 2.4(ディストリビューション標準)
• ServerSSL: mod_ssl (
〃
、TLS1.2)
• ServerEngine: PHP 7 (速いらしい)
OS: CentOS7の準備
• GMOクラウド VPSサービス
• シリーズ名 :GMOクラウド VPS
• プラン名 :1GB(メモリ、ディスクは約50GB)
• ドメイン名 :sub0000543810.hmk-temp.com
(153.122.52.125)
価格 :約1万円/6カ月
• CentOS 7(yum update 後7.2 )
• DNS: Amazon Web Service
• newlets.postgresql.jp
DBMS: PostgreSQL9.6の準備
• PGDGリポジトリ設定
• https://yum.postgresql.org/repopackages.php
#rpm -iv
https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-centos96-9.6-3.noarch.rpm
• インストール
# yum -y install postgresql96-server postgresql96-devel postgresql96-contrib
• DB初期化
# sudo su – postgres; /usr/pgsql-9.6/bin/pg_ctl -o "-E UTF-8 --no-locale" initdb; exit
• postgresqlサービス起動
# systemctl start postgresql-9.6.service
• postgresql自動起動設定
# systemctl enable postgresql-9.6.service
Created symlink from
/etc/systemd/system/multi-user.target.wants/postgresql-9.6.service to /usr/lib/systemd/system/postgresql-/etc/systemd/system/multi-user.target.wants/postgresql-9.6.service.
PostgreSQL稼働状況(JPUG合宿なので)
# systemctl status postgresql-9.6.service
● postgresql-9.6.service - PostgreSQL 9.6 database server
Loaded: loaded (/usr/lib/systemd/system/postgresql-9.6.service; disabled; vendor preset: disabled) Active: active (running) since ¥u65e5 2016-10-02 00:44:21 JST; 54s ago
Process: 2083 ExecStartPre=/usr/pgsql-9.6/bin/postgresql96-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS)
Main PID: 2089 (postmaster)
CGroup: /system.slice/postgresql-9.6.service
├2089 /usr/pgsql-9.6/bin/postmaster -D /var/lib/pgsql/9.6/data/ ├2091 postgres: logger process
├2093 postgres: checkpointer process ├2094 postgres: writer process
├2095 postgres: wal writer process
├2096 postgres: autovacuum launcher process └2097 postgres: stats collector process
10月 02 00:44:21 newlets.postgresql.jp systemd[1]: Starting PostgreSQL 9.6 d... 10月02 00:44:21 newlets.postgresql.jp postmaster[2089]: < 2016-10-02 00:44:... 10月02 00:44:21 newlets.postgresql.jp postmaster[2089]: < 2016-10-02 00:44:... 10月02 00:44:21 newlets.postgresql.jp systemd[1]: Started PostgreSQL 9.6 da... Hint: Some lines were ellipsized, use -l to show in full.
Drupal8用DBの準備
• PostgreSQLロール: drupal
• データベース: d8lets
# sudo -u postgres /usr/pgsql-9.6/bin/createuser drupal -W
Password: xxxxxxxx
ServerEngine: PHP7の準備
• EPEL >7 が必要なのでなければインストールしておく
# yum install epel-release.noarch
• PHPパッケージリポジトリ(Webtatic)設定
# rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
• PHPインストール
# yum install --enablerepo=webtatic-testing php70w ¥
ServerSSL: mod_sslの準備
• Mod_SSLをインストール
# yum install mod_ssl
• 名前ベースの仮想ホスト設定
# vi /etc/httpd/conf.d/ssl.conf
# SSL Virtual Host Context
NameVirtualHost *:443
#<VirtualHost _default_:443>
<VirtualHost *:443>
WebSiteの準備
# cat > /etc/httpd/conf.d/vhost-newlets.postgresql.jp.conf<<eof <virtualhost *:443> servername newlets.postgresql.jp serveradmin [email protected] documentroot "/var/vhosts/newlets.postgresql.jp/html" <directory /var/vhosts/newlets.postgresql.jp/html> allowoverride all#require all granted ←ここをベーシック認証設定に置き換える </directory>
errorlog logs/vhost-newlets.postgresql.jp-error_log
customlog logs/vhost-newlets.postgresql.jp-access_log common customlog logs/vhost-newlets.postgresql.jp-request_log ¥ "%t %h %{ssl_protocol}x %{ssl_cipher}x ¥"%r¥" %b“ sslengine on sslprotocol +tlsv1.2 +tlsv1.1 +tlsv1 sslciphersuite all:!adh:!export:!sslv2:rc4+rsa:+high:+medium:+low sslcertificatefile /etc/pki/tls/certs/wildcard.postgresql.jp.crt sslcertificatekeyfile /etc/pki/tls/private/wildcard.postgresql.jp-nopass.key sslcertificatechainfile /etc/pki/tls/certs/rapidssl-chain.crt # ... 省略(既存のssl.conf のssl設定を参照) ... </virtualhost> eof