centos7.2 yum源 OpenStack+ceph仓库部署

环境准备

#关闭selinux、防火墙
systemctl stop firewalld.service
systemctl disable firewalld.service
firewall-cmd --state
sed -i '/^SELINUX=.*/c SELINUX=disabled' /etc/selinux/config
sed -i 's/^SELINUXTYPE=.*/SELINUXTYPE=disabled/g' /etc/selinux/config
grep --color=auto '^SELINUX' /etc/selinux/config
setenforce 0

#更换阿里源
mv /etc/yum.repos.d/CentOS-Base.repo{,.bak}
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo  
yum clean all && yum makecache

yum安装配置

#设置yum下载目录
mkdir -p /www/share/yum
cp /etc/yum.conf{,.bak}
sed -i 's#^keepcache=0#keepcache=1#' /etc/yum.conf
sed -i 's/^cachedir/#cachedir/' /etc/yum.conf
sed -ir '3 icachedir=/www/share/yum/$basearch/$releasever \n' /etc/yum.conf
head /etc/yum.conf

配置http共享目录

#安装createrepo,http服务
yum install createrepo httpd -y
#配置http目录共享
echo '#http share
Alias /share /www/share
<Directory "/www/share">
    Options Indexes FollowSymLinks
    IndexOptions NameWidth=* DescriptionWidth=* FoldersFirst
    IndexOptions SuppressIcon HTMLTable Charset=UTF-8 SuppressHTMLPreamble
    Order allow,deny
    Allow from all
    Require all granted
</Directory>
'>/etc/httpd/conf.d/share.conf

#备份原始配置文件 cp /etc/httpd/conf/httpd.conf{,.bak}
echo " ServerName localhost #关闭版本号显示 ServerSignature Off ServerTokens Prod ">>/etc/httpd/conf/httpd.conf systemctl enable httpd.service systemctl restart httpd.service netstat -antp|grep 'httpd'

#创建YUM仓库
mkdir -p /www/share/openstack-pike
createrepo -p /www/share/openstack-pike/
mkdir -p /www/share/ceph
createrepo -p /www/share/ceph/

#创建源文件 echo " [My_share] name=My_OpenStack baseurl=http://192.168.0.48/share/openstack-pike/ gpgcheck=0 enabled=1 cost=88 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 ">/www/share/openstack.repo
echo "
[ceph]
name=My_Ceph
baseurl=http://192.168.0.48/share/ceph/
gpgcheck=0
enabled=1
cost=88
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
">/www/share/myceph.repo #(如果安装过程中 使用 "ceph-deploy install 。。"命令 这个ceph.repo会覆盖然后安装失败 可以改名 或者不用 install安装 ,我直接使用 yum安装的那2个包)


#openstack安装包下载更新到库命令
## RPM更新
# yum缓存的rpm包拷贝到/www/share/openstack-pike/
find /www/share/yum -name *.rpm |sed -r 's#.*#mv & /www/share/openstack-pike/\n#'|bash
# #下载没有安装过的包
# yum install --downloadonly --downloaddir=/www/share/openstack-pike/ -y 包名称
# #下载已经安装过的包
# yum reinstall --downloadonly --downloaddir=/www/share/openstack-pike/ -y 包名称

#更新源
createrepo --update -p /www/share/openstack-pike/

#如果下载的ceph 安装包 把 蓝色字体处改成 ceph




 

使用方法
##########################################

#客户端使用源
wget -O /etc/yum.repos.d/openstack.repo http://192.168.0.48/share/openstack.repo
wget -O /etc/yum.repos.d/myceph.repo http://192.168.0.48/share/myceph.repo

#客户端测试,查看源名称
yum install httpd

下载安装包


#下载OpenStack安装包
yum install --downloadonly --downloaddir=/www/share/openstack-pike/ -y \
wget httpd ntp createrepo nload \
python-openstackclient openstack-selinux python2-PyMySQL openstack-utils \
corosync pacemaker pcs fence-agents resource-agents haproxy \
mariadb mariadb-server mariadb-galera-server expect rabbitmq-server erlang socat \
openstack-keystone mod_wsgi memcached python-memcached apr apr-util \
openstack-glance python-glance nfs-utils rpcbind \
openstack-nova-api openstack-nova-conductor   \
openstack-nova-console openstack-nova-novncproxy   \
openstack-nova-scheduler openstack-nova-placement-api \
openstack-neutron openstack-neutron-ml2  \
openstack-neutron-linuxbridge python-neutronclient ebtables ipset \
openstack-dashboard \
lvm2 openstack-cinder targetcli python-keystone \
openstack-nova-compute 

#下载Ceph安装包
yum install --downloadonly --downloaddir=/www/share/ceph/ -y ceph* #下载所有





 

 

 

posted @ 2018-02-07 16:17  小⑦  阅读(484)  评论(0)    收藏  举报