赞
踩
在配置yum源之前,我们先了解一下本地源和网络源的区别:
本地源: 利用挂载系统系统镜像包进行配置,因受限与镜像包,能获取的包相对较少。
网络源:在能连接互联网的服务器上进行配置,配置简单,可选择性强,能获取的包也更多。
了解了我们接下就进行实操
一、本地yum源
1、创建挂载点目录
[root@lk ~]# mkdir /mnt/cdrom #创建目录
[root@lk ~]# df /mnt/cdrom/ #查看设备状况
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/centos-root 17811456 1386708 16424748 8% /
2、挂载CD(光盘)
[root@lk ~]# mount /dev/cdrom /mnt/cdrom/
mount: /dev/sr0 is write-protected, mounting read-only #显示这个表示挂载成功
3、查看挂载记录
[root@lk ~]# df -h /mnt/cdrom/
Filesystem Size Used Avail Use% Mounted on
/dev/sr0 4.4G 4.4G 0 100% /mnt/cdrom
4、更改配置文件(查看/etc/yum.repos.d/中的文件)
[root@lk ~]# ls -l /etc/yum.repos.d/
total 40
-rw-r--r--. 1 root root 1664 Oct 23 2020 CentOS-Base.repo
-rw-r--r--. 1 root root 1309 Oct 23 2020 CentOS-CR.repo
-rw-r--r--. 1 root root 649 Oct 23 2020 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root 314 Oct 23 2020 CentOS-fasttrack.repo
-rw-r--r--. 1 root root 630 Oct 23 2020 CentOS-Media.repo
-rw-r--r--. 1 root root 1331 Oct 23 2020 CentOS-Sources.repo
-rw-r--r--. 1 root root 8515 Oct 23 2020 CentOS-Vault.repo
-rw-r--r--. 1 root root 616 Oct 23 2020 CentOS-x86_64-kernel.repo
5、绕过网络,使用本地安装
[root@lk ~]# cd /etc/yum.repos.d/
[root@lk yum.repos.d]# ll
total 40
-rw-r--r--. 1 root root 1664 Oct 23 2020 CentOS-Base.repo
-rw-r--r--. 1 root root 1309 Oct
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。