将EMLauncher安装到CentOS8

将EMLauncher安装到CentOS8中。

以下是在假设以最小配置安装了CentOS8的情况下的说明。
在CentOS上运行EMLauncher,并进行环境设置,将包上传到LocalFile。

次のサイトを参考にさせて頂きました。
1. GitHub KLab/emlauncherのREADME
※この記事は、 GitHub KLab/emlauncherのREADMEを元に、CentOS8用に修正、加筆させて頂きました。
2. EMLauncherをVagrant/CentOS環境で試してみる(未完成)

安装所需的软件包

// remiリポジトリの追加
// ※標準のPHPパッケージには"php-pecl-imagick php-pecl-memcached"がないのでremiをインストールする必要がある。
# dnf install httpd mariadb-server memcached

// インストールするPHPのバージョンを指定
// ※ "dnf list | grep remi | grep php" でインストール可能なPHPバージョンを確認できる。
# dnf module install -y php:remi-7.4
// ※既にPHPがインストールされている場合は、"dnf module disable php"を実行し無効化することが出来る。
# dnf install  php-gd php-mbstring php-xml php-pecl-imagick php-pecl-memcached php-pecl-zip php-pdo php-mysqlnd git

# curl -sS https://getcomposer.org/installer | php
# cp composer.phar /usr/local/bin/composer

部署代码

# cd /var/www//html
# git clone https://github.com/KLab/emlauncher.git
# cd emlauncher
# git submodule init
# git submodule update
# composer install
# cd /var/www//html
# chown -R apache:apache emlauncher

安装Apache

// /var/www/html/emlauncher/web/.htaccess内の下記の内容をコメントアウトして/etc/php.iniに記載
// ※CentOS8ではphp-fpmが使用されているので、htaccess内で記載するとエラーになるため
// .htaccessでコメントにする内容
#php_flag short_open_tag On
#php_value memory_limit "4G"
#php_value upload_max_filesize "4G"
#php_value post_max_size "4G"
#php_value max_execution_time 300
#php_value max_input_time 300

// /etc/php.iniで記載する内容の差分
# diff php.ini.orig php.ini
187c187,188
< short_open_tag = Off
---
> ;short_open_tag = Off
> short_open_tag = On
388c389,390
< max_execution_time = 30
---
> ;max_execution_time = 30
> max_execution_time = 300
398c400,401
< max_input_time = 60
---
> ;max_input_time = 60
> max_input_time = 300
409c412,413
< memory_limit = 128M
---
> ;memory_limit = 128M
> memory_limit = 4G
694c698,699
< post_max_size = 8M
---
> ;post_max_size = 8M
> post_max_size = 4G
846c851,852
< upload_max_filesize = 2M
---
> ;upload_max_filesize = 2M
> upload_max_filesize = 4G

编辑/etc/httpd/conf/httpd.conf。

// 下記の内容を追加
SetEnv MFW_ENV 'ec2'
<Directory "/var/www/html">
  // 次の2か所を変更
  Options FollowSymLinks
  AllowOverride All
  ...略...
</Directory>
# sudo systemctl start httpd
# sudo systemctl enable httpd

数据库配置

# sudo systemctl start mariadb
# sudo systemctl enable mariadb

创建一个包含数据库用户名和密码的文件。
例如:

// DB名:パスワード
# echo 'emlauncher:sample_password' > $HOME/dbauth

将data/sql/database.sql文件中的内容与dbauth的密码匹配,并将其导入MySQL数据库。

# mysql -uroot < /path/to/emlauncher/data/sql/database.sql
# mysql -uroot emlauncher < /path/to/emlauncher/data/sql/tables.sql

Memcache安装设置

# sudo systemctl start memcached
# sudo systemctl enable memcached

配置

编辑mfw_serverevn_config.php文件

# /var/www/html/emlauncher/config
# cp emlauncher_config_sample.php emlauncher_config.php

// 例:編集する内容の差分
// アップロードするパッケージの保管場所を"/var/www/html/emlauncher-files"とする場合
# diff emlauncher_config_sample.php emlauncher_config.php 
67c67,68
<               'storage_class' => 'S3',
---
>               //'storage_class' => 'S3',
>               'storage_class' => 'LocalFile',
96c97,98
<                       'path' => '/path/to/directory',
---
>                       //'path' => '/path/to/directory',
>                       'path' => '/var/www/html/emlauncher-files',
99c101,102
<                       'url_prefix' => '/path/for/url',
---
>                       //'url_prefix' => '/path/for/url',
>                       'url_prefix' => '/emlauncher-files',

编辑 mfw_serverenv_config.php

# cd /var/www/html/emlauncher/config
# cp mfw_serverenv_config_sample.php mfw_serverenv_config.php 
// 例:編集する内容の差分
# diff mfw_serverenv_config_sample.php mfw_serverenv_config.php 
23c23,24
<                       'authfile' => '/path/to/dbauth-file',
---
>                       //'authfile' => '/path/to/dbauth-file',
>                       'authfile' => '/home/emlauncher/dbauth',

在Android App Bundle上配置bundletool。

※この手順に関しては、行っていないので、必用であれば、GitHub KLab/emlauncherのREADMEを参照して下さい。

postfixとファイアウォールの設定

EMLauncherはsendmailを使用するので、メールが送信できるように、postfixをインストール、設定して下さい。
必用に応じて、ファイアウォールのhttps, httpのポート開放を行って下さい。

※EMLauncherから”forgot password”等でメールを送る際、”mb_send_mail faild”となる場合はSELinuxで引っかかっているので、次のコマンドを実行してみて下さい。

# setsebool -P httpd_can_sendmail=1

完成

在浏览器中通过HTTP访问实例。一旦显示EMLauncher的登录页面,就完成了。
http://hostname/emlauncher/web

用户注册

// MySQLでemlauncherデータベースに対して、下記のコマンドでユーザ登録を行う。
INSERT INTO user_pass (mail) VALUES ('hogeuser@hogehoge.jp');

用户注册后,在浏览器中打开EMLauncher并通过“忘记密码”进行密码设置。

如果要在CentOS7上进行安装的话

// yumでパッケージのインストールを下記のように行って下さい。
# yum -y  install https://rpms.remirepo.net/enterprise/remi-release-7.rpm
# yum install --enablerepo=remi,remi-php74  php-gd php-mbstring php-xml php-pecl-imagick php-pecl-memcached php-pecl-zip php-pdo php-mysqlnd git php
bannerAds