2018-03-05 阿銘Linux學習
阿新 • • 發佈:2018-03-06
Linux學習7.1 安裝包的三種方法
rpm 工具
類似Windows exe安裝包,安裝有固定的路徑
軟件依賴包需要手動依次安裝
Redhat公司開發
yum
使用python 開發的
自動安裝依賴包
在線安裝,最方便
源碼包
先編譯在安裝
7.2 rpm包介紹
設置光驅並掛載安裝鏡像文件 rpm包格式,報名、版本號、發布版本號、平臺 rpm -ivh rpm包文件 //安裝 rpm -Uvh rpm包文件 //升級 rpm -e 包名 //卸載 rpm -qa //查詢安裝的包 rpm -q 包名 //查詢指定包是否安裝 rpm -qi 包名 //查詢指定包信息 rpm -ql 包名 //列出包安裝的文件 rpm -qf 文件絕對路徑 //查看一個文件是由哪個包安裝的 um-rhn-plugin-2.0.1-9.el7.noarch.rpm zlib-devel-1.2.7-17.el7.i686.rpm zlib-devel-1.2.7-17.el7.x86_64.rpm
7.3 rpm工具使用方法
[root@aming-01 Packages]# rpm -ivh zsh-html-5.0.2-28.el7.x86_64.rpm 準備中... ################################# [100%] 正在升級/安裝... 1:zsh-html-5.0.2-28.el7 ################################# [100%] [root@aming-01 Packages]# rpm -e zsh-html-5.0.2-28.el7.x86_64 [root@aming-01 Packages]# rpm -q tree tree-1.6.0-10.el7.x86_64 [root@aming-01 Packages]# rpm -qi tree Name : tree Version : 1.6.0 Release : 10.el7 Architecture: x86_64 Install Date: 2018年03月01日 星期四 03時31分46秒 Group : Applications/File Size : 89505 License : GPLv2+ Signature : RSA/SHA256, 2014年07月04日 星期五 13時36分46秒, Key ID 24c6a8a7f4a80eb5 Source RPM : tree-1.6.0-10.el7.src.rpm Build Date : 2014年06月10日 星期二 03時28分53秒 Build Host : worker1.bsys.centos.org Relocations : (not relocatable) Packager : CentOS BuildSystem <http://bugs.centos.org> Vendor : CentOS URL : http://mama.indstate.edu/users/ice/tree/ Summary : File system tree viewer Description : The tree utility recursively displays the contents of directories in a tree-like format. Tree is basically a UNIX port of the DOS tree utility. [root@aming-01 Packages]# rpm -ql tree /usr/bin/tree /usr/share/doc/tree-1.6.0 /usr/share/doc/tree-1.6.0/LICENSE /usr/share/doc/tree-1.6.0/README /usr/share/man/man1/tree.1.gz [root@aming-01 Packages]# rpm -qf /usr/bin/vim vim-enhanced-7.4.160-2.el7.x86_64 [root@aming-01 Packages]# rpm -qf `which cd` bash-4.2.46-28.el7.x86_64 依賴包 [root@aming-01 Packages]# rpm -ivh texlive-2012-38.20130427_r30134.el7.x86_64.rpm 錯誤:依賴檢測失敗: texlive-scheme-basic 被 texlive-2:2012-38.20130427_r30134.el7.x86_64 需要 texlive-collection-latexrecommended 被 texlive-2:2012-38.20130427_r30134.el7.x86_64 需要 tex-kpathsea 被 texlive-2:2012-38.20130427_r30134.el7.x86_64 需要 tex-tetex 被 texlive-2:2012-38.20130427_r30134.el7.x86_64 需要
7.4 yum 工具用法
yum list //列出可用rpm包 ls /etc/yum.repos.d/ yum search vim //搜索包 yum install [-y] yum grouplist yum groupinstall [-y] yum remove [-y] yum update [-y] yum provides "/*/vim" [root@aming-01 Packages]# ls /etc/yum.repos.d/ CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo CentOS-CR.repo CentOS-fasttrack.repo CentOS-Sources.repo [root@aming-01 Packages]# cat /etc/yum.repos.d/CentOS-Base.repo # CentOS-Base.repo # # The mirror system uses the connecting IP address of the client and the # update status of each mirror to pick mirrors that are updated to and # geographically close to the client. You should use this for CentOS updates # unless you are manually picking other mirrors. # # If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead. # # [base] name=CentOS-$releasever - Base mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 #released updates [updates] name=CentOS-$releasever - Updates mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra #baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 #additional packages that may be useful [extras] name=CentOS-$releasever - Extras mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra #baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-$releasever - Plus mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra #baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 [root@aming-01 Packages]# yum grouplist 已加載插件:fastestmirror 沒有安裝組信息文件 Maybe run: yum groups mark convert (see man yum) Loading mirror speeds from cached hostfile * base: ftp.sjtu.edu.cn * extras: ftp.sjtu.edu.cn * updates: mirrors.neusoft.edu.cn 可用的環境分組: 最小安裝 基礎設施服務器 計算節點 文件及打印服務器 基本網頁服務器 虛擬化主機 帶 GUI 的服務器 GNOME 桌面 KDE Plasma Workspaces 開發及生成工作站 可用組: 傳統 UNIX 兼容性 兼容性程序庫 圖形管理工具 安全性工具 開發工具 控制臺互聯網工具 智能卡支持 科學記數法支持 系統管理 系統管理工具 完成
7.5 yum 搭建本地倉庫
掛載鏡像到/mnt 目錄
cp -r /etc/yum.repos.d /etc/yum.repos.d.bac
rm -f /etc/yum.repos.d/*
vim /etc/yum.repos.d/dvd.repo //內容如下
[dvd]
name=install dvd
baseurl=file:///mnt
enable=1
gpgcheck=0
yum clean all
yum list
2018-03-05 阿銘Linux學習