1挂载光盘
[root@cephcollect ~]# mkdir /mnt/yum/
2挂载ISO盘
[root@cephcollect ~]# mount /home/hadoop/CentOS-7-x86_64-DVD-1611.iso /mnt/yum/
[root@cephcollect ~]# ls /mnt/yum/
CentOS_BuildTag GPL LiveOS RPM-GPG-KEY-CentOS-7
EFI images Packages RPM-GPG-KEY-CentOS-Testing-7
EULA isolinux repodata TRANS.TBL
3识别挂载光盘,
[root@cephcollect ~]# cd /etc/yum.repos.d/
[root@cephcollect yum.repos.d]# ls
back centos-source.repo
[root@cephcollect yum.repos.d]# cat centos-source.repo
[centos-source]
name=centos-source
baseurl=file:///mnt/yum/
enabled=1
4安装httpd
[root@cephcollect ~]# yum install httpd -y
systemctl enable httpd.service
systemctl start httpd.service
5 本地源目录及文件
[root@kolla yum.repos.d]# cd /var/www/html/
[root@kolla html]# ls
base centos7 down.sh keys MariaDB sdb1
[root@kolla html]# ls keys/
autobuild.asc ceph index.html jessie-stable-release.asc release.asc RPM-GPG-KEY-CentOS-7
[root@kolla html]# ls sdb1/
ceph epel
[root@kolla html]#
6 yum源文件,修改yum源文件如下所示
[root@kolla yum.repos.d]# ls
back back1 CentOS-Base.repo ceph.repo epel.repo
[root@kolla yum.repos.d]# cat CentOS-Base.repo
[CentOS7-Localsource]
name=CentOS7
baseurl=http://192.168.229.131/centos7/
enabled=1
gpgcheck=0
[CentOS7-base]
name=base
baseurl=http://192.168.229.131/base/
enabled=1
gpgcheck=0
[root@kolla yum.repos.d]# cat ceph.repo
[Ceph]
name=Ceph packages
baseurl=http://192.168.229.131/sdb1/ceph/rpm-jewel/el7/x86_64/
enabled=1
gpgcheck=1
type=rpm-md
gpgkey=http://192.168.229.131/keys/release.asc
priority=1
[Ceph-noarch]
name=Ceph noarch packages
baseurl=http://192.168.229.131/sdb1/ceph/rpm-jewel/el7/noarch
enabled=1
gpgcheck=1
type=rpm-md
gpgkey=http://192.168.229.131/keys/release.asc
priority=1
[ceph-source]
name=Ceph source packages
baseurl=http://192.168.229.131/sdb1/ceph/rpm-jewel/el7/SRPMS
enabled=1
gpgcheck=1
type=rpm-md
gpgkey=http://192.168.229.131/keys/release.asc
priority=1
[root@kolla yum.repos.d]# cat epel.repo
[epel-local]
name=epel-local packages
baseurl=http://192.168.229.131/sdb1/epel/7/x86_64/
enabled=1
gpgcheck=1
failovermethod=priority
gpgkey=http://192.168.229.131/keys/RPM-GPG-KEY-EPEL-7
[root@kolla yum.repos.d]#
修改所有节点的/etc/hosts文件,同时包括上面的yum文件(根据实际情况编写,目前我用于测试本地源搭建ceph环境)
[root@cephcollect ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.229.130 cephcollect
[root@cephcollect ~]#
修改文件
[root@kolla yum.repos.d]# cd /usr/lib/python2.7/site-packages/ceph_deploy/hosts/centos/
[root@kolla centos]# vi install.py
69 if adjust_repos:
70 if version_kind in ['stable', 'testing']:
71 distro.packager.add_repo_gpg_key(gpg.url(key))
72
73 if version_kind == 'stable':
74 #url = 'https://download.ceph.com/rpm-{version}/{repo}/'.format(
75 url = 'http://192.168.229.131/sdb1/ceph/rpm-{version}/{repo}/'.format(
76 version=version,
77 repo=repo_part,
78 )
79 elif version_kind == 'testing':
80 url = 'https://download.ceph.com/rpm-testing/{repo}/'.format(repo=repo_part)
81
82 # remove any old ceph-release package from prevoius release
83 # remoto.process.run(
84 # distro.conn,
85 # [
86 # 'yum',
87 # 'remove',
88 # '-y',
89 # 'ceph-release'
90 # ],
91 # )
92 # remoto.process.run(
93 # distro.conn,
94 # [
95 # 'yum',
96 # 'install',
97 # '-y',
98 # '{url}noarch/ceph-release-1-0.{dist}.noarch.rpm'.format(url=url, dist=dist),
99 # ],
100 # )
[root@kolla centos]# cd /usr/lib/python2.7/site-packages/ceph_deploy/util/
[root@kolla util]# vi constants.py
35 gpg_key_base_url = "192.168.229.131/keys/"
36 #gpg_key_base_url = "download.ceph.com/keys/"
[root@kolla util]# cd /usr/lib/python2.7/site-packages/ceph_deploy/util/paths/
[root@kolla paths]# vi gpg.py
1 from ceph_deploy.util import constants
2
3 def url(key_type, protocol="http"):