rpm包介紹 rpm工具用法 yum工具用法

安裝軟件包的三種方法

  • rpm工具
  • yum工具
  • 源碼包

rmp包介紹

設置光驅並掛載mount /dev/cdrom /mntlinux

包名-版本號-發佈版本號-平臺vim

列出包安裝的文件centos

查詢指定包是否安裝緩存

[root@g_linux01 ~]# rpm -q ppp
未安裝軟件包 ppp 
[root@g_linux01 ~]# rpm -q kmod
kmod-20-15.el7.x86_64

若是不知道文件路徑,能夠用`which cd` 形式查看安全

yum工具

使用rpm時,若是須要安裝的包依賴不少包,會比較麻煩,使用yum會自動安裝依賴包。服務器

  • yum list 顯示可用rpm包

左邊是包名,中間是版本信息,右邊是倉庫名,倉庫這邊顯示@base、@anaconda表示已經安裝。若是未安裝這顯示base或者anaconda,若是是updates表示已安裝可是須要升級。ide

[root@glinux-01 ~]# yum list|head -10
已加載插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.tuna.tsinghua.edu.cn
 * extras: mirrors.tuna.tsinghua.edu.cn
 * updates: mirrors.tuna.tsinghua.edu.cn
已安裝的軟件包
GeoIP.x86_64                                1.5.0-11.el7               @anaconda
NetworkManager.x86_64                       1:1.8.0-9.el7              @anaconda
NetworkManager-libnm.x86_64                 1:1.8.0-9.el7              @anaconda
NetworkManager-team.x86_64                  1:1.8.0-9.el7              @anaconda
  • yum的配置文件:/etc/yum.repos.d/Centos-Base.repo 裏面能夠配置倉庫名,

yum源地址[base] //倉庫名 name=CentOS-$releasever – Base mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra //yum源地址。 #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/ gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7工具

  • yum search vim 搜索跟vim相關的包
[root@glinux-01 ~]# yum search vim
已加載插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.tuna.tsinghua.edu.cn
 * extras: mirrors.tuna.tsinghua.edu.cn
 * updates: mirrors.tuna.tsinghua.edu.cn
============================================ N/S matched: vim ============================================
protobuf-vim.x86_64 : Vim syntax highlighting for Google Protocol Buffers descriptions
vim-X11.x86_64 : The VIM version of the vi editor for the X Window System
vim-common.x86_64 : The common files needed by any version of the VIM editor
vim-enhanced.x86_64 : A version of the VIM editor which includes recent enhancements
vim-filesystem.x86_64 : VIM filesystem layout
vim-minimal.x86_64 : A minimal version of the VIM editor

  名稱和簡介匹配 only,使用「search all」試試。
  • yum list|grep vim 能夠用匹配搜索
  • 安裝包 yum install [-y] 【包名】 (-y加這個選項會不詢問是否安裝)
  • yum grouplist 列出可用分組
[root@glinux-01 ~]# yum grouplist
已加載插件:fastestmirror
沒有安裝組信息文件
Maybe run: yum groups mark convert (see man yum)
Loading mirror speeds from cached hostfile
 * base: mirrors.tuna.tsinghua.edu.cn
 * extras: mirrors.tuna.tsinghua.edu.cn
 * updates: mirrors.tuna.tsinghua.edu.cn
可用的環境分組:
   最小安裝
   基礎設施服務器
   計算節點
   文件及打印服務器
   基本網頁服務器
   虛擬化主機
   帶 GUI 的服務器
   GNOME 桌面
   KDE Plasma Workspaces
   開發及生成工做站
可用組:
   傳統 UNIX 兼容性
   兼容性程序庫
   圖形管理工具
   安全性工具
   開發工具
   控制檯互聯網工具
   智能卡支持
   科學記數法支持
   系統管理
   系統管理工具
完成
  • yum groupinstall [-y] [組名]  (先將上面內容轉化爲英文LENG=en,再選擇)
  •  yum remove [-y] 卸載包
  • yum update [-y] 【包名】 更新包(若是不加包名,會將系統所有更新)
  • yum provide "/*/vim" 搜索一個命令都有哪些包

 yum本地倉庫(使用本地光盤製做yum源)

建立方法:1掛載鏡像到 /mnt目錄(mount /dev/cdrom /mnt)開發工具

               2 cp -r /etc/yum.repos.d /etc/yum.repos.d.bakurl

               3 rm -f /etc/yum.repos.d/*

               4 vim /etc/yum.repos.d/dvd.repo//內容以下

[dvd] //倉庫名字
name=install dvd
baseurl=file:///mnt //本地源地址 ??

(file://   /mnt)
enable=1 //本地是否可用,1可用,0不能夠
gpgcheck=0 //是否檢測,1檢測,0不檢測

  • yum clean all //清除緩存
  • yum list
相關文章
相關標籤/搜索