安装createrepo
tar -zxf createrepo-0.10.4.tar.gz
cd createrepo-0.10.4/
make
make install
放置yumdownloader --resolve下载的gcc包及依赖
mkdir /etc/yum.offline.d
tar -xf gcc.tar -C /etc/yum.offline.d
创建repodata
createrepo /etc/yum.offline.d/gcc
vim /etc/yum.repos.d/yum.offline.repo
[gcc]
name=gcc
baseurl=file:///etc/yum.offline.d/gcc
enabled=1
gpgcheck=0
验证gcc本地库生效
yum repolist
安装gcc
yum install gcc