CentOS7にapacheをインストールします。
apaccheのインストール
インストール情報の確認
yumを使用してapache2.4をインストールします。
yumの標準リポジトリでインストール可能なapacheのパッケージ情報を調べます。
パッケージ名はhttpdです。
以下のコマンドを実行します。
yum -y info httpd
結果は以下の通りです。apache2.4がインストール出来ることが分かります。
1 2 3 4 5 6 7 8 9 10 11 12 |
Available Packages Name : httpd Arch : x86_64 Version : 2.4.6 Release : 89.el7.centos.1 Size : 2.7 M Repo : updates/7/x86_64 Summary : Apache HTTP Server URL : http://httpd.apache.org/ License : ASL 2.0 Description : The Apache HTTP Server is a powerful, efficient, and extensible : web server. |
インストール
apache2.4をインストールします。
yum -y install httpd
バージョン確認
apacheのバージョンを確認し、apacheがインストールされていることを確認します。
httpd -version
結果は以下の通りです。
1 2 |
Server version: Apache/2.4.6 (CentOS) Server built: Jul 29 2019 17:18:49 |
状態確認
apacheが起動または停止しているかを確認します。
systemctl status httpd.service
以下は、inactive (dead)となっているので、停止している状態です。
1 2 3 4 5 |
● httpd.service - The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled) Active: inactive (dead) Docs: man:httpd(8) man:apachectl(8) |
起動
apacheを起動する場合、以下のコマンドを実行します。起動に失敗する場合、メッセージが表示されます。
何もなければ起動は成功していますが、apacheの状態を確認するコマンドを実行し確認すると良いでしょう。
systemctl start httpd.service
apacheの状態を確認するコマンド実行しましょう。
以下は、active (running)となっているので、起動している状態です。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
● httpd.service - The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled) Active: active (running) since Mon 2019-08-05 06:02:33 UTC; 3s ago Docs: man:httpd(8) man:apachectl(8) Main PID: 1416 (httpd) Status: "Processing requests..." CGroup: /docker/7914e6424fd848aad94ec6c733b2f3c7aae311eebbd05ed7e9f89c4f6ffa3e7e/system.slice/httpd.service ├─1416 /usr/sbin/httpd -DFOREGROUND ├─1417 /usr/sbin/httpd -DFOREGROUND ├─1418 /usr/sbin/httpd -DFOREGROUND ├─1419 /usr/sbin/httpd -DFOREGROUND ├─1420 /usr/sbin/httpd -DFOREGROUND └─1421 /usr/sbin/httpd -DFOREGROUND ‣ 1416 /usr/sbin/httpd -DFOREGROUND Aug 05 06:02:33 7914e6424fd8 systemd[1]: Starting The Apache HTTP Server... Aug 05 06:02:33 7914e6424fd8 httpd[1416]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to s...s this message Aug 05 06:02:33 7914e6424fd8 systemd[1]: Started The Apache HTTP Server. Hint: Some lines were ellipsized, use -l to show in full. |
停止
apacheを停止する場合、以下のコマンドを実行します。
systemctl stop httpd.service
まとめ
特にありません。