• 検索結果がありません。

Lets移行プラットホーム

N/A
N/A
Protected

Academic year: 2021

シェア "Lets移行プラットホーム"

Copied!
15
0
0

読み込み中.... (全文を見る)

全文

(1)

Lets移行プラットホーム

の準備

PostgreSQL 9.6 と Drupal8 CMS のインストール

JPUG 合宿 2016山鹿

2016-10-02

2016-10-04 改訂

2016-11-23 第2訂

(2)

改訂履歴

日付

内容

担当

備考

2016-10-02 初版

桑村

2016-10-03 PHPレポジトリ変更(REMI → Webtatic)

桑村

2016-10-04 Drupal8インストールを追加

桑村

2016-11-23 Webatic の前に EPELインストールを追加

桑村

変更時欠落

(3)

プラットホーム諸元

• OS: CentOS 7 (CentOS6の開発は2020年終了と間近)

• DBMS: PostgreSQL 9.6(リリース直後だけど、JPUGなので)

• WebServer: Apache 2.4(ディストリビューション標準)

• ServerSSL: mod_ssl (

、TLS1.2)

• ServerEngine: PHP 7 (速いらしい)

(4)

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

(5)

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.

(6)

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.

(7)

Drupal8用DBの準備

• PostgreSQLロール: drupal

• データベース: d8lets

# sudo -u postgres /usr/pgsql-9.6/bin/createuser drupal -W

Password: xxxxxxxx

(8)

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 ¥

(9)

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>

(10)

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

(11)

WebSiteのベーシック認証

• サイト構築過程では、閲覧を制限、ベーシック認証を設置

# vi /etc/httpd/conf.d/vhost-newlets.postgresql.jp.conf

AuthUserFile /var/vhosts/newlets.postgresql.jp/htpasswd

AuthGroupFile /dev/null

AuthName "Restricted area"

AuthType Basic

require valid-user

• サイト構築過程では、閲覧を制限、ベーシック認証を設置

(12)

WebServiceの再起動

• httpd の再起動

# systemctl restart httpd.service

(従来の`service httpd restart`も利用可能、上記コマンドの推奨が表示される)

• httpd の自動起動設定

# systemctl enable httpd.service

Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to

/usr/lib/systemd/system/httpd.service.

(13)

WebCMS: Drupal8の準備

• プログラムの展開

# mkdir -p /var/vhosts/newlets.postgresql.jp

# cd /var/vhosts/newlets.postgresql.jp

# wget https://ftp.drupal.org/files/projects/drupal-8.1.10.tar.gz

# tar xvfz drupal-8.1.10.tar.gz

# chown -R apache drupal-8.1.10/

# ln -sf drupal-8.1.10 html

• ブラウザで https://newlets.postgresql.jp にアクセス、インストー

ル開始

• 途中、DBMSにPostgreSQLを指定して、先に作成したアカウントを

設定

(14)

Drupal8サイト構築の基本設定

• 構成ファイルに信頼できるホストパターンを追加

# cat >>/var/vhosts/vhosts-newlets.postgresql.jp/html/sites/default/settings.conf<<EOF

# site domain name:

$settings['trusted_host_patterns'] = array(

'^newlets¥.postgresql¥.jp$',

);

EOF

• 再びブラウザで、https://newlets.postgresql.jp にアクセスし基本設定

• ≫拡張機能 、"Book" モジュールをチェックし「インストール」

• ≫サイト構築≫コンテンツタイプ 、基本ページの「フィールド管理」でファイルア

ップロード用のフィールドを追加

(15)

まとめ

• CentOS7.2上に、

Apache2.4+PHP7.0+Drupal8.1+PostgreSQL9.6(おそらく最新

版セット)のインストールはコンパイルすることなくできた

• CentOS7.2のサービス制御系には、まだ互換コマンドが残って

いて助かる(service, chkconfig等)

• PostgreSQL9.6のインストールに、PGDGリポジトリは定番。

ただし、initdbは手動(オプションに注意)

• Drupal8のためのPHP7のリポジトリは、Remiではなく

Webtaticが簡単だった

参照

関連したドキュメント

In economics, the macroscopic behaviour of the economy is assumed to result from the aggregate effects of producers attempting to maximize their profits, and of customers attempting

Zheng and Yan 7 put efforts into using forward search in planning graph algorithm to solve WSC problem, and it shows a good result which can find a solution in polynomial time

Another new aspect of our proof lies in Section 9, where a certain uniform integrability is used to prove convergence of normalized cost functions associated with the sequence

Internet Fraud by Fake Warnings 6 Business Service Outage Caused by Denial of Service Attacks Unauthorized Use of Internet Banking. Credentials 7 User Information Leakage from

Continuous Improvement, Contract Review, Quality System Mgmt, Customer Service, Product Design, Process Design, Engineering, Finance,.

申込共通① 申込共通② 申込共通③ 申込共通④ 申込完了

With the target of universal health coverage, it is urgent need to enhance the health service provision with development of health workforce in order to meet the demand along

In our opinion, the financial statements referred to above present fairly, in all material respects, the consolidated financial position of The Tokyo Electric Power