Linux   发布时间:2022-03-31  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了Linux 部署 YUM 仓库大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

本篇主要写了怎么搭建自定义的YUM源,在一个拥有大量本地网络的主机环境中,可以减少对外网的依赖。 Server 安装 vsftp 包 [[email protected] ~]# yum install vsftpd -y 添加相关资源包 创建需要存放的目录 [[email protected] ~]# mkdir /var/ftp/centos7 /var/ftp/others [[email 

Linux 部署 YUM 仓库

本篇主要写了怎么搭建自定义YUM源,在一个拥有大量本地网络的主机环境中,可以减少对外网的依赖。

Server

安装 vsftp 包

[[email protected] ~]# yum install vsftpd -y

添加相关资源包

  • 创建需要存放的目录
[[email protected] ~]# mkdir /var/ftp/centos7 /var/ftp/others
[[email protected] ~]# ls /var/ftp/
centos7  others  pub
[[email protected] ~]# mount /dev/cdrom /mnt/
mount: /dev/sr0 is write-protected,mounting read-only
[[email protected] ~]# cp -r /mnt/* /var/ftp/centos7/
  • others目录创建repodata
[[email protected] ~]# createrepo -g /var/ftp/centos7/repodata/repomd.xml /var/ftp/others/
Saving Primary Metadata
Saving file lists Metadata
Saving other Metadata
Generating sqlite DBs
sqlite DBs complete
[[email protected] ~]# ls /var/ftp/centos7/
CentOS_BuildTag  EFI  EULA  GPL  images  isolinux  LiveOS  Packages  repodata  RPM-GPG-KEY-CentOS-7  RPM-GPG-KEY-CentOS-Testing-7  TRANS.TBL
[[email protected] ~]# ls /var/ftp/others/
repodata

开启服务

[[email protected] ~]# systemctl enable vsftpd
Created symlink from /etc/systemd/system/multi-user.target.wants/vsftpd.service to /usr/lib/systemd/system/vsftpd.service.
[[email protected] ~]# systemctl start vsftpd
[[email protected] ~]# netstat -ntuap | grep vsftpd
tcp6       0      0 :::21                   :::*                    LISTEN      35971/vsftpd

关闭防火墙

[[email protected] ~]# systemctl stop firewalld
[[email protected] ~]# setenforce 0

Client

安装 ftp 包

[[email protected] ~]# yum install ftp -y

匿名登录查看

[[email protected] ~]# ftp 192.168.28.128
Connected to 192.168.28.128 (192.168.28.128).
220 (vsFTPd 3.0.2)
Name (192.168.28.128:root): ftp
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
227 Entering Passive Mode (192,168,28,128,255,56).
150 Here comes the directory listing.
drwxr-xr-x    8 0        0            2048 Sep 05  2017 centos7
drwxr-xr-x    3 0        0              22 Sep 16 19:42 others
drwxr-xr-x    2 0        0               6 Oct 30  2018 pub
226 Directory send OK.
ftp> bye
221 Goodbye.

编辑 YUM 源配置文件

  • 备份已有yum
[[email protected] ~]# cd /etc/yum.repos.d/
[[email protected] yum.repos.d]# mkdir bak
[[email protected] yum.repos.d]# mv *.repo bak/
[[email protected] yum.repos.d]# vim ftp.repo
[base]
name=centos7.Packages
baseurl=ftp://192.168.28.128/centos7/
enabled=1
gpgcheck=1
gpgkey=ftp://192.168.28.128/centos7/RPM-GPG-KEY-CentOS-7

[others]
name=others.Packages
baseurl=ftp://192.168.28.128/others/
enabled=1
gpgcheck=0

查看结果

[[email protected] ~]# yum clean all
Loaded plugins: fastestmirror
Cleaning repos: base others
Cleaning up everything
Maybe you want: rm -rf /var/cache/yum,to also free up space taken by orphaned data from disabled or removed repos
Cleaning up list of fastest mirrors
[[email protected] ~]# yum list

大佬总结

以上是大佬教程为你收集整理的Linux 部署 YUM 仓库全部内容,希望文章能够帮你解决Linux 部署 YUM 仓库所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: