LoginSignup
0
0

More than 3 years have passed since last update.

EMLauncher を CentOS 8 に導入する手順

Posted at

EMLauncherをCentOS8に導入する手順

この手順書はCentOS8にKLabさんのAndroid/iOSのテストアプリ配信ツールのEMLauncherを導入する手順書となります。

※ この手順書を書く時に使ってるCentOSのバージョンは8.1.1911です。

参考サイト

EmLauncherの導入

※ 以下の処理はすべてrootユーザでログインして実行してください。

1. Firewall setup

  1. http(80)のポートを開放します。

    firewall-cmd --zone=public --add-port=80/tcp --permanent
    systemctl restart firewalld
    

2. Install required packages

  1. EPELリポジトリを追加します。

    dnf -y install epel-release
    
  2. Remiリポジトリを追加します。

    dnf -y install http://rpms.famillecollet.com/enterprise/remi-release-8.rpm
    
  3. PHP 7.4 インストールします。

    dnf -y module install php:remi-7.4
    
  4. その他パッケージをインストールします。

    dnf -y install httpd mariadb-server memcached php-gd php-mbstring php-xml php-pecl-imagick php-pecl-memcached php-pecl-zip php-pdo php-mysqlnd git
    
  5. Composerをインストールします。

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

3. Deploy codes

  1. GitHubからemlauncherをクローンします。

    cd /var/www/html
    git clone https://github.com/KLab/emlauncher.git
    
  2. サブモジュールを初期化して、更新します。

    cd emlauncher
    git submodule init && git submodule update
    
  3. Composerで関連パッケージをインストールします。

    composer install
    
  4. Apacheがemlauncherにアクセスできるようにパーミッションを調整します。

    chown -R apache:apache /var/www/html/emlauncher
    

4. Apache setup

※ CentOS8ではphp-fpmが使用されているので、.htaccess内で記載するとエラーになるため.htaccess内の設定をコメントアウトして/etc/php.iniに設定する必要があります。

  1. emlauncher/web/.htaccessを編集します。

    vim /var/www/html/emlauncher/web/.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
    
  2. /etc/php.iniを編集します。

    vim /etc/php.ini
    

    .htaccess内でコメントアウトした設定を以下のように設定します。

    short_open_tag = On
    max_execution_time = 300
    max_input_time = 300
    memory_limit = 4G
    post_max_size = 4G
    upload_max_filesize = 4G
    
  3. Apacheの設定ファイル/etc/httpd/conf/httpd.confを編集します。

    vim /etc/httpd/conf/httpd.conf
    

    下記のように修正します。

    SetEnv MFW_ENV 'ec2'
    <Directory "/var/www/html">  
        Options FollowSymLinks  
        AllowOverride All  
        ...略...  
    </Directory>
    
  4. httpdを有効にします。

    systemctl start httpd && systemctl enable httpd
    

5. Database setup

  1. Databaseを有効にします。

    systemctl start mariadb && systemctl enable mariadb
    
  2. Databaseのユーザ名とパスワードを記載したdbauthファイル作成します。

    echo 'emlauncher:password' > /var/www/html/dbauth
    

    ※ 上記のpassword部分を置き換えてから実行してください。

  3. emlauncher/data/sql/database.sql内のxxxxxxxxの部分をdbauthのパスワードに合わせて修正します。

    vim /var/www/html/emlauncher/data/sql/database.sql
    
  4. emlauncherのdatabase設定をMySQLに流します。

    mysql -u root < /var/www/html/emlauncher/data/sql/database.sql
    mysql -u root emlauncher < /var/www/html/emlauncher/data/sql/tables.sql
    

6. Memcache setup

  1. Memcacheを有効にします。

    systemctl start memcached && systemctl enable memcached
    

7. Setup bundletool for Android App Bundle

APKを再署名するためのキーストアは必要ないのでスキップします。

※ 必要の場合はKLab/emlauncherのREADMEを参照して設定してください。

8. Configuration

mfw_serverevn_config.php

  1. config/mfw_serverenv_config_sample.phpをコピーし、$serverenv_config['ec2']['database']['authfile']を 5で作成したdbauthファイルのパスに書き換えます。

    cd /var/www/html/emlauncher/config
    cp mfw_serverenv_config_sample.php mfw_serverenv_config.php
    vim mfw_serverenv_config.php
    

    dbauthファイルパスを書き換えます。

    'authfile' => '/var/www/html/dbauth',
    

emlauncher_config.php

  1. 保存用ディレクトリを作成します。

    mkdir /var/www/html/emlauncher-files
    
  2. Apacheが保存用ディレクトリにアクセスできるようにパーミッションを調整します。

    chown -R apache:apache /var/www/html/emlauncher-files
    
  3. config/emlauncher_config_sample.phpをコピーし、自身の環境に合わせて書き換えます。

    cd /var/www/html/emlauncher/config
    cp emlauncher_config_sample.php emlauncher_config.php
    vim emlauncher_config.php
    

    以下のように修正します。

    'storage_class' => 'LocalFile',
    'path' => '/var/www/html/emlauncher-files',  
    'url_prefix' => '../../../emlauncher-files',
    

9. Complete

ブラウザでEMLauncherのログインページ「 http://仮想マシンのアドレス(192.168.xxx.xxx)/emlauncher/web/login 」が表示されたらEMLauncherの導入が完了です。

ユーザ登録する方法

  1. Mysqlに接続します。パスワードはdbauthで設定したパスワードです。

    mysql -u emlauncher -p emlauncher
    
  2. ユーザのメールをuser_passテーブルに登録します。

    INSERT INTO user_pass (mail) VALUES ('hoge@hoge.jp');
    

    hoge@hoge.jpを自分のメールに置き換えて実行してください。

  3. Mysqlから抜けます。

    exit
    
  4. EMLauncherのログインページのforgot passwordからパスワードをリセットします。

メール送信について

・EMLauncherはsendmailを使用するので、メールが送信できるように、postfixをインストール、設定してください。

  1. postfixをインストールします。

    dnf -y install postfix
    
  2. postfixを有効にします。

    systemctl start postfix && systemctl enable postfix
    

・メールを送る際、"mb_send_mail faild"とエラーが表示された場合SELinuxを無効にしてください。

  1. SELinuxを一時的に無効にします。

    setenforce 0
    
  2. SELinuxの設定ファイルの編集で永続的に無効にします。

    vim /etc/selinux/config
    

    SELINUXenforcingからdisableに変更します。
    SELINUX=disable

・メール送信したけど届かない場合

私の場合はOutbound Port 25 Blockingが原因でしたのでGmailで転送する事で解決しました。

  1. Postfixから転送するために、転送用Gmailアカウントのセキュリティ設定ページで「安全性の低いアプリのアクセス」を有効にしてください。

  2. postfixの設定ファイルにGmailで転送する設定を追加します。

    vim /etc/postfix/main.cf
    

    一番最後に以下の設定を追加します。

    # Gmail
    relayhost = [smtp.gmail.com]:587  
    smtp_use_tls = yes  
    smtp_tls_CApath = /etc/pki/tls/certs/ca-bundle.crt  
    smtp_sasl_auth_enable = yes  
    smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd  
    smtp_sasl_tls_security_options = noanonymous  
    smtp_sasl_mechanism_filter = plain  
    
  3. 転送用Gmailアカウント情報を設定します。

    vim /etc/postfix/sasl_passwd
    

    下記の内容のメールとパスワードの部分を置き換えて記入します。
    [smtp.gmail.com]:587 hoge@gmail.com:password

  4. Gmailアカウント情報ファイルからデータベースを作成します。

    postmap hash:/etc/postfix/sasl_passwd
    
  5. Gmailアカウントとパスワードが記載されたファイルを削除します。

    rm -f /etc/postfix/sasl_passwd
    
  6. psotfixを再起動します。

    systemctl restart postfix
    
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0