一、挂载光盘
1、创建挂载点
[root@web1 ~]# mkdir /dvd
2、用开机自动配置文件,实现开机自动挂载光盘文件
[root@web1 ~]# vim /etc/fstab
/dev/cdrom /dvd iso9660 defaults 0 0
[root@web1 ~]# mount -a
[root@web1 ~]# ls /dvd/
CentOS\_BuildTag GPL LiveOS RPM-GPG-KEY-CentOS-7
EFI images Packages RPM-GPG-KEY-CentOS-Testing-7
EULA isolinux repodata TRANS.TBL
3、书写仓库配置文件
[root@web1 ~]# vim /etc/yum.repos.d/a.repo
[a] ##仓库唯一标识
name=a ##仓库描述信息
baseurl=file:///dvd ##仓库软件包位置(repodata位置)
enabled=1 ##启用仓库
gpgcheck=0 ##不检测红帽签名
4、清空缓存
[root@web1 ~]# yum clean all
5、[root@web1 ~]# yum repolist all
在这里插入图片描述

6、装包
[root@web1 ~]# yum -y install xeyes

在这里插入图片描述

7、运行xeyes


配置yum仓库的方法教程

二、自定义yum
1、准备rpm软件包
[root@web1 tools]# ls other/
boxes-1.1.1-4.el7.x86\_64.rpm oneko-1.2-19.fc24.x86\_64.rpm
cmatrix-1.2a-1.i386.rpm sl-5.02-1.el7.x86\_64.rpm
ntfs-3g-2014.2.15-6.el6.x86\_64.rpm
2、创建仓库数据文件
[root@web1 ~]# createrepo /usr/local/tools/other/
Spawning worker 0 with 5 pkgs
Workers Finished
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
3、书写仓库文件
[root@web1 ~]# vim /etc/yum.repos.d/a.repo
[a]
name=a
baseurl=file:///dvd
enabled=1
gpgcheck=0
[myrpm]
name=myrpm
baseurl=file:///usr/local/tools/other
enabled=1
gpgcheck=0
4、清空缓存
[root@web1 ~]# yum clean all
5、列出仓库
[root@web1 ~]# yum repolist all
在这里插入图片描述

6、装包测试
[root@web1 ~]# yum -y install sl
在这里插入图片描述

7、运行sl
在这里插入图片描述

三、网络提供Yum源
1、备份repo文件
[root@web1 ~]# mv /etc/yum.repos.d/a.repo /etc/yum.repos.d/repo/
[root@web1 ~]# ls /etc/yum.repos.d/
repo
2、清空缓存
[root@web1 ~]# yum clean all
3、列出仓库
[root@web1 ~]# yum repolist
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
repolist: 0
4、下载网络repo文件
[root@web1 ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
[root@web1 ~]# ls /etc/yum.repos.d/
CentOS-Base.repo repo

5、列出仓库信息
[root@web1 ~]# yum repolist all

在这里插入图片描述

6、装包
[root@web1 ~]# yum -y install autofs

在这里插入图片描述
7、查看软件包安装情况
[root@web1 ~]# rpm -q autofs
autofs-5.0.7-106.el7.x86\_64

标签: root, etc, yum, repo, 仓库, 配置, web1

相关文章推荐

添加新评论,含*的栏目为必填