- 挂载光驱
虚拟机连接
mount 光驱
[root@localhost dev]# mount /dev/cdrom /mnt
mount: /dev/sr0 写保护,将以只读方式挂载
[root@localhost dev]# cd /mnt
[root@localhost mnt]# ls
CentOS_BuildTag EFI EULA GPL images isolinux LiveOS Packages repodata RPM-GPG-KEY-CentOS-7 RPM-GPG-KEY-CentOS-Testing-7 TRANS.TBL
[root@localhost mnt]# cd Packages/
[root@localhost Packages]# ls
389-ds-base-1.3.6.1-16.el7.x86_64.rpm
- rpm
rpm -ivh libusal-1.1.11-23.el7.x86_64.rpm【安装】
[root@localhost Packages]# rpm -ivh libusal-1.1.11-23.el7.x86_64.rpm
准备中... ################################# [100%]
正在升级/安装...
1:libusal-1.1.11-23.el7 ################################# [100%]
rpm -e libusal【卸载】
[root@localhost Packages]# rpm -e libusal
[root@localhost Packages]#
rpm -qa 【查询所有安装的包】
[root@localhost 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
rpm -q zip【查看命令对应的包】
[root@localhost Packages]# rpm -q zip
zip-3.0-11.el7.x86_64
rpm -ql zip【查看包对于的安装文件】
[root@localhost Packages]# rpm -ql zip
/usr/bin/zip
/usr/bin/zipcloak
/usr/bin/zipnote
/usr/bin/zipsplit
/usr/share/doc/zip-3.0
/usr/share/doc/zip-3.0/CHANGES
/usr/share/doc/zip-3.0/LICENSE
/usr/share/doc/zip-3.0/README
/usr/share/doc/zip-3.0/README.CR
/usr/share/doc/zip-3.0/TODO
/usr/share/doc/zip-3.0/WHATSNEW
/usr/share/doc/zip-3.0/WHERE
/usr/share/doc/zip-3.0/algorith.txt
/usr/share/man/man1/zip.1.gz
/usr/share/man/man1/zipcloak.1.gz
/usr/share/man/man1/zipnote.1.gz
/usr/share/man/man1/zipsplit.1.gz
rpm -qf /usr/share/doc/zip-3.0/LICENSE【查看文件对应的包】
[root@localhost Packages]# rpm -qf /usr/share/doc/zip-3.0/LICENSE
zip-3.0-11.el7.x86_64
yum更换国内源
- 切换目录
[root@localhost yum.repos.d]# cd /etc/yum.repos.d
[root@localhost yum.repos.d]# ls -l
-rw-r--r--. 1 root root 1664 8月 30 2017 CentOS-Base.repo
-rw-r--r--. 1 root root 1309 8月 30 2017 CentOS-CR.repo
-rw-r--r--. 1 root root 649 8月 30 2017 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root 314 8月 30 2017 CentOS-fasttrack.repo
-rw-r--r--. 1 root root 630 8月 30 2017 CentOS-Media.repo
-rw-r--r--. 1 root root 1331 8月 30 2017 CentOS-Sources.repo
-rw-r--r--. 1 root root 3830 8月 30 2017 CentOS-Vault.repo
- 备份配置文件
[root@localhost yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo_20180307
- 获取国内配置文件
[root@localhost yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo_20180307
[root@localhost yum.repos.d]# curl -O http://mirrors.163.com/.help/CentOS7-Base-163.repo
【或者 wget http://mirrors.163.com/.help/CentOS7-Base-163.repo】
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1572 100 1572 0 0 282 0 0:00:05 0:00:05 --:--:-- 389
[root@localhost yum.repos.d]# ls -l
-rw-r--r--. 1 root root 1572 3月 7 09:33 CentOS7-Base-163.repo
-rw-r--r--. 1 root root 1664 8月 30 2017 CentOS-Base.repo_20180307
-rw-r--r--. 1 root root 1309 8月 30 2017 CentOS-CR.repo
-rw-r--r--. 1 root root 649 8月 30 2017 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root 314 8月 30 2017 CentOS-fasttrack.repo
-rw-r--r--. 1 root root 630 8月 30 2017 CentOS-Media.repo
-rw-r--r--. 1 root root 1331 8月 30 2017 CentOS-Sources.repo
-rw-r--r--. 1 root root 3830 8月 30 2017 CentOS-Vault.repo
- 安装文件验证
[root@localhost yum.repos.d]# yum install -y wget
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
正在解决依赖关系
--> 正在检查事务
---> 软件包 wget.x86_64.0.1.14-15.el7_4.1 将被 安装
--> 解决依赖关系完成
依赖关系解决
============================================================================================================================================================================================================
Package 架构 版本 源 大小
============================================================================================================================================================================================================
正在安装:
wget x86_64 1.14-15.el7_4.1 updates 547 k
事务概要
============================================================================================================================================================================================================
安装 1 软件包
总下载量:547 k
安装大小:2.0 M
Downloading packages:
wget-1.14-15.el7_4.1.x86_64.rpm | 547 kB 00:00:05
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : wget-1.14-15.el7_4.1.x86_64 1/1
验证中 : wget-1.14-15.el7_4.1.x86_64 1/1
已安装:
wget.x86_64 0:1.14-15.el7_4.1
完毕!
[root@localhost yum.repos.d]#
安装扩展源
[root@localhost yum.repos.d]# yum install -y epel-release
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
正在解决依赖关系
--> 正在检查事务
---> 软件包 epel-release.noarch.0.7-9 将被 安装
--> 解决依赖关系完成
````
[root@localhost yum.repos.d]# yum list |grep epel |wc -l
12318
[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]# ll
-rw-r--r--. 1 root root 1572 3月 7 09:33 CentOS7-Base-163.repo
-rw-r--r--. 1 root root 1664 8月 30 2017 CentOS-Base.repo_20180307
-rw-r--r--. 1 root root 1309 8月 30 2017 CentOS-CR.repo
-rw-r--r--. 1 root root 649 8月 30 2017 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root 314 8月 30 2017 CentOS-fasttrack.repo
-rw-r--r--. 1 root root 630 8月 30 2017 CentOS-Media.repo
-rw-r--r--. 1 root root 1331 8月 30 2017 CentOS-Sources.repo
-rw-r--r--. 1 root root 3830 8月 30 2017 CentOS-Vault.repo
-rw-r--r--. 1 root root 957 12月 27 2016 epel.repo
-rw-r--r--. 1 root root 1056 12月 27 2016 epel-testing.repo
补充说明:
yum install -y epel-release --downloadonly --downloaddir=包路径
默认路径:/var/cache/yum/x86_64/7