FTP方式部署本地yum源
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了FTP方式部署本地yum源相关的知识,希望对你有一定的参考价值。
一、配置本地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/
[[email protected] Packages]# yum install createrepo-0.9.9-28.el7.noarch.rpm
[[email protected] 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缓存
[[email protected] 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
[[email protected] 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登陆目录
[[email protected] ~]# 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源的主要内容,如果未能解决你的问题,请参考以下文章