Linux Deployment YUM Warehouse

Keywords: Linux ftp yum vsftpd RPM

This article mainly describes how to build a custom YUM source, in a host environment with a large number of local networks, can reduce dependence on the external network.


Install vsftp package

[root@server ~]# yum install vsftpd -y

Adding related resource bundles

  • Create directories to store
[root@server ~]# mkdir /var/ftp/centos7 /var/ftp/others
[root@server ~]# ls /var/ftp/
centos7  others  pub
  • Copy the contents of the mirror file to the relevant directory
[root@server ~]# mount /dev/cdrom /mnt/
mount: /dev/sr0 is write-protected, mounting read-only
[root@server ~]# cp -r /mnt/* /var/ftp/centos7/
  • Create repodata for the other directory
[root@server ~]# 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
  • Check that the documents are complete
[root@server ~]# 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
[root@server ~]# ls /var/ftp/others/

Open Services

[root@server ~]# systemctl enable vsftpd
Created symlink from /etc/systemd/system/ to /usr/lib/systemd/system/vsftpd.service.
[root@server ~]# systemctl start vsftpd
[root@server ~]# netstat -ntuap | grep vsftpd
tcp6       0      0 :::21                   :::*                    LISTEN      35971/vsftpd        

Close the firewall

[root@server ~]# systemctl stop firewalld
[root@server ~]# setenforce 0


Install ftp packages

[root@client ~]# yum install ftp -y

Anonymous login view

[root@client ~]# ftp
Connected to (
220 (vsFTPd 3.0.2)
Name ( ftp
331 Please specify the 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.

Edit YUM source configuration file

  • Back up existing yum sources
[root@client ~]# cd /etc/yum.repos.d/
[root@client yum.repos.d]# mkdir bak
[root@client yum.repos.d]# mv *.repo bak/
  • Edit custom yum source
[root@client yum.repos.d]# vim ftp.repo


View the results

[root@client ~]# 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
[root@client ~]# yum list

Posted by skot on Tue, 08 Oct 2019 12:36:43 -0700