OpenStack离线安装系列0:制作yum源 如果采用离线源代码安装,则通常需要配置本地 pip 源;如果采用离线软件安装包的形式安装,则通常需要配置本地 yum 源。 环境说明 系统:Centos7 版本:CentOS-7-x86_64-Minimal-1908 ISO下载链接:http://mirrors.aliyun.com/centos/7/isos/x86_64/CentOS-7-x86_64-Minimal-1908.iso 截至发稿前,Centos7源中包含以下版本的openstack openstack-queens openstack-rocky openstack-stein openstack-train OpenStack版本:Tain OpenStack源: centos:http://mirror.centos.org/centos/7/cloud/x86_64/ 北理工:http://mirror.bit.edu.cn/centos/7/cloud/x86_64/ 阿里云:http://mirrors.aliyun.com/centos/7/cloud/x86_64/ 软件安装 在安装之前建议将yum源修改为国内的源 yum clean all yum makecache yum -y install vim createrepo yum-utils httpd net-tools reposync yum install centos-release-openstack-train ls -1 /etc/yum.repos.d/ yum repolist [root@host-192-168-2-123 ~]# yum repolist Failed to set locale, defaulting to C Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * centos-ceph-nautilus: mirrors.aliyun.com * centos-nfs-ganesha28: mirrors.aliyun.com * centos-openstack-stein: mirrors.aliyun.com * centos-openstack-train: mirrors.aliyun.com * centos-qemu-ev: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com repo id repo name status base/7/x86_64 CentOS-7 - Base 10097 centos-ceph-nautilus/7/x86_64 CentOS-7 - Ceph Nautilus 224 centos-nfs-ganesha28/7/x86_64 CentOS-7 - NFS Ganesha 2.8 140 centos-openstack-stein/7/x86_64 CentOS-7 - OpenStack stein 2415+2 centos-openstack-train/7/x86_64 CentOS-7 - OpenStack train 2323+2 centos-qemu-ev/7/x86_64 CentOS-7 - QEMU EV 87 extras/7/x86_64 CentOS-7 - Extras 341 updates/7/x86_64 CentOS-7 - Updates 1787 repolist: 17414 同步至本地 mkdir -p /var/www/html/yumrepository reposync -p /var/www/html/yumrepository/ 1 2 3 [root@host-192-168-2-123 yumrepository]# pwd /var/www/html/yumrepository [root@host-192-168-2-123 yumrepository]# ls base centos-nfs-ganesha28 centos-openstack-train extras centos-ceph-nautilus centos-openstack-stein centos-qemu-ev updates [root@host-192-168-2-123 yumrepository]# 等待OpenStack安装包下载到本地目录后,需要重新生成yum仓库或者更新原有仓库。因此同步完成后远程yum仓库中的repodata可能不会被同步到本地,仓库路径可能已经改变,因此仅需对同步到本地的yum仓库进行升级。创建或更新本地yum仓库的命令为createrepo,该命令由createrepo安装包提供。 本地制作 创建yum仓库 # 进入每一个文件夹, cd /var/www/html/yumrepository cd ./base # 利用createrepo工具制作yum源,如果没有createrepo工具则利用yum安装 yum install createrepo -y createrepo . # 制作完成后,相对应的路径下会出现repodata文件,则说明制作成功 [root@host-192-168-2-123 base]# ls Packages [root@host-192-168-2-123 base]# createrepo . Spawning worker 0 with 5049 pkgs Spawning worker 1 with 5048 pkgs Workers Finished Saving Primary metadata Saving file lists metadata Saving other metadata Generating sqlite DBs Sqlite DBs complete [root@host-192-168-2-123 base]# ls Packages repodata [root@host-192-168-2-123 base]# 注意,在同步下来的每一个yum仓库目录都需要执行,上述操作。 cd /var/www/html/yumrepository/base/ ls createrepo . # 后续更新了rpm软件库包的文件后,都要进入相应的目录,利用createrepo update进行同步。 reposync -p /var/www/html/yumrepository/ createrepo --update . 配置服务httpd #启动服务 systemctl restart httpd # 设置开机自动启动 systemctl enable httpd systemctl status httpd 配置目录文件说明: 服务目录 /etc/httpd 主配置文件 /etc/httpd/conf/httpd.conf 网站数据目录 /var/www/html 访问日志 /var/log/httpd/access_log 错误日志 /var/log/httpd/error_log 修改配置文件 /etc/selinux/config vim /etc/selinux/config SELINUX=disabled 关闭防火墙,selinux,NetworkManager systemctl stop firewalld NetworkManager.service systemctl disable firewalld NetworkManager.service systemctl status firewalld NetworkManager.service setenforce 0 验证 在另一台机器,新建一个repo文件 # 移除原系统自带的repo文件,避免和新建的配置文件内容冲突 mkdir ori_repo-config mv /etc/yum.repos.d/* ./ori_repo-config/ touch /etc/yum.repos.d/CentOS-PrivateLocal.repo vim /etc/yum.repos.d/CentOS-PrivateLocal.repo 注意: ①IP地址更换为yumrepository所在主机的地址。 ②为避免安装冲突,[centos-openstack-stein]和[centos-openstack-train]只保留一个。 [base] name=CentOS-$releasever - Base baseurl=http://192.168.2.123/yumrepository/base/ gpgcheck=0 enabled=1 [updates] name=CentOS-$releasever - Updates baseurl=http://192.168.2.123/yumrepository/updates/ gpgcheck=0 enabled=1 [extras] name=CentOS-$releasever - Extras baseurl=http://192.168.2.123/yumrepository/extras/ gpgcheck=0 enabled=1 [centos-openstack-train] name=CentOS-7 - OpenStack train baseurl=http://192.168.2.123/yumrepository/centos-openstack-train/ gpgcheck=0 enabled=1 [centos-qemu-ev] name=CentOS-$releasever - QEMU EV baseurl=http://192.168.2.123/yumrepository/centos-qemu-ev/ gpgcheck=0 enabled=1 [centos-ceph-nautilus] name=CentOS-7 - Ceph Nautilus baseurl=http://192.168.2.123/yumrepository/centos-ceph-nautilus/ gpgcheck=0 enabled=1 [centos-nfs-ganesha28] name=CentOS-7 - NFS Ganesha 2.8 baseurl=http://192.168.2.123/yumrepository/centos-nfs-ganesha28/ gpgcheck=0 enabled=1 配置完成后,通常需要清除yum中原有的cache,并重新生成cache。清除yum陈旧cache的命令如下: yum clean all yum makecache ———————————————— 版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。 原文链接:https://blog.csdn.net/u013469753/article/details/106274126/
TRANSLATE with x English TRANSLATE with COPY THE URL BELOW Back EMBED THE SNIPPET BELOW IN YOUR SITE Enable collaborative features and customize widget: Bing Webmaster Portal Back 标签:centos,CentOS,离线,64,yum,openstack,OpenStack,yumrepository From: https://www.cnblogs.com/gaoyuechen/p/18119513