配置本地源主要为了解决:

配置HTTP服务

snippet.bash
[root@yz219 ~]# yum install httpd
[root@yz219 ~]# systemctl start httpd.service
[root@yz219 ~]# systemctl enable httpd.service

安装源工具

snippet.bash
[root@yz219 ~]# yum install yum-utils createrepo yum-plugin-priorities
[root@yz219 ~]# vim /etc/yum/pluginconf.d/priorities.conf
# 添加行:
gpgcheck = 0

创建本地源

snippet.bash
[root@yz219 ~]# cd /var/www/html/
[root@yz219 html]# mkdir repo
[root@yz219 html]# cd repo
[root@yz219 repo]# createrepo  ./
[root@yz219 repo]# ll
drwxr-xr-x. 2 root root 4096 112 17:47 repodata

下载需要的源文件,并解压到:/var/www/html/repo。

这里以ambari-2.7.4.0-centos7.tar.gz为例。

snippet.bash
[root@yz219 ~]# cd /var/www/html/repo
[root@yz219 repo]# tar zxvf /opt/software/ambari-2.7.4.0-centos7.tar.gz -C /var/www/html/repo

配置源:

snippet.bash
[root@yz219 ~]# vim /etc/yum.repos.d/ambari.repo
#VERSION_NUMBER=2.7.4.0--120
[ambari-2.7.4.0-120]
name=ambary Version - ambari-2.7.4.0-120
baseurl=http://127.0.0.1/repo/ambari/centos7/
gpgcheck=0
gpgkey=http://127.0.0.1/repo/ambari/centos7/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1

更新源

snippet.bash
[root@yz219 ~]# yum clean all
[root@yz219 ~]# yum makecache
# 查看资源库
[root@yz219 ~]# yum repolist