Linux下创建本地yum源Server
Posted 幸福的富贵竹
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linux下创建本地yum源Server相关的知识,希望对你有一定的参考价值。
1.安装软件
操作系统版本:CentOS 7.4
检查是否安装了createrepo:
[[email protected] ~]# rpm -qa|grep createrepo
createrepo-0.9.9-28.el7.noarch
如果没有安装需要使用yum安装:
[[email protected] ~]# yum install createrepo
......
Installed:
createrepo.noarch 0:0.9.9-28.el7
?
Dependency Installed:
deltarpm.x86_64 0:3.6-3.el7 libxml2-python.x86_64 0:2.9.1-6.el7_2.3
python-deltarpm.x86_64 0:3.6-3.el7
?
Complete!
检查是否安装了httpd:
[[email protected] ~]# rpm -qa|grep httpd
httpd-tools-2.4.6-67.el7.centos.x86_64
httpd-2.4.6-67.el7.centos.x86_64
如果没有安装需要使用同样的方法安装httpd组件。
2.创建目录
该目录下存放其他节点安装需要的rpm包,目录创建在文件夹/var/www/html下:
[[email protected] www]# mkdir -p /var/www/html/cm5
[[email protected] html]# ll
total 0
drwxr-xr-x 2 root root 6 Jan 30 21:44 cm5
[[email protected] html]# createrepo cm5
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
[[email protected] html]# ll
total 0
drwxr-xr-x 3 root root 22 Jan 30 21:46 cm5
[[email protected] html]# cd cm5/
[[email protected] cm5]# ll
total 4
drwxr-xr-x 2 root root 4096 Jan 30 21:46 repodata
cm5下面会新增一个repodata目录,说明repo源制作成功。
3.启动httpd服务
[[email protected] cm5]# systemctl restart httpd
[[email protected] cm5]#
[[email protected] cm5]#
[[email protected] cm5]# systemctl status httpd
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Active: active (running) since Wed 2019-01-30 21:51:15 CST; 7s ago
验证repo源是否能够正常访问:http://192.168.246.161/cm5/,如果能够正常访问则httpd服务启动正常。
4.创建repo文件
进入目录/etc/yum.repos.d/,创建repo文件。
[[email protected] yum.repos.d]# cat > cm5epo.repo
[cmrepo]
name=cmrepo
baseurl=http://node2/cm5
enabled=1
gpgcheck=0
^C
[[email protected] yum.repos.d]# cat cm5epo.repo
[cmrepo]
name=cmrepo
baseurl=http://node2/cm5
enabled=1
gpgcheck=0
5.验证repo源是否配置成功
首先清空yum缓存,然后重建yum缓存,通过yum list命令查看已经上传的rpm文件,说明repo源搭建成功。只要将cm5epo.repo文件复制到其他节点上就可以正常通过yum安装rpm文件了。
[[email protected] yum.repos.d]# yum clean
Loaded plugins: fastestmirror
Error: clean requires an option: headers, packages, metadata, dbcache, plugins, expire-cache, rpmdb, all
[[email protected] yum.repos.d]#
[[email protected] yum.repos.d]#
[[email protected] yum.repos.d]# yum makecache
Loaded plugins: fastestmirror
c7-media | 3.6 kB 00:00
cloudera-manager | 951 B 00:00
cmrepo | 2.9 kB 00:00
(1/3): cmrepo/filelists_db | 586 B 00:00
(2/3): cmrepo/other_db | 575 B 00:00
(3/3): cmrepo/primary_db | 1.1 kB 00:00
Loading mirror speeds from cached hostfile
Metadata Cache Created
[[email protected] yum.repos.d]#
[[email protected] yum.repos.d]#
[[email protected] yum.repos.d]# yum list |grep clouder
cloudera-manager-agent.x86_64 5.15.2-1.cm5152.p0.2.el7 installed
cloudera-manager-daemons.x86_64 5.15.2-1.cm5152.p0.2.el7 installed
cloudera-manager-server.x86_64 5.15.2-1.cm5152.p0.2.el7 cloudera-manager
cloudera-manager-server-db-2.x86_64 5.15.2-1.cm5152.p0.2.el7 cloudera-manager
以上是关于Linux下创建本地yum源Server的主要内容,如果未能解决你的问题,请参考以下文章