CentOS7创建本地源过程

1)使用yum安装http服务(主节点)

yum -y install httpd

2)将httpd服务加入系统自启动服务并设置开机启动

systemctl start httpd    #启动apache服务器
systemctl stop httpd     #关闭apache服务器
systemctl enable httpd  #设置开机自动启动
systemctl status httpd.service  #检查httpd服务状态 

3)下载CM5.12.1rpm包(注意:此路径包含的是CentOS7版本的rpm包

https://archive.cloudera.com/cm5/redhat/7/x86_64/cm/5.12.1/RPMS/x86_64/

将以上7个文件下载/var/www/html/cm5.12.1目录下

mkdir -p /var/www/html/cm5.12.1
cd /var/www/html/cm5.12.1/

4)创建cm本地源

[root@hadoop101 cm5.12.1]# cd /var/www/html/cm5.12.1/
[root@hadoop101 cm5.12.1]# createrepo .
Spawning worker 0 with 7 pkgs
Workers Finished
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete

5)访问http://hadoop101.com/cm5.12.1/确认本地源是否能正常访问

6)配置cm的本地源,在/etc/yum.repo.d/目录下增加cm.repo文件,写入以下配置

[root@hadoop101 cm5.12.1]#  vim /etc/yum.repos.d/cm.repo
[cmrepo]
name=CM5.12.1
baseurl=http://hadoop101.com/cm5.12.1
gpgcheck=false
enabled=true

7)验证CM源是否配置成功

[root@hadoop101 cm5.12.1]# yum repolist
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.nju.edu.cn
 * extras: mirrors.njupt.edu.cn
 * updates: mirrors.njupt.edu.cn
cmrepo                                                                                                                                      | 2.9 kB  00:00:00     
cmrepo/primary_db                                                                                                                           | 1.1 kB  00:00:00     
repo id                                                                      repo name                                                                       status
base/7/x86_64                                                                CentOS-7 - Base                                                                 10,019
cmrepo                                                                       CM5.12.1                                                                             0
extras/7/x86_64                                                              CentOS-7 - Extras                                                                  435
updates/7/x86_64                                                             CentOS-7 - Updates                                                               2,500
repolist: 12,954

8)将cm.repo分发到其余各节点

[root@hadoop101 cm5.12.1]# xsync /etc/yum.repos.d/cm.repo 
fname=cm.repo
pdir=/etc/yum.repos.d
------------------- hadoop102 --------------
sending incremental file list
cm.repo

sent 181 bytes  received 35 bytes  144.00 bytes/sec
total size is 89  speedup is 0.41
------------------- hadoop103 --------------
sending incremental file list
cm.repo

sent 181 bytes  received 35 bytes  432.00 bytes/sec
total size is 89  speedup is 0.41

3.4 启动CM服务

原文地址:https://www.cnblogs.com/MWCloud/p/11365952.html