1、准备
1、将u盘格式化为FAT32格式(可使用DiskGenius工具)
2、在 http://mirrors.163.com/centos/7/os/x86_64/Packages/ 下载需要的安装包
2、挂载U盘
#进入sbin目录
cd /sbin
#查看磁盘信息
./fdisk -l
显示我的U盘标识符为 /dev/sdb1
#建立挂载文件夹
mkdir /mnt/usb1
#执行挂载
mount /dev/sdb1 /mnt/usb1
3、进入挂载盘,执行安装
/mnt/usb1/airbus/redhatyum
#安装
rpm -ivh yum-* --nodeps --force
4、新建repo文件
[root@linuxprobe ~]# vim /etc/yum.repos.d/CentOS-Base.repo
#CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-$7 - Base - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$7&arch=$basearch&repo=os
baseurl=http://mirrors.163.com/centos/7/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
name=CentOS-$7 - Updates - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$7&arch=$basearch&repo=updates
baseurl=http://mirrors.163.com/centos/7/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
#additional packages that may be useful
[extras]
name=CentOS-$7 - Extras - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$7&arch=$basearch&repo=extras
baseurl=http://mirrors.163.com/centos/7/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$7 - Plus - 163.com
baseurl=http://mirrors.163.com/centos/7/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
5、清除缓存,安装结束
#清除yum缓存
yum clean all
#测试
yum install vim*