search
top

How To Create Ftp Yum Repository On Fedora

Introduction

There comes a time when you cannot connect to the internet to your favorite repository for installation of packages. Thankfully we can create our own YUM repositories to have them available locally on our networks.

YUM stands for  Yellow Dog Modifier and is the Red Hat package manager that is able to query for information about available packages, fetch packages from repositories, install and uninstall them, and update an entire system to the latest available version. Yum performs automatic dependency resolution on packages you are updating, installing, or removing, and thus is able to automatically determine, fetch, and install all available dependent packages. Yum can be configured with new, additional repositories, or package sources, and also provides many plug-ins which enhance and extend its capabilities.

In this post we will see how to create our own YUM repository with our custom packages that are accessible using ftp to our other Fedora clients. Note: this can also serve up repositories for other RPM based distributions (CentOS, RHEL, etc..).

Here are the steps we will be covring.

  • Install vsftpd server
  • Create repository with createrepo
  • Configure repository
  • Configure clients

Install VSFTPD Server

Installation of the FTP server using vsftpd is pretty simple as it is part of the core packages for Fedora. VSFTPD stands for Very Secure Ftp Daemon.

Open a terminal session and type the following.

Fedora 21 and under:

$ sudo yum -y install vsftpd

Fedora 22 +

$ sudo dnf -y install vsftpd

Install Createrepo

Now we must install createrepo. Install and Create repository with createrepo

Fedora 21 and under

$ sudo yum -y install createrepo

Fedora 22 +

$ sudo dnf -y install createrepo

Create Repository

Now that we have the two main tools needed for our own repositories we need to create the directory and populate it with files.

$ cd /var/ftp/pub/Server/repodata
$ sudo cp myfiles /var/ftp/pub/Server/
$ cd /var/ftp/pub/Server

Using the createrepo command we can create the files and metadata needed for the clients to be able to read it.

$ sudo createrepo  –database /var/ftp/pub/Server/

Start FTP server
$ sudo service vsftpd start (Starting vsftpd services)
$ sudo chkconfig –add vsftpd ( making it persistent across all run levels)

Configure clients

Run following commands on clients

$ sudo vi /etc/yum.repos.d/yum_server.repo

Add:
[Server]
name=MY_SERVER
baseurl=ftp://192.168.2.100/pub/Server
gpgcheck=0

$ sudo vi /etc/vsftpd/vsftpd.conf
Set the following parameter (if not already set)
anonymous_enable = yes

$ sudo service vsftpd restart

At this point we can now run yum update (Fedora 21 and under) or dnf update (Fedora 22 and higher)

 

Conclusion

As we can see it is very simple to add your own repository for custom applications or just rpm’s of applications that you are always installing on your systems from a local networked system. This is especially useful in DMZ and systems that o not have Internet access to the packages.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

top