Centos8--本地yum源配置及使用dnf命令安裝nginx

背景

  • centos8發(fā)行版通過 BaseOS 和應(yīng)用流 (AppStream) 倉庫發(fā)布,AppStream 是對傳統(tǒng) rpm 格式的全新擴(kuò)展,為一個(gè)組件同時(shí)提供多個(gè)主要版本
  • centos8 自帶封裝了NGINX
    鏡像內(nèi)容如下
[root@localhost yum.repos.d]# ls /mnt/median/
AppStream  BaseOS  EFI  images  isolinux  media.repo  TRANS.TBL
  • 刪除原目錄下的所有repo的文件
[root@localhost yum.repos.d]# rm -rf /etc/yum.repos.d/*.repo
  • 配置新的yum源(BASEOS中存放基本系統(tǒng)軟件包,AppStream中存放app包如nginx)
[root@localhost yum.repos.d]# cat /etc/yum.repos.d/base.repo
[base]
name=base
gpgcheck=0
enabled=1
baseurl=file:///mnt/median/BaseOS


[AppStream]
name=AppStream
gpgcheck=0
enabled=1
baseurl=file:///mnt/median/AppStream

  • 清空
[root@localhost yum.repos.d]# dnf clean all && dnf makecache
12 文件已刪除
AppStream                                                                                                                                                                   122 MB/s | 5.2 MB     00:00
base                                                                                                                                                                        102 MB/s | 2.2 MB     00:00
元數(shù)據(jù)緩存已建立。
  • 使用dnf命令來安裝NGINX來確認(rèn)yum搭建無誤
[root@localhost yum.repos.d]# dnf install nginx -y
上次元數(shù)據(jù)過期檢查:0:03:13 前,執(zhí)行于 2019年10月15日 星期二 21時(shí)43分32秒。
依賴關(guān)系解決。
================================================================================
 軟件包             架構(gòu)   版本                                 倉庫       大小
================================================================================
Installing:
 nginx              x86_64 1:1.14.1-8.module_el8.0.0+5+258f653c AppStream 569 k
安裝依賴關(guān)系:
 nginx-all-modules  noarch 1:1.14.1-8.module_el8.0.0+5+258f653c AppStream  23 k
 nginx-filesystem   noarch 1:1.14.1-8.module_el8.0.0+5+258f653c AppStream  24 k
 nginx-mod-http-image-filter
                    x86_64 1:1.14.1-8.module_el8.0.0+5+258f653c AppStream  34 k
 nginx-mod-http-perl
                    x86_64 1:1.14.1-8.module_el8.0.0+5+258f653c AppStream  45 k
 nginx-mod-http-xslt-filter
                    x86_64 1:1.14.1-8.module_el8.0.0+5+258f653c AppStream  33 k
 nginx-mod-mail     x86_64 1:1.14.1-8.module_el8.0.0+5+258f653c AppStream  64 k
 nginx-mod-stream   x86_64 1:1.14.1-8.module_el8.0.0+5+258f653c AppStream  85 k
Enabling module streams:
 nginx                     1.14

事務(wù)概要
================================================================================
安裝  8 軟件包

總計(jì):877 k
安裝大小:2.0 M
下載軟件包:
運(yùn)行事務(wù)檢查
事務(wù)檢查成功。
運(yùn)行事務(wù)測試
事務(wù)測試成功。
運(yùn)行事務(wù)
  準(zhǔn)備中      :                                                             1/1
  運(yùn)行腳本    : nginx-filesystem-1:1.14.1-8.module_el8.0.0+5+258f653c.noa   1/8
  Installing  : nginx-filesystem-1:1.14.1-8.module_el8.0.0+5+258f653c.noa   1/8
  Installing  : nginx-mod-http-image-filter-1:1.14.1-8.module_el8.0.0+5+2   2/8
  運(yùn)行腳本    : nginx-mod-http-image-filter-1:1.14.1-8.module_el8.0.0+5+2   2/8
  Installing  : nginx-mod-http-perl-1:1.14.1-8.module_el8.0.0+5+258f653c.   3/8
  運(yùn)行腳本    : nginx-mod-http-perl-1:1.14.1-8.module_el8.0.0+5+258f653c.   3/8
  Installing  : nginx-mod-http-xslt-filter-1:1.14.1-8.module_el8.0.0+5+25   4/8
  運(yùn)行腳本    : nginx-mod-http-xslt-filter-1:1.14.1-8.module_el8.0.0+5+25   4/8
  Installing  : nginx-mod-mail-1:1.14.1-8.module_el8.0.0+5+258f653c.x86_6   5/8
  運(yùn)行腳本    : nginx-mod-mail-1:1.14.1-8.module_el8.0.0+5+258f653c.x86_6   5/8
  Installing  : nginx-all-modules-1:1.14.1-8.module_el8.0.0+5+258f653c.no   6/8
  Installing  : nginx-1:1.14.1-8.module_el8.0.0+5+258f653c.x86_64           7/8
  運(yùn)行腳本    : nginx-1:1.14.1-8.module_el8.0.0+5+258f653c.x86_64           7/8
  Installing  : nginx-mod-stream-1:1.14.1-8.module_el8.0.0+5+258f653c.x86   8/8
  運(yùn)行腳本    : nginx-mod-stream-1:1.14.1-8.module_el8.0.0+5+258f653c.x86   8/8
  驗(yàn)證        : nginx-1:1.14.1-8.module_el8.0.0+5+258f653c.x86_64           1/8
  驗(yàn)證        : nginx-all-modules-1:1.14.1-8.module_el8.0.0+5+258f653c.no   2/8
  驗(yàn)證        : nginx-filesystem-1:1.14.1-8.module_el8.0.0+5+258f653c.noa   3/8
  驗(yàn)證        : nginx-mod-http-image-filter-1:1.14.1-8.module_el8.0.0+5+2   4/8
  驗(yàn)證        : nginx-mod-http-perl-1:1.14.1-8.module_el8.0.0+5+258f653c.   5/8
  驗(yàn)證        : nginx-mod-http-xslt-filter-1:1.14.1-8.module_el8.0.0+5+25   6/8
  驗(yàn)證        : nginx-mod-mail-1:1.14.1-8.module_el8.0.0+5+258f653c.x86_6   7/8
  驗(yàn)證        : nginx-mod-stream-1:1.14.1-8.module_el8.0.0+5+258f653c.x86   8/8

已安裝:
  nginx-1:1.14.1-8.module_el8.0.0+5+258f653c.x86_64
  nginx-all-modules-1:1.14.1-8.module_el8.0.0+5+258f653c.noarch
  nginx-filesystem-1:1.14.1-8.module_el8.0.0+5+258f653c.noarch
  nginx-mod-http-image-filter-1:1.14.1-8.module_el8.0.0+5+258f653c.x86_64
  nginx-mod-http-perl-1:1.14.1-8.module_el8.0.0+5+258f653c.x86_64
  nginx-mod-http-xslt-filter-1:1.14.1-8.module_el8.0.0+5+258f653c.x86_64
  nginx-mod-mail-1:1.14.1-8.module_el8.0.0+5+258f653c.x86_64
  nginx-mod-stream-1:1.14.1-8.module_el8.0.0+5+258f653c.x86_64

完畢!
  • 啟動NGINX
[root@localhost yum.repos.d]# systemctl start nginx
[root@localhost yum.repos.d]# systemctl enable nginx.service
Created symlink /etc/systemd/system/multi-user.target.wants/nginx.service → /usr/lib/systemd/system/nginx.service.
  • 查看NGINX狀態(tài)
[root@localhost yum.repos.d]# systemctl status nginx.service
● nginx.service - The nginx HTTP and reverse proxy server
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
   Active: active (running) since Tue 2019-10-15 21:47:39 EDT; 37min ago
 Main PID: 50706 (nginx)
    Tasks: 3 (limit: 11357)
   Memory: 9.2M
   CGroup: /system.slice/nginx.service
           ├─50706 nginx: master process /usr/sbin/nginx
           ├─50707 nginx: worker process
           └─50708 nginx: worker process

10月 15 21:47:39 localhost.localdomain systemd[1]: Starting The nginx HTTP and reverse proxy server...
10月 15 21:47:39 localhost.localdomain nginx[50703]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
10月 15 21:47:39 localhost.localdomain nginx[50703]: nginx: configuration file /etc/nginx/nginx.conf test is successful
10月 15 21:47:39 localhost.localdomain systemd[1]: Started The nginx HTTP and reverse proxy server.
  • 訪問NGINX


    image.png
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容