码迷,mamicode.com
首页 > 其他好文 > 详细

制作yum本地源

时间:2021-02-03 11:00:30      阅读:0      评论:0      收藏:0      [点我收藏+]

标签:linux   sqli   启动服务   roc   centos7   oda   技术   status   yun   

环境说明
系统: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版本:Train
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源修改为国内的源

  1. yum clean all

  2. yum makecache

  3. yum -y install vim createrepo yum-utils httpd net-tools reposync

  4. yum install centos-release-openstack-train

  5. ls -1 /etc/yum.repos.d/

  6. yum repolist

  7. [root@controller ~]# yum repolist

  8. Failed to set locale, defaulting to C

  9. Loaded plugins: fastestmirror

  10. 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
  11. repo id repo name status

  12. base/7/x86_64 CentOS-7 - Base 10097

  13. centos-ceph-nautilus/7/x86_64 CentOS-7 - Ceph Nautilus 224

  14. centos-nfs-ganesha28/7/x86_64 CentOS-7 - NFS Ganesha 2.8 140

  15. centos-openstack-stein/7/x86_64 CentOS-7 - OpenStack stein 2415+2

  16. centos-openstack-train/7/x86_64 CentOS-7 - OpenStack train 2323+2

  17. centos-qemu-ev/7/x86_64 CentOS-7 - QEMU EV 87

  18. extras/7/x86_64 CentOS-7 - Extras 341

  19. updates/7/x86_64 CentOS-7 - Updates 1787

  20. repolist: 17414

同步至本地

  1. mkdir -p /var/www/html/yumrepository

  2. reposync -p /var/www/html/yumrepository/
    ==============================================================================

  3. [root@controller yumrepository]# pwd

  4. /var/www/html/yumrepository

  5. [root@controller yumrepository]# ls

  6. base centos-nfs-ganesha28 centos-openstack-train extras

  7. centos-ceph-nautilus centos-openstack-stein centos-qemu-ev updates

  8. [root@controller 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@controller base]# ls

  • Packages

  • [root@controller 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@controller base]# ls

  • Packages repodata

  • [root@controller base]#
    ================================================================
    注意,在同步下来的每一个yum仓库目录都需要执行,上述操作。
    cd /var/www/html/yumrepository/base/
    ls
    createrepo .

后续更新了rpm软件库包的文件后,都要进入相应的目录,利用createrepo update进行同步。

reposync -p /var/www/html/yumrepository/
createrepo --update .

配置服务httpd

启动服务

systemctl start 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文件

  1. 移除原系统自带的repo文件,避免和新建的配置文件内容冲突

  2. mkdir ori_repo-config

  3. mv /etc/yum.repos.d/* ./ori_repo-config/

  4. touch /etc/yum.repos.d/CentOS-PrivateLocal.repo

  5. 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

制作yum本地源

标签:linux   sqli   启动服务   roc   centos7   oda   技术   status   yun   

原文地址:https://www.cnblogs.com/yyuuee/p/14364499.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!