差分
このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン | ||
linux:fedora:install_lamp [2024/02/04 13:38] – 削除 - 外部編集 (Unknown date) 非ログインユーザー | linux:fedora:install_lamp [2024/04/18 15:52] (現在) – ↷ 移動操作に合わせてリンクを書き換えました。 非ログインユーザー | ||
---|---|---|---|
行 1: | 行 1: | ||
+ | ====== Fedora による LAMP(Apache, | ||
+ | |||
+ | ===== Web サーバーのインストール ===== | ||
+ | | ||
+ | <WRAP color_term> | ||
+ | <WRAP color_command>< | ||
+ | $ sudo dnf install httpd httpd-devel | ||
+ | </ | ||
+ | <WRAP color_result_long>< | ||
+ | メタデータの期限切れの最終確認: | ||
+ | パッケージ httpd-2.4.54-3.fc36.x86_64 は既にインストールされています。 | ||
+ | 依存関係が解決しました。 | ||
+ | ============================================================================================================== | ||
+ | | ||
+ | ============================================================================================================== | ||
+ | インストール: | ||
+ | <b class=GRN> | ||
+ | 依存関係のインストール: | ||
+ | <b class=GRN> | ||
+ | <b class=GRN> | ||
+ | <b class=GRN> | ||
+ | <b class=GRN> | ||
+ | <b class=GRN> | ||
+ | <b class=GRN> | ||
+ | <b class=GRN> | ||
+ | <b class=GRN> | ||
+ | <b class=GRN> | ||
+ | <b class=GRN> | ||
+ | <b class=GRN> | ||
+ | <b class=GRN> | ||
+ | <b class=GRN> | ||
+ | <b class=GRN> | ||
+ | <b class=GRN> | ||
+ | |||
+ | トランザクションの概要 | ||
+ | ============================================================================================================== | ||
+ | インストール | ||
+ | |||
+ | ダウンロードサイズの合計: | ||
+ | インストール後のサイズ: | ||
+ | これでよろしいですか? | ||
+ | パッケージのダウンロード: | ||
+ | (1/16): apr-devel-1.7.0-16.fc36.x86_64.rpm | ||
+ | (2/16): apr-util-devel-1.6.1-20.fc36.x86_64.rpm | ||
+ | (3/16): autoconf-2.71-2.fc36.noarch.rpm | ||
+ | (4/16): cyrus-sasl-devel-2.1.27-18.fc36.x86_64.rpm | ||
+ | (5/16): expat-devel-2.4.7-1.fc36.x86_64.rpm | ||
+ | (6/16): libdb-devel-5.3.28-51.fc36.x86_64.rpm | ||
+ | (7/16): perl-File-Copy-2.35-486.fc36.noarch.rpm | ||
+ | (8/16): perl-File-Compare-1.100.600-486.fc36.noarch.rpm | ||
+ | (9/16): m4-1.4.19-3.fc36.x86_64.rpm | ||
+ | (10/16): perl-Thread-Queue-3.14-479.fc36.noarch.rpm | ||
+ | (11/16): perl-threads-2.26-449.fc36.x86_64.rpm | ||
+ | (12/16): perl-threads-shared-1.62-479.fc36.x86_64.rpm | ||
+ | (13/16): httpd-devel-2.4.54-3.fc36.x86_64.rpm | ||
+ | (14/16): automake-1.16.5-7.fc36.noarch.rpm | ||
+ | (15/16): libtool-2.4.7-1.fc36.x86_64.rpm | ||
+ | (16/16): openldap-devel-2.6.2-3.fc36.x86_64.rpm | ||
+ | -------------------------------------------------------------------------------------------------------------- | ||
+ | 合計 | ||
+ | トランザクションの確認を実行中 | ||
+ | トランザクションの確認に成功しました。 | ||
+ | トランザクションのテストを実行中 | ||
+ | トランザクションのテストに成功しました。 | ||
+ | トランザクションを実行中 | ||
+ | 準備 | ||
+ | インストール中 | ||
+ | インストール中 | ||
+ | インストール中 | ||
+ | インストール中 | ||
+ | インストール中 | ||
+ | インストール中 | ||
+ | インストール中 | ||
+ | インストール中 | ||
+ | インストール中 | ||
+ | インストール中 | ||
+ | インストール中 | ||
+ | インストール中 | ||
+ | インストール中 | ||
+ | インストール中 | ||
+ | インストール中 | ||
+ | インストール中 | ||
+ | scriptletの実行中: | ||
+ | 検証 | ||
+ | 検証 | ||
+ | 検証 | ||
+ | 検証 | ||
+ | 検証 | ||
+ | 検証 | ||
+ | 検証 | ||
+ | 検証 | ||
+ | 検証 | ||
+ | 検証 | ||
+ | 検証 | ||
+ | 検証 | ||
+ | 検証 | ||
+ | 検証 | ||
+ | 検証 | ||
+ | 検証 | ||
+ | |||
+ | インストール済み: | ||
+ | apr-devel-1.7.0-16.fc36.x86_64 | ||
+ | autoconf-2.71-2.fc36.noarch | ||
+ | cyrus-sasl-devel-2.1.27-18.fc36.x86_64 | ||
+ | httpd-devel-2.4.54-3.fc36.x86_64 | ||
+ | libtool-2.4.7-1.fc36.x86_64 | ||
+ | openldap-devel-2.6.2-3.fc36.x86_64 | ||
+ | perl-File-Copy-2.35-486.fc36.noarch | ||
+ | perl-threads-1: | ||
+ | |||
+ | 完了しました! | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== Web サーバーの自動起動設定 ===== | ||
+ | <WRAP color_term> | ||
+ | <WRAP color_command>< | ||
+ | $ sudo systemctl enable httpd.service | ||
+ | </ | ||
+ | <WRAP color_result>< | ||
+ | Created symlink / | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ===== firewalld の設定 ===== | ||
+ | [[linux: | ||
+ | |||
+ | ==== ゾーンの変更 (FedoraWorkstation -> FedoraServer) ==== | ||
+ | デフォルトゾーンとアクティブゾーンを確認する🤔\\ | ||
+ | <WRAP color_term> | ||
+ | <WRAP color_command>< | ||
+ | <b class=GRN> | ||
+ | </ | ||
+ | <WRAP color_result>< | ||
+ | FedoraServer FedoraWorkstation block dmz drop external home internal libvirt nm-shared public trusted work | ||
+ | </ | ||
+ | <WRAP color_command>< | ||
+ | <b class=GRN> | ||
+ | FedoraWorkstation | ||
+ | </ | ||
+ | <WRAP color_command>< | ||
+ | <b class=GRN> | ||
+ | </ | ||
+ | <WRAP color_result>< | ||
+ | FedoraWorkstation | ||
+ | interfaces: wlp2s0 | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | デフォルトゾーンとアクティブゾーンを **FedoraServer** へ変更する🤔\\ | ||
+ | <WRAP color_term> | ||
+ | <WRAP color_command>< | ||
+ | <b class=GRN> | ||
+ | </ | ||
+ | <WRAP color_result>< | ||
+ | success | ||
+ | </ | ||
+ | <WRAP color_command>< | ||
+ | <b class=GRN> | ||
+ | </ | ||
+ | <WRAP color_result>< | ||
+ | success | ||
+ | </ | ||
+ | <WRAP color_command>< | ||
+ | <b class=GRN> | ||
+ | </ | ||
+ | <WRAP color_result>< | ||
+ | FedoraServer | ||
+ | interfaces: wlp2s0 | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ==== Web サーバーに必要な http、https のみを許可 ==== | ||
+ | ローカルなネットワークではないインターネットのサーバーでは、Web サーバーに必要のないポートは永続的な許可を削除する🤔\\ | ||
+ | <WRAP color_term> | ||
+ | <WRAP color_command>< | ||
+ | <b class=GRN> | ||
+ | </ | ||
+ | <WRAP color_result>< | ||
+ | cockpit dhcpv6-client ssh | ||
+ | </ | ||
+ | <WRAP color_command>< | ||
+ | <b class=GRN> | ||
+ | </ | ||
+ | <WRAP color_result>< | ||
+ | success | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | Web サーバーに必要な http、https プロトコルを永続的に許可する🤤\\ | ||
+ | <WRAP color_term> | ||
+ | <WRAP color_command>< | ||
+ | <b class=GRN> | ||
+ | </ | ||
+ | <WRAP color_result>< | ||
+ | success | ||
+ | success | ||
+ | </ | ||
+ | <WRAP color_command>< | ||
+ | <b class=GRN> | ||
+ | </ | ||
+ | <WRAP color_result>< | ||
+ | dhcpv6-client http https | ||
+ | </ | ||
+ | </ | ||
+ | ファイヤウォール定義の変更は、リロード < | ||
+ | 上記は以下のコマンドを順番に実行したのと同じです🤔 (以下は実行する必要は無い)\\ | ||
+ | <WRAP color_term> | ||
+ | <WRAP color_result>< | ||
+ | $ sudo firewall-cmd --permanent --add-service=http | ||
+ | $ sudo firewall-cmd --permanent --add-service=https | ||
+ | $ sudo firewall-cmd --reload | ||
+ | </ | ||
+ | </ | ||
+ | < | ||
+ | ブレース展開とは [[linux: | ||
+ | 参考: [[qita> | ||
+ | |||
+ | ===== Web サーバーの起動 ===== | ||
+ | < | ||
+ | $ sudo systemctl start httpd.service | ||
+ | </ | ||
+ | ===== データベースサーバーのインストール ===== | ||
+ | MySQL をインストールするために、以下のコマンドを実行する。 | ||
+ | < | ||
+ | $ sudo dnf install mariadb mariadb-server | ||
+ | </ | ||
+ | [[linux: | ||
+ | |||
+ | ===== データベースサーバーの自動起動設定 ===== | ||
+ | < | ||
+ | $ sudo systemctl enable mariadb.service | ||
+ | </ | ||
+ | |||
+ | ===== スクリプト言語のインストール ===== | ||
+ | |||
+ | ==== RPM Fusion, Remi リポジトリの追加 ==== | ||
+ | [[linux: | ||
+ | |||
+ | PHP をインストールするために、以下のコマンドを実行する。 | ||
+ | < | ||
+ | $ sudo dnf install php php-pear php-common php-gd php-mysqlnd php-mbstring php-mcrypt php-xml php-pecl-apcu php-pecl-apcu-bc php-pecl-zip php-json --enablerepo=remi | ||
+ | </ | ||
+ | |||
+ | ==== PHP の設定 ==== | ||
+ | < | ||
+ | $ sudo vi / | ||
+ | </ | ||
+ | < | ||
+ | ; | ||
+ | display_errors = Off | ||
+ | |||
+ | ;enable_dl = Off | ||
+ | enable_dl = On | ||
+ | |||
+ | ; | ||
+ | upload_max_filesize = 32M | ||
+ | |||
+ | ; | ||
+ | date.timezone = Asia/Tokyo | ||
+ | |||
+ | session.cache_limiter = nocache | ||
+ | ; | ||
+ | |||
+ | ; | ||
+ | mbstring.internal_encoding = UTF-8 | ||
+ | |||
+ | ; | ||
+ | mbstring.detect_order = auto | ||
+ | |||
+ | </ | ||
+ | ※PHP アプリが **Pragma: no-cache** ヘッダーを吐かないように **session.cache_limiter = public** とする事もできる。\\ | ||
+ | ただし、DokuWiki などの **?do=edit (編集ページ)** もキャッシュされて動作不良の原因となる。\\ | ||
+ | 以下のようにメディア配信に限定してキャッシュをオンにする事ができる。\\ | ||
+ | <file autoconf dokuwiki/ | ||
+ | ... | ||
+ | RewriteRule lib/ | ||
+ | RewriteRule ^_media/ | ||
+ | RewriteRule ^_detail/ | ||
+ | RewriteRule ^_export/ | ||
+ | RewriteRule ^$ doku.php | ||
+ | RewriteCond %{REQUEST_FILENAME} | ||
+ | RewriteCond %{REQUEST_FILENAME} | ||
+ | RewriteRule (.*) doku.php? | ||
+ | RewriteRule ^index.php$ | ||
+ | |||
+ | Header always set Pragma cache env=X_CACHE_HEADER | ||
+ | ... | ||
+ | </ | ||
+ | **lib/ | ||
+ | |||
+ | ===== Web サーバーの再起動 ===== | ||
+ | < | ||
+ | $ sudo systemctl restart httpd.service | ||
+ | $ sudo systemctl restart php-fpm.service | ||
+ | </ | ||
+ | |||
+ | ===== PHP の mail 機能を利用する場合 ===== | ||
+ | sendmail をインストールする。\\ | ||
+ | < | ||
+ | $ sudo dnf install sendmail | ||
+ | $ sudo systemctl enable sendmail | ||
+ | $ sudo systemctl start sendmail | ||
+ | </ | ||
+ | ===== 参考文献 ===== | ||
+ | [[http:// | ||
+ | [[https:// | ||
+ | [[qita> | ||
+ | [[https:// | ||
+ | |||
+ | ==== 付録 ==== | ||
+ | [[tw> | ||
+ | [[tw> | ||