CentOS7搭建本地yum仓库--CEPH

一 环境信息

cpu:Intel(R) Core(TM) i7-6500U CPU @ 2.50GHz //4core
mem:total 7686,swap 7935
os:Linux promote.cache-dns.local 3.10.0-957.el7.x86_64
ceph:rh-luminous
network:NAT

二 依赖包下载

NOTE:本节操作需要联网下载,如果已经下载的可以直接拷贝

  1. ceph-ansible 下载
git clone https://github.com/ceph/ceph-ansible.git
git checkout stable-3.2
  1. yum仓库创建所需rpm包下载
  • 文件存放路径
mkdir -p /home/http/repo/httpd/el7
mkdir -p /home/http/repo/ntp/el7
mkdir -p /home/http/repo/createrepo/el7
  • rpm包&依赖解决
yum install --downloadonly --downloaddir /home/http/repo/httpd/el7 httpd
yum install --downloadonly --downloaddir /home/http/repo/ntp/el7 ntp 
yum install --downloadonly --downloaddir /home/http/repo/createrepo/el7 createrepo
  1. ceph安装所需rpm包下载
  • 文件存放路径
mkdir -p /home/http/repo/ceph/luminous
mkdir -p /home/http/repo/ansible/2.6.4
  • rpm包&依赖解决
yum install --downloadonly --downloaddir /home/http/repo/ceph/luminous  http://download.ceph.com/rpm-luminous/el7/noarch/ceph-release-1-1.el7.noarch.rpm
yum install --downloadonly --downloaddir /home/http/repo/ceph/luminous ceph-common.x86_64
yum install --downloadonly --downloaddir /home/http/repo/ansible/2.6.4 centos-release-ansible26.noarch
  1. python包下载
  • 文件存放路径
mkdir -p /home/http/repo/python/pip
mkdir -p /home/http/repo/python/deps
  • 下载安装包
yum install --downloadonly --downloaddir /home/http/repo/python/pip python-pip
cd /home/http/repo/python/pip python-pip
rpm -ivh *.rpm
pip install --download /home/http/repo/python/deps -r requirements.txt
  1. 查看
[root@localhost ~]# tree /home/http/repo/
/home/http/repo/
├── ansible
│   └── 2.6.4
│       ├── centos-release-ansible26-1-3.el7.centos.noarch.rpm
│       └── centos-release-configmanagement-1-1.el7.centos.noarch.rpm
├── ceph
│   └── luminous
│       ├── at-3.1.13-24.el7.x86_64.rpm
│       ├── avahi-libs-0.6.31-19.el7.x86_64.rpm
│       ├── bc-1.06.95-13.el7.x86_64.rpm
│       ├── boost-iostreams-1.53.0-27.el7.x86_64.rpm
│       ├── boost-program-options-1.53.0-27.el7.x86_64.rpm
│       ├── boost-random-1.53.0-27.el7.x86_64.rpm
│       ├── boost-regex-1.53.0-27.el7.x86_64.rpm
│       ├── boost-system-1.53.0-27.el7.x86_64.rpm
│       ├── boost-thread-1.53.0-27.el7.x86_64.rpm
│       ├── centos-release-ceph-luminous-1.1-2.el7.centos.noarch.rpm
│       ├── centos-release-storage-common-2-2.el7.centos.noarch.rpm
│       ├── ceph-common-10.2.5-4.el7.x86_64.rpm
│       ├── cryptsetup-2.0.3-3.el7.x86_64.rpm
│       ├── cups-client-1.6.3-35.el7.x86_64.rpm
│       ├── cups-libs-1.6.3-35.el7.x86_64.rpm
│       ├── ed-1.9-4.el7.x86_64.rpm
│       ├── gdisk-0.8.10-2.el7.x86_64.rpm
│       ├── hdparm-9.43-5.el7.x86_64.rpm
│       ├── libicu-50.1.2-17.el7.x86_64.rpm
│       ├── librados2-10.2.5-4.el7.x86_64.rpm
│       ├── librbd1-10.2.5-4.el7.x86_64.rpm
│       ├── m4-1.4.16-10.el7.x86_64.rpm
│       ├── mailx-12.5-19.el7.x86_64.rpm
│       ├── patch-2.7.1-10.el7_5.x86_64.rpm
│       ├── psmisc-22.20-15.el7.x86_64.rpm
│       ├── python-backports-1.0-8.el7.x86_64.rpm
│       ├── python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch.rpm
│       ├── python-chardet-2.2.1-1.el7_1.noarch.rpm
│       ├── python-ipaddress-1.0.16-2.el7.noarch.rpm
│       ├── python-rados-10.2.5-4.el7.x86_64.rpm
│       ├── python-rbd-10.2.5-4.el7.x86_64.rpm
│       ├── python-requests-2.6.0-1.el7_1.noarch.rpm
│       ├── python-six-1.9.0-2.el7.noarch.rpm
│       ├── python-urllib3-1.10.2-5.el7.noarch.rpm
│       ├── redhat-lsb-core-4.1-27.el7.centos.1.x86_64.rpm
│       ├── redhat-lsb-submod-security-4.1-27.el7.centos.1.x86_64.rpm
│       ├── spax-1.5.2-13.el7.x86_64.rpm
│       └── time-1.7-45.el7.x86_64.rpm
├── createrepo
│   └── el7
│       ├── createrepo-0.9.9-28.el7.noarch.rpm
│       ├── deltarpm-3.6-3.el7.x86_64.rpm
│       ├── libxml2-python-2.9.1-6.el7_2.3.x86_64.rpm
│       └── python-deltarpm-3.6-3.el7.x86_64.rpm
├── httpd
│   └── el7
│       └── httpd-2.4.6-88.el7.centos.x86_64.rpm
├── keys
│   └── RPM-GPG-KEY-CentOS-7
└── ntp
    └── el7
        ├── autogen-libopts-5.18-5.el7.x86_64.rpm
        ├── ntp-4.2.6p5-28.el7.centos.x86_64.rpm
        └── ntpdate-4.2.6p5-28.el7.centos.x86_64.rpm

11 directories, 49 files

NOTE:以下章节操作不需要联网操作

三 文件服务器

  1. 安装httpd
cd /home/http/repo/httpd/el7
rpm -ivh *.rpm
  1. 编辑文件服务器路径
vi /etc/httpd/conf/httpd.conf
------------------------------------
# DocumentRoot "/var/www/html"
DocumentRoot "/home/http/"
ServerName 192.168.232.129
...
#

...
#

...
------------------------------------

NOTE:ServerName 是本机IP,也可以是配置过的主机名或域名

  1. 启动服务
  • 重启httpd服务
systemctl stop firewalld
systemctl restart httpd
setenforce 0
  • 访问文件服务器
    浏览器输入
    http://192.168.232.129/repo/
    YUM_LOCAL_01.PNG

四 创建本地仓库

  1. 安装createrepo
cd /home/http/repo/createrepo/el7
rpm -ivh *.rpm
  1. 创建仓库
createrepo /home/http/repo/ntp/el7
createrepo /home/http/repo/httpd/el7
createrepo /home/http/repo/createrepo/el7
createrepo /home/http/repo/ceph/luminous
createrepo /home/http/repo/ansible/2.6.4
  1. gpgkey
mkdir -p /home/http/repo/keys
cp /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 /home/http/repo/keys

五 使用本地仓库

  1. 配置本地源
touch /etc/yum.repos.d/local.repo
vi /etc/yum.repos.d/local.repo
------------------------------------------------------------
[ntp]
name=ntp
baseurl=http://192.168.232.129/repo/ntp/el7/
enabled=1
gpgcheck=0
type=rpm-md
gpgkey=http://192.168.232.129/repo/keys/RPM-GPG-KEY-CentOS-7
[httpd]
name=httpd
baseurl=http://192.168.232.129/repo/httpd/el7/
enabled=1
gpgcheck=0
type=rpm-md
gpgkey=http://192.168.232.129/repo/keys/RPM-GPG-KEY-CentOS-7
[createrepo]
name=createrepo
baseurl=http://192.168.232.129/repo/createrepo/el7/
enabled=1
gpgcheck=0
type=rpm-md
gpgkey=http://192.168.232.129/repo/keys/RPM-GPG-KEY-CentOS-7
[ceph]
name=ceph
baseurl=http://192.168.232.129/repo/ceph/luminous/
enabled=1
gpgcheck=0
type=rpm-md
gpgkey=http://192.168.232.129/repo/keys/RPM-GPG-KEY-CentOS-7
[ansible]
name=ansible
baseurl=http://192.168.232.129/repo/ansible/2.6.4/
enabled=1
gpgcheck=0
type=rpm-md
gpgkey=http://192.168.232.129/repo/keys/RPM-GPG-KEY-CentOS-7
------------------------------------------------------------
  1. 本地源生效
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
yum clean all
yum update -y
  1. 查看repo信息
yum repoinfo ceph
YUM_LOCAL_02.PNG

六 问题和错误解决

  1. httpd启动失败:Permission denied: AH00072: make_sock: could not bind to address [::]:80
    systemctl stop firewalld
  2. 本地源不生效:Cannot find a valid baseurl for repo: base/7/x86_64
    mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak

你可能感兴趣的:(CentOS7搭建本地yum仓库--CEPH)