ホームページ  >  記事  >  運用・保守  >  Apacheをcentos7で最新バージョンにアップグレードします。

Apacheをcentos7で最新バージョンにアップグレードします。

王林
王林転載
2020-06-17 16:47:199032ブラウズ

Apacheをcentos7で最新バージョンにアップグレードします。

ステップ 1: デフォルトのソフトウェア リポジトリで Apache のバージョンを確認する

Centos のソフトウェア リポジトリで Apache のバージョンを確認するには、次のようにします。コマンドを使用します。行の下に次のコマンドを入力します。

yum info httpd

centos がデフォルト設定を維持している場合、同様の結果が得られる可能性があります。

[root@crosp ~]# yum info httpd
Loaded plugins: fastestmirror
epel/x86_64/metalink                                     |  19 kB     00:00
epel                                                     | 4.3 kB     00:00
(1/3): epel/x86_64/group_gz                                | 170 kB   00:00
(2/3): epel/x86_64/primary_db                              | 4.6 MB   00:00
(3/3): epel/x86_64/updateinfo                              | 780 kB   00:00
Loading mirror speeds from cached hostfile
 * base: mirrors.ircam.fr
 * epel: mirrors.ircam.fr
 * extras: centos.mirror.fr.planethoster.net
 * updates: centos.mirror.fr.planethoster.net
Available Packages
Name        : httpd
Arch        : x86_64
Version     : 2.4.6
Release     : 45.el7.centos.4
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.

上記の出力からわかるように、Yes 、デフォルトのソフトウェア ライブラリには Apache のバージョン 2.4.6 のみがあります。

注:

Centos は、後方修正セキュリティ手法を使用して、新しいソフトウェア修正を以前のバージョンに適用します。したがって、デフォルト リポジトリにあるソフトウェアの以前のバージョンが脆弱であることを意味するものではありません。しかし、私にとって、それは私のニーズを満たすアップデートではありません。

変更ログを使用してバージョンの更新を表示できます:

sudo yum install yum-changelog
yum changelog httpd

ステップ 2: CodeIT ライブラリをインストールする

CodeIT の担当者が優れたカスタム ライブラリを提供しました。このリポジトリは、サーバー ソフトウェア (Apache および Nginx) の最新バージョンを提供します。

CodeIT ライブラリをインストールする前に、EPEL を有効にする必要があります。 EPEL は、CodeIT ライブラリに必要な依存関係を提供します。

sudo yum install -y epel-release

最後に、CodeIT ライブラリをインストールしましょう

cd /etc/yum.repos.d && wget https://repo.codeit.guru/codeit.el`rpm -q --qf "%{VERSION}" $(rpm -q --whatprovides redhat-release)`.repo

次に、Apache パッケージのバージョンを再度確認します。次のような出力が表示されるはずです。

[root@crosp ~]# yum info httpd
Loaded plugins: changelog, fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.crazyfrogs.org
 * epel: mirror.23media.de
 * extras: mirrors.ircam.fr
 * updates: centos.mirror.fr.planethoster.net
Available Packages
Name        : httpd
Arch        : x86_64
Version     : 2.4.25
Release     : 3.el7.codeit
Size        : 1.4 M
Repo        : CodeIT/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.

Step 3: Apache をインストールします

これで、最新バージョンの Apache をインストールするために必要なものがすべて揃ったはずです:

yum install httpd

Apache がインストールされたら、Apache が適切に機能していることをテストできます。

[root@crosp ~]# systemctl start httpd

出力は次の図のようになります:

[root@crosp ~]# curl localhost
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Test Page for the Apache HTTP Server on CentOS</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
                ...

最後に、systemctl でブート時に Apache が自動的に起動するように設定します:

[root@crosp ~]# systemctl enable httpd

完了です。

推奨チュートリアル: Apache の入門から習熟まで

以上がApacheをcentos7で最新バージョンにアップグレードします。の詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。

声明:
この記事はcsdn.netで複製されています。侵害がある場合は、admin@php.cn までご連絡ください。