码迷,mamicode.com
首页 > 其他好文 > 详细

FTP方式部署本地yum源

时间:2018-11-19 13:29:22      阅读:374      评论:0      收藏:0      [点我收藏+]

标签:pre   sys   extras   res   metadata   isa   clean   wan   lan   

一、配置本地YUM源

1、挂载CentOS7.4镜像至/mnt目录下(镜像在vmwareCD中)

mount  /dev/cdrom /mnt

2、在opt目录创建本地仓库,删除网页文件

cp -rv /mnt/* /opt/
cd /opt/
rm -rf *.html
rm -rf repodata/TRANS.TBL 

3、生成yum通用数据库

cd /mnt/Packages/
[root@localhost Packages]# yum install createrepo-0.9.9-28.el7.noarch.rpm 
[root@localhost Packages]# createrepo -g /opt/repodata/38b60f66d52704cffb8696750b2b6552438
c1ace283bc2cf22408b0ba0e4cbfa-c7-x86_64-comps.xml /opt/Spawning worker 0 with 3894 pkgs
Workers Finished
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete

4、添加配置文件

vim /etc/yum.repos.d/local-yum.repo
[local-yum]
name=local-yum
baseurl=file:///opt/
enabled=1
gpgcheck=0

5、重建yum缓存

[root@localhost Packages]# yum clean all
Loaded plugins: fastestmirror, langpacks
Cleaning repos: base extras local-yum updates
Cleaning up everything
Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from d
isabled or removed reposCleaning up list of fastest mirrors
[root@localhost Packages]# yum makecache 
Loaded plugins: fastestmirror, langpacks
base                                                               | 3.6 kB  00:00:00     
extras                                                             | 3.4 kB  00:00:00     
local-yum                                                          | 3.6 kB  00:00:00     
updates                                                            | 3.4 kB  00:00:00     
(1/16): base/7/x86_64/group_gz                                     | 166 kB  00:00:00     
(2/16): extras/7/x86_64/prestodelta                                | 100 kB  00:00:00     
(3/16): extras/7/x86_64/primary_db                                 | 204 kB  00:00:00     
(4/16): extras/7/x86_64/filelists_db                               | 603 kB  00:00:01     
(5/16): extras/7/x86_64/other_db                                   | 126 kB  00:00:00     
(6/16): local-yum/group_gz                                         | 156 kB  00:00:00     
(7/16): local-yum/primary_db                                       | 3.0 MB  00:00:00     
(8/16): local-yum/other_db                                         | 1.2 MB  00:00:00     
(9/16): local-yum/filelists_db                                     | 3.1 MB  00:00:00     
(10/16): base/7/x86_64/primary_db                                  | 5.9 MB  00:00:02     
(11/16): updates/7/x86_64/prestodelta                              | 672 kB  00:00:00     
(12/16): updates/7/x86_64/filelists_db                             | 3.3 MB  00:00:01     
(13/16): updates/7/x86_64/other_db                                 | 574 kB  00:00:00     
(14/16): updates/7/x86_64/primary_db                               | 6.0 MB  00:00:02     
(15/16): base/7/x86_64/other_db                                    | 2.5 MB  00:00:05     
(16/16): base/7/x86_64/filelists_db                                | 6.9 MB  00:00:06     
Determining fastest mirrors
 * base: mirror.ps.kz
 * extras: mirror.ps.kz
 * updates: mirror.ps.kz
Metadata Cache Created

二、FTP服务端配置

1、开启vsftpd服务并关闭防火墙

systemctl start vsftpd
systemctl stop firewalld.service 

2、修改FTP登陆目录

[root@localhost ~]# cat /etc/passwd | grep ftp
ftp:x:14:50:FTP User:/opt:/sbin/nologin

三、客户端配置

1、新建本地yum源配置文件

vim /etc/yum.repos.d/client1-yum.repo
[local-yum]
name=client1
baseurl=ftp://192.168.118.129/      #ftp服务器的IP地址,/ 在这里指的是FTP服务器设置的登陆目录/opt
enabled=1
gpgcheck=0

FTP方式部署本地yum源

标签:pre   sys   extras   res   metadata   isa   clean   wan   lan   

原文地址:http://blog.51cto.com/jiayimeng/2318735

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!