概要
ここでは、concrete5の実際のインストール作業を行なっていきます。
事前準備として、CentOSやNginx,PHP,MySQLなどの環境が構築済みであることが必要です。
ここでの手順は、以下の手順の通り環境構築が完了していることを前提とします。
concrete5 (version 8)を CentOS8の環境に構築する①
また、インストールはComposerを利用しようと思います。
環境情報
- Vagrant 2.2.7
- VirtualBox 6.1
- CentOS 8.1
- Nginx 1.17.8
- PHP 7.4.3
- MySQL 8.0.17
- Composer 1.9.3
Composerをインストール
# dnf -y install wget
# cd /usr/local/src
# wget https://getcomposer.org/installer -O composer-installer.php
# php composer-installer.php --filename=composer --install-dir=/usr/local/bin
# composer -V
Composer version 1.9.3 2020-02-04 12:58:49
いよいよconcrete5をインストール
インストールの手順の参考としては以下のREADME.mdです。
https://github.com/concrete5/composer
/var/www/concrete5はいったん不要なので削除して、インストール作業を進めていきます。
# cd /var/www
# rm -rf ./concrete5
# composer create-project -n concrete5/composer concrete5
なんか怒られた。。。
the requested PHP extension gd is missing from your system.のエラー
Installing concrete5/composer (v1.1.9)
- Installing concrete5/composer (v1.1.9): Downloading (100%)
Created project in concrete5
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- concrete5/core 8.2.0 requires dapphp/securimage 3.* -> satisfiable by dapphp/securimage[3.5.4, 3.6, 3.6.1, 3.6.2, 3.6.3, 3.6.4, 3.6.5, 3.6.6, 3.6.7].
- concrete5/core 8.2.1 requires dapphp/securimage 3.* -> satisfiable by dapphp/securimage[3.5.4, 3.6, 3.6.1, 3.6.2, 3.6.3, 3.6.4, 3.6.5, 3.6.6, 3.6.7].
- concrete5/core 8.3.0 requires dapphp/securimage 3.* -> satisfiable by dapphp/securimage[3.5.4, 3.6, 3.6.1, 3.6.2, 3.6.3, 3.6.4, 3.6.5, 3.6.6, 3.6.7].
- concrete5/core 8.3.1 requires dapphp/securimage 3.* -> satisfiable by dapphp/securimage[3.5.4, 3.6, 3.6.1, 3.6.2, 3.6.3, 3.6.4, 3.6.5, 3.6.6, 3.6.7].
- concrete5/core 8.3.2 requires dapphp/securimage 3.* -> satisfiable by dapphp/securimage[3.5.4, 3.6, 3.6.1, 3.6.2, 3.6.3, 3.6.4, 3.6.5, 3.6.6, 3.6.7].
- concrete5/core 8.4.0 requires dapphp/securimage 3.* -> satisfiable by dapphp/securimage[3.5.4, 3.6, 3.6.1, 3.6.2, 3.6.3, 3.6.4, 3.6.5, 3.6.6, 3.6.7].
- concrete5/core 8.4.1 requires dapphp/securimage 3.* -> satisfiable by dapphp/securimage[3.5.4, 3.6, 3.6.1, 3.6.2, 3.6.3, 3.6.4, 3.6.5, 3.6.6, 3.6.7].
- concrete5/core 8.4.2 requires dapphp/securimage 3.* -> satisfiable by dapphp/securimage[3.5.4, 3.6, 3.6.1, 3.6.2, 3.6.3, 3.6.4, 3.6.5, 3.6.6, 3.6.7].
- concrete5/core 8.4.3 requires dapphp/securimage 3.* -> satisfiable by dapphp/securimage[3.5.4, 3.6, 3.6.1, 3.6.2, 3.6.3, 3.6.4, 3.6.5, 3.6.6, 3.6.7].
- concrete5/core 8.4.4 requires dapphp/securimage 3.* -> satisfiable by dapphp/securimage[3.5.4, 3.6, 3.6.1, 3.6.2, 3.6.3, 3.6.4, 3.6.5, 3.6.6, 3.6.7].
- concrete5/core 8.4.5 requires dapphp/securimage 3.* -> satisfiable by dapphp/securimage[3.5.4, 3.6, 3.6.1, 3.6.2, 3.6.3, 3.6.4, 3.6.5, 3.6.6, 3.6.7].
- concrete5/core 8.5.0 requires dapphp/securimage 3.* -> satisfiable by dapphp/securimage[3.5.4, 3.6, 3.6.1, 3.6.2, 3.6.3, 3.6.4, 3.6.5, 3.6.6, 3.6.7].
- concrete5/core 8.5.1 requires dapphp/securimage 3.* -> satisfiable by dapphp/securimage[3.5.4, 3.6, 3.6.1, 3.6.2, 3.6.3, 3.6.4, 3.6.5, 3.6.6, 3.6.7].
- concrete5/core 8.5.2 requires dapphp/securimage 3.* -> satisfiable by dapphp/securimage[3.5.4, 3.6, 3.6.1, 3.6.2, 3.6.3, 3.6.4, 3.6.5, 3.6.6, 3.6.7].
- dapphp/securimage 3.6.7 requires ext-gd * -> the requested PHP extension gd is missing from your system.
- dapphp/securimage 3.6.6 requires ext-gd * -> the requested PHP extension gd is missing from your system.
- dapphp/securimage 3.6.5 requires ext-gd * -> the requested PHP extension gd is missing from your system.
- dapphp/securimage 3.6.4 requires ext-gd * -> the requested PHP extension gd is missing from your system.
- dapphp/securimage 3.6.3 requires ext-gd * -> the requested PHP extension gd is missing from your system.
- dapphp/securimage 3.6.2 requires ext-gd * -> the requested PHP extension gd is missing from your system.
- dapphp/securimage 3.6.1 requires ext-gd * -> the requested PHP extension gd is missing from your system.
- dapphp/securimage 3.6 requires ext-gd * -> the requested PHP extension gd is missing from your system.
- dapphp/securimage 3.5.4 requires ext-gd * -> the requested PHP extension gd is missing from your system.
- Installation request for concrete5/core ^8.2 -> satisfiable by concrete5/core[8.2.0, 8.2.1, 8.3.0, 8.3.1, 8.3.2, 8.4.0, 8.4.1, 8.4.2, 8.4.3, 8.4.4, 8.4.5, 8.5.0, 8.5.1, 8.5.2].
To enable extensions, verify that they are enabled in your .ini files:
- /etc/php.ini
- /etc/php.d/20-bz2.ini
- /etc/php.d/20-calendar.ini
- /etc/php.d/20-ctype.ini
- /etc/php.d/20-curl.ini
- /etc/php.d/20-dom.ini
- /etc/php.d/20-exif.ini
- /etc/php.d/20-fileinfo.ini
- /etc/php.d/20-ftp.ini
- /etc/php.d/20-gettext.ini
- /etc/php.d/20-iconv.ini
- /etc/php.d/20-json.ini
- /etc/php.d/20-mbstring.ini
- /etc/php.d/20-mysqlnd.ini
- /etc/php.d/20-pdo.ini
- /etc/php.d/20-phar.ini
- /etc/php.d/20-simplexml.ini
- /etc/php.d/20-sockets.ini
- /etc/php.d/20-sqlite3.ini
- /etc/php.d/20-tokenizer.ini
- /etc/php.d/20-xml.ini
- /etc/php.d/20-xmlwriter.ini
- /etc/php.d/20-xsl.ini
- /etc/php.d/30-mysqli.ini
- /etc/php.d/30-pdo_mysql.ini
- /etc/php.d/30-pdo_sqlite.ini
- /etc/php.d/30-xmlreader.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
とりあえず、気になる部分として
the requested PHP extension gd is missing from your system.
こんな指摘があるので、php-gdというものを入れてみる。
# dnf install -y php-gd
気を取り直して再度Composerを実行
# cd /var/www
# rm -rf ./concrete5
# composer create-project -n concrete5/composer concrete5
...
Package zendframework/zend-eventmanager is abandoned, you should avoid using it. Use laminas/laminas-eventmanager instead.
Package zendframework/zend-stdlib is abandoned, you should avoid using it. Use laminas/laminas-stdlib instead.
Package zendframework/zend-hydrator is abandoned, you should avoid using it. Use laminas/laminas-hydrator instead.
Package zendframework/zend-code is abandoned, you should avoid using it. Use laminas/laminas-code instead.
Package league/url is abandoned, you should avoid using it. Use league/uri instead.
Package zendframework/zend-i18n is abandoned, you should avoid using it. Use laminas/laminas-i18n instead.
Package zendframework/zend-escaper is abandoned, you should avoid using it. Use laminas/laminas-escaper instead.
Package zendframework/zend-feed is abandoned, you should avoid using it. Use laminas/laminas-feed instead.
Package container-interop/container-interop is abandoned, you should avoid using it. Use psr/container instead.
Package zendframework/zend-validator is abandoned, you should avoid using it. Use laminas/laminas-validator instead.
Package zendframework/zend-uri is abandoned, you should avoid using it. Use laminas/laminas-uri instead.
Package zendframework/zend-loader is abandoned, you should avoid using it. Use laminas/laminas-loader instead.
Package zendframework/zend-http is abandoned, you should avoid using it. Use laminas/laminas-http instead.
Package zendframework/zend-servicemanager is abandoned, you should avoid using it. Use laminas/laminas-servicemanager instead.
Package zendframework/zend-cache is abandoned, you should avoid using it. Use laminas/laminas-cache instead.
Package zendframework/zend-mime is abandoned, you should avoid using it. Use laminas/laminas-mime instead.
Package zendframework/zend-mail is abandoned, you should avoid using it. Use laminas/laminas-mail instead.
Writing lock file
Generating autoload files
Warning: Ambiguous class resolution, "Normalizer" was found in both "/var/www/concrete5/vendor/patchwork/utf8/src/Normalizer.php" and "/var/www/concrete5/vendor/voku/portable-utf8/src/Normalizer.php", the first will be used.
Carbon 1 is deprecated, see how to migrate to Carbon 2.
https://carbon.nesbot.com/docs/#api-carbon-2
You can run './vendor/bin/upgrade-carbon' to get help in updating carbon and other frameworks and libraries that depend on it.
ocramius/package-versions: Generating version class...
ocramius/package-versions: ...done generating version class
Gathering patches from concrete5/dependency-patches (extra.patches).
Applying patch concrete5/dependency-patches/Fix minus in regular expressions to sunra/php-simple-html-dom-parser... sh: patch: command not found
Applying patch concrete5/dependency-patches/Fix continue switch in FileGenerator and MethodReflection to zendframework/zend-code... sh: patch: command not found
Applying patch concrete5/dependency-patches/Remove support for the X-Original-Url and X-Rewrite-Url headers to zendframework/zend-http... sh: patch: command not found
Applying patch concrete5/dependency-patches/Fix idn_to_ascii deprecation warning to zendframework/zend-mail... sh: patch: command not found
Applying patch concrete5/dependency-patches/Fix ArrayObject::unserialize() to zendframework/zend-stdlib... sh: patch: command not found
patchコマンドがないよ
# dnf install -y patch
エラーではなさそうなので、無視してconcrete5のインストールを進めていきます。
concrete5のインストールを進めようとすると、Zipが必要だよと怒られます。
# cd /var/www/concrete5
# ./vendor/bin/concrete5 c5:install -i
...
...
- Zip Support... Downloading zipped files from the file manager, remote updating and marketplace integration requires the Zip extension.
php-zipをインストールして再チャレンジします。
# dnf install -y php-zip
# cd /var/www/concrete5
# ./vendor/bin/concrete5 c5:install -i
Zipのエラーは解消したのですが、
インストールする前に、MySQLにconcrete5用のデータベースを事前に作成する必要があるようです。
データベースの中身は空である必要があります。
データベースに1つでもテーブルがあると、以下のようなメッセージが出て怒られます。
- Database should be empty... There is already 1 table in this database. concrete5 must be installed in an empty database.
また、空のデータベースを事前に作成せず、適当な名前のデータベース名を指定してインストールをしようとすると、怒られます。
SQLSTATE[HY000] [1049] Unknown database 'concrete5db'
なので、concrete5が利用する空のデータベースを作成しておきます。
# mysql -u root -p
mysql> create database concrete5db;
mysql> quit
concrete5のインストールを実行します。
# cd /var/www/concrete5
# ./vendor/bin/concrete5 c5:install -i
Checking required preconditions:
- PHP 5.5.9... passed (you are running PHP version 7.4.3).
- MySQL PDO Extension Enabled... passed.
- JSON Extension Enabled... passed.
- DOM Extension Enabled... passed.
- ASP Style Tags Disabled... passed.
- Fileinfo Extension Enabled... passed.
- Image Manipulation Available... passed.
- XML Support... passed.
- Writable Files and Configuration Directories... passed.
- Internationalization Support... passed.
- PHP Comments Preserved... passed.
- Tokenizer Extension Enabled... passed.
- Memory limit 64.00 MB.... passed (current memory limit: 256.00 MB).
Checking optional preconditions:
- Remote File Importing... passed.
- Zip Support... passed.
Location of database server? [127.0.0.1]:
Database name?: concrete5db
Database username?: mysqluser
Database password?:
The system time zone, compatible with the database one? [Asia/Tokyo]:
Name of the site? [concrete5 Site]:
Canonical URL?:
Alternative canonical URL?:
Starting point to use? [elemental_blank]:
[0] elemental_blank
[1] elemental_full
> 1
Email of the admin user of the install? [admin@example.com]: {メールアドレス}
Password of the admin user of the install?:
Additional user username?: {ユーザー名}
Additional user email? [demo@example.com]: {メールアドレス}
Additional user password?:
The default concrete5 interface language (eg en_US)? [en_US]: ja_JP
The default site locale (eg en_US)? [ja_JP]:
Use configuration file for installation? [none]:
Checking required configuration preconditions:
- Canonical URLs... passed.
- Database should be empty... passed.
- MySQL InnoDB engine... passed.
- Starting Point... passed.
Checking optional configuration preconditions:
- Database time zone... passed.
- Table case... passed (Table names are stored in the specified lettercase (lookups are performed in a case-sensitive way).).
- Database should support the configured character set and collation... passed (The database supports the "utf8mb4" character set and the "utf8mb4_unicode_ci" collation.).
+---------------------------+------------------------------------+
| Question | Value |
+---------------------------+------------------------------------+
| env | |
| db-server | 127.0.0.1 |
| db-username | mysqluser |
| db-password | HIDDEN |
| db-database | concrete5db |
| timezone | Asia/Tokyo |
| site | concrete5 Site |
| canonical-url | |
| canonical-url-alternative | |
| starting-point | elemental_full |
| admin-email | {mailaddress} |
| admin-password | HIDDEN |
| demo-username | {username} |
| demo-password | HIDDEN |
| demo-email | {mailaddress} |
| language | ja_JP |
| site-locale | ja_JP |
| config | none |
+---------------------------+------------------------------------+
Would you like to install with these settings? [Y]es / [N]o / [E]dit: y
5%: Starting installation and creating directories.
19%: Creating database tables.
20%: Creating site.
21%: Adding admin user.
22%: Installing permissions & workflow.
23%: Installing Custom Data Objects.
24%: Creating home page.
25%: Installing attributes.
38%: Adding Basic block types.
42%: Adding Navigation block types.
45%: Adding Form block types.
48%: Adding Express block types.
51%: Adding Social block types.
54%: Adding Calendar block types.
57%: Adding Multimedia block types.
61%: Adding Desktop block types.
64%: Adding other block types.
66%: Adding gathering data sources.
67%: Page type basic setup.
68%: Adding themes.
69%: Installing automated jobs.
78%: Installing dashboard.
79%: Installing login and registration pages.
80%: Adding image editor functionality.
81%: Configuring site.
82%: Importing files.
83%: Adding pages and content.
92%: Adding desktops.
93%: Installing API.
94%: Setting site permissions.
95%: Finishing.
Adding demo user... done.
Installation Complete!
これでインストールできたと思います。
以下のURLにアクセスして動作確認してみます。
403 Forbidden
ん?
面倒なのでrootでずっと作業していたため、nginxユーザーで/var/www/concrete5にアクセスできないことが原因か??
# chown -R nginx:nginx /var/www/concrete5
もう一度アクセス
それでも
403 Forbidden
そういえば、nginxの設定でルートディレクトリを/var/www/concrete5
に設定していたが、
実際に当該ディレクトリ配下を確認するとindex.php
などのファイルが無いので、403が出ているのか?
# cd /var/www/concrete5/public
# ls -la
total 12
drwxr-xr-x. 5 nginx nginx 74 3月 6 07:31 .
drwxr-xr-x. 7 nginx nginx 4096 3月 6 07:32 ..
drwxr-xr-x. 17 nginx nginx 263 10月 3 04:58 application
drwxr-xr-x. 22 nginx nginx 4096 3月 6 07:31 concrete
-rw-r--r--. 1 nginx nginx 42 10月 3 04:58 index.php
drwxr-xr-x. 2 nginx nginx 24 10月 3 04:58 packages
今度は以下のURLにアクセス
http://192.168.33.10/public

データベース接続に問題があるようなので、設定を確認してみる。
# cd /var/www/concrete5/public/application/config
# less database.php
<?php
return [
'default-connection' => 'concrete',
'connections' => [
'concrete' => [
'driver' => 'c5_pdo_mysql',
'server' => '127.0.0.1',
'database' => 'concrete5db',
'username' => 'mysqluser',
'password' => 'MySQL00#$%',
'character_set' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
],
],
];
ここに設定されている内容の通りにアクセスできるのか確認。
# mysql -h 127.0.0.1 -u mysqluser -pMySQL00#$% concrete5db
mysql> show tables;
+-----------------------------------------------------+
| Tables_in_concrete5db |
+-----------------------------------------------------+
| AreaLayoutColumns |
| AreaLayoutCustomColumns |
......
| btYouTube |
| gaPage |
+-----------------------------------------------------+
329 rows in set (0.01 sec)
mysql> select count(*) cnt from Config;
+-----+
| cnt |
+-----+
| 4 |
+-----+
1 row in set (0.08 sec)
接続できることを確認。。。
ん〜、、、、
さらに探してみると
https://github.com/concrete5/concrete5/issues/7311
MySQLのonly_full_group_byの設定が問題だよ。という記事を発見。
mysql> SELECT @@global.sql_mode;
+-----------------------------------------------------------------------------------------------------------------------+
| @@global.sql_mode |
+-----------------------------------------------------------------------------------------------------------------------+
| ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION |
+-----------------------------------------------------------------------------------------------------------------------+
1 row in set (0.01 sec)
ONLY_FULL_GROUP_BY
というのが設定されていることを確認。
この設定を取り除くと良いみたいなので、設定から除去。
# cd /etc/my.cnf.d/
# ls
charset.cnf mysql-default-authentication-plugin.cnf
client.cnf mysql-server.cnf
# vim sqlmode.cnf
[mysqld]
sql-mode = STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
# systemctl stop mysqld
# systemctl start mysqld
再度アクセス
http://192.168.33.10/public
ダメだ。。。
# vim /var/www/concrete5/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php
色々試していると、、、
SELinuxを無効にしたら少し進んだ。
# setenforce 0

やっとうまくいった。
...
In simple_html_dom.php line 1378:
preg_match(): Compilation failed: invalid range in character class at offset 4
# vim /var/www/concrete5/vendor/sunra/php-simple-html-dom-parser/Src/Sunra/PhpSimple/simplehtmldom_1_5/simple_html_dom.php
こんな問題
https://cafe-system.com/system2237.html
以下からダウンロードしたsimple_html_dom.php
を上書き保存してみればうまくいくのか?
https://sourceforge.net/projects/simplehtmldom/files/simplehtmldom/1.9.1/simplehtmldom_1_9_1.zip/download
これでもうまくいかない。
とりあえず、全ての環境が最新だと現状はうまく環境構築できないのかな。