【无标题】yum源练习

1.插⼊优盘,读取优盘数据

[root@diyi]# fdisk -l

   设备 Boot      Start         End      Blocks   Id  System
/dev/sdb1   *          48    31129599    15564776    c  W95 FAT32 (LBA)
[root@diyi]# mkdir /cc
[root@diyi]# mount -o ro /dev/sdb1 /cc
[root@diyi]# cd /cc
[root@diyi cc]# ls

2.在vmware配置光盘iso⽂件,在linux系统中读取光盘⽂件
使用光盘作为yum源仓库

删除原有的镜像

[root@diyi ~]# rm -rf /etc/yum.repos.d/*.repo

//所有yum源都已经被删除

删除/mnt目录下的所有文件

[root@diyi ~]# rm -rf /mnt/*

将光盘数据挂载到/mnt目录中,就可以在该目录中读取光盘的数据

选项 -o 表示挂载⽅式

[root@diyi ~]# mount -o ro /dev/sr0 /mnt/

[root@diyi ~]# ls /mnt/

[root@diyi ~]# lsblk  //查看磁盘挂载情况

将挂载添加到开机启动⽂件中

开机自动挂载

[root@diyi ~]# echo "mount -o ro /dev/sr0 /mnt" >> /etc/rc.local

[root@diyi ~]# vim /etc/rc.local

编写本地repo⽂件

1)创建⼀个repo⽂件

2)编辑内容

yum 仓库的格式

[root@diyi ~]# vim /etc/yum.repos.d/local.repo

[root@diyi ~]# yum clean all  //清理缓存

[root@diyi ~]# yum makecache  //创建缓存

[root@diyi ~]# yum repolist

3.配置阿⾥云yum仓库
[root@diyi ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo

[root@diyi ~]# ls /etc/yum.repos.d/

[root@diyi ~]# yum makecache

[root@diyi ~]# yum repolist

[root@diyi ~]#mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

4.配置清华镜像仓库
[root@diyi ~]#  wget -O  /etc/yum.repos.d/CentOS7_lived.repo https://mirrors.tuna.tsinghua.edu.cn/centos-vault/7.0.1406
[root@diyi ~]# ls /etc/yum.repos.d/
[root@diyi ~]# yum clean all
[root@diyi ~]# yum makecache
5.配置腾讯镜像仓库
[root@diyi ~]#  wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.cloud.tencent.com/repo/centos7_base.repo
[root@diyi ~]# yum clean all
[root@diyi ~]# yum makecache
6.⾃建仓库 包含 tree net-tools bash-completion nginx tree等包
[root@localhost ~] # yum -y install createrepo
[root@diyi ~]# yum install --downloadonly --downloaddir=./soft net-tools
[root@diyi ~]# createrepo soft/
[root@diyi ~]# ls /root/soft/

[root@diyi ~]# cd /root/soft
[root@diyi soft]# rm -rf /etc/yum.repos.d/*.repo  //删除其他的仓库文件
[root@diyi soft]# ls /etc/yum.repos.d/
在/etc/yum.repos.d/创建/soft.repo配置文件
[root@diyi ~]# vim /etc/yum.repos.d/soft.repo

 
[root@diyi soft]#  yum clean all
[root@diyi soft]# yum makecache //创建缓存
[root@diyi soft]# yum -y install net-tools  //再次安装net-tools
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值