Linux系統下安裝軟件包方法(上)
阿新 • • 發佈:2018-01-09
base lib .rpm eps tun 4.2 節點 -m syn 安裝軟件包的三種方法
1.rpm工具
2.yum工具 (可以自動安裝依賴包)
3.源碼包
rpm工具介紹及使用
1.首先掛載光驅:
which-2.20-7.el7.x86_64.rpm #包含包名,版本號,發布版本號,平臺
whois-5.1.1-2.el7.x86_64.rpm
wireshark-1.10.14-14.el7.x86_64.rpm
wireshark-gnome-1.10.14-14.el7.x86_64.rpm
wodim-1.1.11-23.el7.x86_64.rpm
2.安裝: -ivh
[root@weix-01 Packages]# rpm -ivh zsh-5.0.2-28.el7.x86_64.rpm 準備中... ################################# [100%] 正在升級/安裝... 1:zsh-5.0.2-28.el7 ################################# [100%]
3.升級:-Uvh
[root@weix-01 Packages]# rpm -Uvh zsh-5.0.2-28.el7.x86_64.rpm
準備中... ################################# [100%]
軟件包 zsh-5.0.2-28.el7.x86_64 已經安裝
4.卸載:-e
[root@weix-01 Packages]# rpm -e zsh
5.查詢所有安裝的包:-qa
[root@weix-01 Packages]# rpm -qa open-vm-tools-10.1.5-3.el7.x86_64 grub2-common-2.02-0.64.el7.centos.noarch kexec-tools-2.0.14-17.el7.x86_64 setup-2.8.71-7.el7.noarch NetworkManager-tui-1.8.0-9.el7.x86_64 basesystem-10.0-7.el7.centos.noarch NetworkManager-wifi-1.8.0-9.el7.x86_64
6.查詢指定的包是否安裝:-q
[root@weix-01 Packages]# rpm -q zsh
zsh-5.0.2-28.el7.x86_64
7.查詢指定包信息: -qi
[root@weix-01 Packages]# rpm -qi vim-enhanced
Name : vim-enhanced
Epoch : 2
Version : 7.4.160
Release : 2.el7
Architecture: x86_64
Install Date: 2018年01月03日 星期三 15時24分46秒
8.列出包安裝的文件: -ql
[root@weix-01 Packages]# rpm -ql vim-enhanced /etc/profile.d/vim.csh /etc/profile.d/vim.sh /usr/bin/rvim /usr/bin/vim /usr/bin/vimdiff /usr/bin/vimtutor
9.查詢一個文件是由哪個包安裝的: -qf
[root@weix-01 Packages]# rpm -qf /usr/bin/vim
vim-enhanced-7.4.160-2.el7.x86_64
[root@weix-01 Packages]# rpm -qf `which cd` #可以先查詢命令,在查詢由哪個安裝的,反引號
bash-4.2.46-28.el7.x86_64
yum工具用法
1.yum可以自動安裝依賴包
2.列出可用包:yum list
[root@weix01 Packages]# yum list
zenity.x86_64 3.22.0-1.el7 base
zlib.i686 1.2.7-17.el7 base
zlib-devel.i686 1.2.7-17.el7 base
zlib-devel.x86_64 1.2.7-17.el7 base
zlib-static.i686 1.2.7-17.el7 base
zlib-static.x86_64 1.2.7-17.el7 base
zsh.x86_64 5.0.2-28.el7 base
zsh-html.x86_64 5.0.2-28.el7 base
zziplib.i686 0.13.62-5.el7 base
zziplib.x86_64 0.13.62-5.el7 base
3.搜索一個包:
[root@weix01 Packages]# yum search vim
已加載插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.tuna.tsinghua.edu.cn
* extras: mirrors.163.com
* 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”試試。
相對精確的搜索:
[root@weix01 Packages]# yum list |grep ‘vim‘
vim-minimal.x86_64 2:7.4.160-2.el7 @anaconda
protobuf-vim.x86_64 2.5.0-8.el7 base
vim-X11.x86_64 2:7.4.160-2.el7 base
vim-common.x86_64 2:7.4.160-2.el7 base
vim-enhanced.x86_64 2:7.4.160-2.el7 base
vim-filesystem.x86_64 2:7.4.160-2.el7 base
4.安裝一個包:yum install -y #-y不在詢問是否安裝,直接安裝
5.組顯示:
[root@weix01 Packages]# 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.163.com
* updates: mirrors.tuna.tsinghua.edu.cn
可用的環境分組:
最小安裝
基礎設施服務器
計算節點
文件及打印服務器
基本網頁服務器
虛擬化主機
帶 GUI 的服務器
GNOME 桌面
KDE Plasma Workspaces
開發及生成工作站
可用組:
傳統 UNIX 兼容性
兼容性程序庫
圖形管理工具
安全性工具
開發工具
控制臺互聯網工具
智能卡支持
科學記數法支持
系統管理
系統管理工具
完成
6.組安裝:yum groupinstall -y
7.卸載:yum remove -y
8.升級一個包:yum update -y #如果不加包名,所有東西都升級
9.搜索該命令所需要的包:yum provides
[root@weix01 Packages]# yum provides "/*/vim"
已加載插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.tuna.tsinghua.edu.cn
* extras: mirrors.163.com
* updates: mirrors.tuna.tsinghua.edu.cn
base/7/x86_64/filelists_db | 6.7 MB 01:46
extras/7/x86_64/filelists_db | 528 kB 00:18
updates/7/x86_64/filelists_db | 3.0 MB 00:41
cmake-2.8.12.2-2.el7.x86_64 : Cross-platform make system
源 :base
匹配來源:
文件名 :/usr/share/cmake/editors/vim
2:docker-unit-test-1.12.6-48.git0fdc778.el7.centos.x86_64 : Automates
...: deployment of containerized applications - for running unit
...: tests
源 :extras
匹配來源:
文件名 :/var/lib/docker-unit-test/docker-novolume-plugin-385ec70baac3ef356f868f391c8d7818140fbd44/Godeps/_workspace/src/github.com/docker/docker/contrib/syntax/vim
文件名 :/var/lib/docker-unit-test/contrib/syntax/vim
文件名 :/var/lib/docker-unit-test/v1.10-migrator-c417a6a022c5023c111662e8280f885f6ac259be/Godeps/_workspace/src/github.com/docker/docker/contrib/syntax/vim
文件名 :/var/lib/docker-unit-test/runc-79c3939053c870fbb4de5484d98640d5ba028ef4/Godeps/_workspace/src/github.com/docker/docker/contrib/syntax/vim
yum搭建本地倉庫
1.掛載光驅
2.備份文件目錄:
[root@weix01 ~]# cp -r /etc/yum.repos.d /etc/yum.repos.d.bak
3.刪除原有的:
[root@weix01 yum.repos.d]# rm -rf ./*
4.創建新的倉庫,並添加內容,然後清除緩存:
[root@weix01 yum.repos.d]# vi dvd.repo
[root@weix01 yum.repos.d]# yum clean all
已加載插件:fastestmirror
正在清理軟件源: dvd
Cleaning up everything
Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos
Cleaning up list of fastest mirrors
5.再次yum list 發現yum倉庫為dvd:
cdparanoia-libs.x86_64 10.2-17.el7 dvd
cdrdao.x86_64 1.2.3-20.el7 dvd
celt051.x86_64 0.5.1.3-8.el7 dvd
centos-bookmarks.noarch 7-1.el7 dvd
centos-indexhtml.noarch 7-9.el7.centos dvd
certmonger.x86_64 0.78.4-3.el7 dvd
cgdcbxd.x86_64 1.0.2-7.el7 dvd
check.x86_64 0.9.9-5.el7 dvd
圖中兩處錯誤
gpgcheck=0
yum clean all
Linux系統下安裝軟件包方法(上)