以前に Rocky Linux に Nginx を公式リポジトリからインストールする というメモを書きました。 意味的には全く同じですが、リポジトリの定義を (エディタで新規作成するのでは無く) インターネット上に配置したものをダウンロードする手順へ変更しましたので改めてメモしておきます。 今回は Rocky Linux8 上で作業しました。
Nginx を stable リポジトリからインストールする
dnf config-manager --add-repo
でインターネット上からリポジトリを追加し、Nginx をインストールします。 リポジトリの有効/無効設定はデフォルトで以下になっています。
リポジトリ | デフォルトの設定 |
---|---|
stable | 有効 |
mainline | 無効 |
その為、下記のように実行すると stable リポジトリが利用されます。
dnf config-manager --add-repo https://s3.sig9.org/repos/nginx.repo
dnf install -y nginx
systemctl start nginx
systemctl enable nginx
Nginx を mainline リポジトリからインストールする
Nginx を mainline リポジトリからインストールするには以下を実行します。
dnf config-manager --add-repo https://s3.sig9.org/repos/nginx.repo
dnf config-manager --set-enabled nginx-mainline
dnf install -y nginx
systemctl start nginx
systemctl enable nginx
参考
/etc/yum.repos.d/nginx.repo
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
コメント