安装九式
1.加载光盘,确定连接
2.挂载
[root@localhost ~]# mount /dev/sr0 /media/
mount: /dev/sr0 is write-protected, mounting read-only
3.进入目录并查看 cd /etc/yum.repos.d/
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ls
CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo
CentOS-CR.repo CentOS-fasttrack.repo CentOS-Sources.repo
4.复制 cp CentOS-Media.repo zt
[root@localhost yum.repos.d]# cp CentOS-Media.repo zt
[root@localhost yum.repos.d]# ls
CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo
CentOS-CR.repo CentOS-fasttrack.repo CentOS-Sources.repo zt
*5.删除所有以repo结尾的文件 rm -rf .repo
[root@localhost yum.repos.d]# rm -rf *.repo
[root@localhost yum.repos.d]# ls
zt
6.复制文件 cp zt zt.repo
[root@localhost yum.repos.d]# cp zt zt.repo
[root@localhost yum.repos.d]# ls
zt zt.repo
7.修改编辑.repo文件 vi zt.repo
[root@localhost yum.repos.d]# vi zt.repo
# CentOS-Media.repo
#
# This repo can be used with mounted DVD media, verify the mount point for
# CentOS-7. You can use this repo and yum to install items directly off the
# DVD ISO that we release.
#
# To use this repo, put in your DVD and use it with the other repos too:
# yum --enablerepo=c7-media [command]
#
# or for ONLY the media repo, do this:
#
# yum --disablerepo=\* --enablerepo=c7-media [command]
[c7-media]
name=CentOS-$releasever - Media
baseurl=file:///media/
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
8.清除格式 yum clean all
[root@localhost yum.repos.d]# yum clean all
Loaded plugins: fastestmirror
Cleaning repos: c7-media
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
9.安装
[root@localhost yum.repos.d]# yum install wget -y
Loaded plugins: fastestmirror
c7-media | 3.6 kB 00:00
(1/2): c7-media/group_gz | 156 kB 00:00
(2/2): c7-media/primary_db | 3.1 MB 00:00
Determining fastest mirrors
Resolving Dependencies
--> Running transaction check
---> Package wget.x86_64 0:1.14-15.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
wget x86_64 1.14-15.el7 c7-media 547 k
Transaction Summary
================================================================================
Install 1 Package
Total download size: 547 k
Installed size: 2.0 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : wget-1.14-15.el7.x86_64 1/1
Verifying : wget-1.14-15.el7.x86_64 1/1
Installed:
wget.x86_64 0:1.14-15.el7
Complete!