以 Redhat Openstack 官网安装手册为例,安装 Openstack 需要用到两类共计 8 个 repo,
1). Centos 源
CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo
2). openstack 源及相关依赖源(epel, foreman, puppet):
epel.repo foreman.repo puppetlabs.repo rdo-release.repo
[root@yumserver ~]# yum -y install wget
[root@yumserver ~]# yum -y install createrepo
[root@yumserver ~]# mkdir -p /wget-yum
[root@yumserver ~]# cd /wget-yum
下载Centos 源:
[root@yumserver wget-yum]# wget -S -c -r -np -L http://mirrors.sohu.com/centos/6.5/
下载foreman源:
[root@yumserver wget-yum]# wget -S -c -r -np -L http://yum.theforeman.org/plugins/1.5/el6/
[root@yumserver wget-yum]# wget -S -c -r -np -L http://yum.theforeman.org/releases/1.5/el6/
下载epel源:
[root@yumserver wget-yum]# wget -S -c -r -np -L http://mirrors.yun-idc.com/epel/6/
下载puppetlabs源:
[root@yumserver wget-yum]# wget -S -c -r -np -L https://yum.puppetlabs.com/el/6/
下载openstack源:
[root@yumserver wget-yum]# wget -S -c -r -np -L https://repos.fedorapeople.org/repos/openstack/openstack-havana/
[root@yumserver wget-yum]# wget -S -c -r -np -L https://repos.fedorapeople.org/repos/openstack/openstack-icehouse/
[root@yumserver wget-yum]# find ./ -name index.html* | xarge rm -rf
[root@yumserver wget-yum]# find ./ -name fedora-20 | xarge rm -rf
[root@yumserver wget-yum]# find ./ -name fedora-19 | xarge rm -rf
[root@yumserver wget-yum]# find ./ -name i386 | xarge rm -rf
[root@yumserver wget-yum]# mkdir foreman
[root@yumserver wget-yum]# mv yum.theforeman.org/plugins foreman/
[root@yumserver wget-yum]# mv yum.theforeman.org/releases foreman/
[root@yumserver wget-yum]# rm -rf yum.theforeman.org
[root@yumserver wget-yum]# mv mirrors.yun-idc.com/epel ./
[root@yumserver wget-yum]# rm -rf mirrors.yun-idc.com
[root@yumserver wget-yum]# mkdir puppetlabs
[root@yumserver wget-yum]# mv yum.puppetlabs.com/el /puppetlabs/
[root@yumserver wget-yum]# rm -rf yum.puppetlabs.com
[root@yumserver wget-yum]# mv repos.fedorapeople.org/repos/openstack ./
[root@yumserver wget-yum]# rm -rf repos.fedorapeople.org
[root@yumserver wget-yum]# ls
centos epel foreman openstack puppetlabs
[root@yumserver wget-yum]# rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
[root@yumserver wget-yum]# yum -y install nginx
[root@yumserver wget-yum]# vi /etc/nginx/nginx.conf
<span style="color: rgb(69, 69, 69); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px;">[root@yumserver wget-yum]# vi /etc/nginx/nginx.conf</span> user nginx; worker_processes 8; error_log /var/log/nginx/error.log warn; pid /var/run/nginx.pid; events { worker_connections 8192; } http { autoindex on; autoindex_exact_size off; autoindex_localtime on; charset utf-8,gbk; include /etc/nginx/mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on; keepalive_timeout 65; include /etc/nginx/conf.d/*.conf; } [root@yumserver wget-yum]# vi /etc/nginx/conf.d/default.conf server { listen 80; server_name openstack-yum-server.cn; location / { #root html; root /wget-yum; autoindex on; index index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } }
[root@yumserver wget-yum]# /etc/init.d/nginx restart
[root@yumserver ~]# wget https://repos.fedorapeople.org/repos/openstack/openstack-icehouse/rdo-release-icehouse-4.src.rpm
[root@yumserver ~]# groupadd -g 2000 padraig
[root@yumserver ~]# useradd -u 2000 -g padraig -m padraig -d /home -s /bin/bash
[root@yumserver ~]# rpm -i rdo-release-icehouse-4.src.rpm
修改 .repo 文件,以 rdo-release.repo 为例
[openstack-havana] name=OpenStack Havana Repository baseurl=http://openstack-yum-server.cn/openstack/openstack-havana/epel-6/ enabled=1 skip_if_unavailable=0 gpgcheck=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-RDO-Havana priority=98
[root@yumserver ~]# cd rpmbuild/
[root@yumserver rpmbuild]#
SOURCES SPECS
[root@yumserver ~]# cd SPECS
[root@yumserver SPECS]# vi rdo-release.spec
URL: https://github.com/redhat-openstack/rdo-release
Source0: rdo-release.repo
Source1: RPM-GPG-KEY-RDO-Icehouse
Source2: foreman.repo
Source3: RPM-GPG-KEY-foreman
Source4: puppetlabs.repo
Source5: RPM-GPG-KEY-puppetlabs
Source6: epel.repo
Source7: RPM-GPG-KEY-EPEL-6
%install
install -p -D -m 644 %{SOURCE0} %{buildroot}%{_sysconfdir}/yum.repos.d/rdo-release.repo
install -p -D -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/yum.repos.d/foreman.repo
install -p -D -m 644 %{SOURCE4} %{buildroot}%{_sysconfdir}/yum.repos.d/puppetlabs.repo
install -p -D -m 644 %{SOURCE6} %{buildroot}%{_sysconfdir}/yum.repos.d/epel.repo
#GPG Keys
install -Dpm 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/pki/rpm-gpg/RPM-GPG-KEY-RDO-Icehouse
install -Dpm 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/pki/rpm-gpg/RPM-GPG-KEY-foreman
install -Dpm 644 %{SOURCE5} %{buildroot}%{_sysconfdir}/pki/rpm-gpg/RPM-GPG-KEY-puppetlabs
install -Dpm 644 %{SOURCE7} %{buildroot}%{_sysconfdir}/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
for repo in rdo-release foreman puppetlabs epel ; do
[root@yumserver SPECS]# cd ../SOURCES
[root@yumserver SOURCES]# ls
epel.repo foreman.repo puppetlabs.repo rdo-release.repo RPM-GPG-KEY-EPEL-6 RPM-GPG-KEY-foreman RPM-GPG-KEY-puppetlabs RPM-GPG-KEY-RDO-Icehouse
[root@yumserver SPECS]# yum -y install rpm-build
[root@yumserver SPECS]# pwd
/root/rpmbuild/SPECS
[root@yumserver SPECS]# rpmbuild -ba rdo-release.spec
[root@yumserver updates]# ls
repodata x86_64
[root@yumserver updates]# pwd
yum-repo/openstack/openstack-icehouse/updates
[root@yumserver updates]# createrepo x86_64
createrepo x86_64 --update
**********************************************************************************************************************************
编译后的rpm源码包示例:
new-rdo-release-havana-8.0.src.rpm
new-rdo-release-icehouse-4.0.src.rpm
[root@controller yum.repos.d]# yum repolist
Loaded plugins: axelget, fastestmirror, security
Loading mirror speeds from cached hostfile
http://openstack-yum-server/ceph/el6/x86_64/repodata/repomd.xml:
[Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 403 Forbidden"
Trying other mirror.
http://openstack-yum-server/ceph/el6/noarch/repodata/repomd.xml:
[Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 403 Forbidden"
Trying other mirror.
.....
解决方案:
1)
每个 repo 配置新增 proxy=None
[openstack-havana-updates]
.....
_proxy_=None
2)
关闭防火墙, service iptables stop
原文:http://blog.csdn.net/wsfdl/article/details/41808939