解压tar.gz文件到指定目录
tar -zxvf ambari-2.7.5.0-centos7.tar.gz -C /data/a_yum
安装httpd、createrepo
yum install httpd createrepo
查看结果:
修改httpd的配置文件,指定数据路径
vi /etc/httpd/conf/httpd.conf
注意:
1、可以自定义,更换目录.需要改以上3处,不然报错403
2、修改“#ServerName www.example.com:80”“#,改为ServerName localhost
启动httpd
systemctl start httpd
-------设置开机自启
[root@bdtest-main01 ~]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
创建yum源仓库
cd /data/a_yum/ambari/centos7/2.7.5.0-72/
createrepo .
备注:
createrepo 后需要加路径,上述命令最后的".",表示当前路径,不可缺少,否则会报错。命令执行后,会在当前路径下生成repodata文件夹
创建repo文件
cd /etc/yum.repos.d
vi ambari.repo
[ambari-2.7.5.0]
name=ambari-2.7.5
baseurl=http://{host_ip}/ambari/centos7/2.7.5.0-72
enabled=1
gpgcheck=0
priority=1
gpgkey=http://{host_ip}/ambari/centos7/2.7.5.0-72/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
说明:
baseurl可以在浏览器中验证是否能够正常访问。
生效源地址
清空:yum clean all
生成缓存:yum makecache
查看repo列表
yum repolist
[root@bdtest-main01 yum.repos.d]# yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.huaweicloud.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
HDP-3.1.5.0 | 2.9 kB 00:00:00
HDP-GPL-3.1.5.0 | 2.9 kB 00:00:00
HDP-UTILS-1.1.0.22 | 2.9 kB 00:00:00
ambari-2.7.5.0 | 2.9 kB 00:00:00
(1/4): HDP-3.1.5.0/primary_db | 89 kB 00:00:00
(2/4): HDP-UTILS-1.1.0.22/primary_db | 8.5 kB 00:00:00
(3/4): ambari-2.7.5.0/primary_db | 25 kB 00:00:00
(4/4): HDP-GPL-3.1.5.0/primary_db | 2.9 kB 00:00:00
repo id repo name status
HDP-3.1.5.0 HDP Version - HDP-3.1.5.0 201
HDP-GPL-3.1.5.0 HDP-GPL Version - HDP-GPL-3.1.5.0 4
HDP-UTILS-1.1.0.22 HDP-UTILS Version - HDP-UTILS-1.1.0.22 16
ambari-2.7.5.0 ambari Version - ambari-2.7.5.0 13
base/7/x86_64 CentOS-7 - Base 10,072
extras/7/x86_64 CentOS-7 - Extras 500
updates/7/x86_64 CentOS-7 - Updates 2,963
repolist: 13,769