搭建openstack-icehouse本地yum源
2020-12-20 本文已影响0人
sknfie
一、搭建centos本地yum
拷贝镜像文件:
CentOS-6.5-x86_64-bin-DVD1.iso
CentOS-6.5-x86_64-bin-DVD2.iso
mount /dev/cdrom /mnt
cp -rf /mnt/Packages/* /data/base
yum install -y createrepo
createrepo -p -d -o /data/base /data/base
二、下载epel源(20G左右磁盘空间)
mkdir /data/epel
wget -b -np -nH --cut-dirs=1 -r -c -L --exclude-directories=repodata --accept=rpm,gz,xml http://dl.fedoraproject.org/pub/epel/6/x86_64/ -P /data/epel/
createrepo -p -d -o /data/epel/pub/epel/6/x86_64/ /data/epel/pub/epel/6/x86_64/
三、下载openstack-icehouse源(1G左右磁盘空间)
mkdir /data/openstack-icehouse
wget -b -np -nH –cut-dirs=1 -r -c -L –-exclude-directories=repodata –-accept=rpm,gz,xml https://repos.fedorapeople.org/repos/openstack/EOL/openstack-icehouse/epel-6/ -P /data/openstack-icehouse/
createrepo -p -d -o /data/openstack-icehouse/repos/openstack/EOL/openstack-icehouse/epel-6/ /data/openstack-icehouse/repos/openstack/EOL/openstack-icehouse/epel-6/
createrepo -p -d -o /data/openstack-icehouse/repos/openstack/EOL/openstack-icehouse/epel-6/epel/ /data/openstack-icehouse/repos/openstack/EOL/openstack-icehouse/epel-6/epel/
四、配置http访问yum源
- 安装apache服务
yum install -y httpd
- 配置项目路径
ln -s /data/base/ /var/www/html/base
ln -s /data/epel/ /var/www/html/epel
ln -s /data/openstack-icehouse/ /var/www/html/openstack-icehouse
启动httpd服务
service httpd start
五、配置yum配置文件
- 备份原有yum配置文件
cd /etc/yum.repos.d/
for i in `ls` do ; mv $i{,.bak};done
- 新建本地yum配置文件
vim CentOS-Base.repo
[CentOS-base-yum]
name=CentOS base yum Repository
baseurl=http://1.1.1.221/base/ #1.1.1.221为服务器IP地址
enabled=1
gpgcheck=0
[CentOS-epel-yum]
name=CentOS epel yum Repository
baseurl=http://1.1.1.221/epel/pub/epel/6/x86_64/
enabled=1
gpgcheck=0
[openstack-icehouse]
name=OpenStack Icehouse Repository
baseurl=http://1.1.1.221/openstack-icehouse/repos/openstack/EOL/openstack-icehouse/epel-6/
enabled=1
gpgcheck=0
[openstack-icehouse-epel]
name=OpenStack Icehouse epel Repository
baseurl=http://1.1.1.221/openstack-icehouse/repos/openstack/EOL/openstack-icehouse/epel-6/epel/
enabled=1
gpgcheck=0
yum clean all
yum makecache
yum repolist
- 拷贝repo文件到http访问目录下,方便其他服务器下载使用
cp /etc/yum.repos.d/CentOS-Base.repo /var/www/html/