Bootstrap

7.16Linux的yum仓库练习

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

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

2.在vmware配置光盘iso⽂件,在linux系统中读取光盘⽂件

[root@aa ~]# mkdir /mnt
[root@aa ~]# mount -o ro /dev/sr0 /mnt
[root@aa ~]# ls /mnt

3.配置阿⾥云yum仓库

[root@aa ~]#wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
[root@aa ~]# ls /etc/yum.repos.d/
[root@aa ~]#yum clean all
[root@aa ~]#yum makecache
[root@aa ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
[root@aa ~]# ls /etc/yum.repos.d/

4.配置清华镜像仓库

[root@aa ~]# wget -O https://mirrors.tuna.tsinghua.edu.cn/centos/7/readme
[root@aa ~]# ls /etc/yum.repos.d/
[root@aa ~]# yum clean all
[root@aa ~]# yum makecache

5.配置腾讯镜像仓库

[root@aa ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.cloud.tencent.com/repo/centos7_base.repo
[root@aa ~]# yum clean all
[root@aa ~]# yum makecache
[root@aa ~]# ls /etc/yum.repos.d/

6.⾃建仓库 包含 tree net-tools bash-completion nginx tree等包

[root@aa ~]# yum install --downloadonly --downloaddir=./soft/ nginx.x86_64 tree.x86_64 net-tools.x86_64 bash-completion.noarch
[root@aa~]# ls soft/
[root@aa ~]#yum -y install createrepo
[root@aa ~]# createrepo soft/
[root@aa ~]# ls soft/
[root@aa ~]# vi /etc/yum.repos.d/soft.repo
[soft]
name=soft
baseurl=file:root/soft/
gpgcheck=0
enabled=1
[root@aa~]# rm -rf /etc/yum.repos.d/CentOS-Base.repo   
[root@aa~]# ls /etc/yum.repos.d/
[root@aa~]# yum clean all
[root@aa~]# yum makecache
[root@aa ~]# ls /etc/yum.repos.d/
   soft.repo

;