Configuring YUM Repositories and NFS Shared Storage on Linux

Configuring Local and Remote YUM Repositories

Setting Up a Local Repository Using File Access

Create a repository definition file pointing to a ISO mount point:

cd /etc/yum.repos.d/
cat > local-repo.repo <<EOF
[local-repo]
name=Local Repository
baseurl=file:///iso_mount
enabled=1
gpgcheck=0
EOF

mkdir -p /iso_mount
mount /dev/cdrom /iso_mount          # Mount installation media
yum clean all && yum makecache       # Refresh metadata
yum repolist                         # Verify availability

Publishing a Repository via FTP

Install and configure the FTP daemon:

rpm -q vsftpd || yum -y install vsftpd
mkdir -p /srv/ftp/centos_repo
mount /dev/cdrom /mnt_iso
cp -a /mnt_iso/* /srv/ftp/centos_repo/ &

mkdir /srv/ftp/additional
cd /srv/ftp/additional
createrepo -g /mnt_iso/repodata/repomd.xml .

systemctl enable --now vsftpd

Client configuration for FTP-based access:

cat > /etc/yum.repos.d/ftp-centos.repo <<EOF
[ftp-centos]
name=FTP CentOS Repository
baseurl=ftp://192.168.44.10/centos_repo
enabled=1
gpgcheck=1
gpgkey=ftp://192.168.44.10/centos/RPM-GPG-KEY-CentOS-7

[ftp-additional]
name=FTP Additional Packages
baseurl=ftp://192.168.44.10/additional
enabled=1
gpgcheck=1
EOF

yum clean all && yum makecache

HTTP-Based Repository

The procedure mirrors FTP setup, replacing the protocol and directory paths in the .repo file:

[http-centos]
name=HTTP CentOS Mirror
baseurl=http://192.168.44.10/http_repo
enabled=1
gpgcheck=1

Using Alibaba Cloud Public Mirror

Retrieve and adopt the upstream definition:

wget http://mirrors.aliyun.com/repo/Centos-7.repo -O Aliyun-CentOS.repo

Edit Aliyun-CentOS.repo to adjust base URLs or enable optional sections as needed.


Deploying NFS Shared Storage

NFS enables transparent remote file system mounting over TCP/IP. It is suited for LAN environments due to limited authentication and plaintext transmission.

Core Characteristics

  • Uses TCP/IP for transport
  • Minimal security controls
  • Simple configuration
  • Effective within trusted networks

Connection Sequence

  1. Server launches rpcbind listening on port 111.
  2. Server starts nfs-server and registers its ports with rpcbind.
  3. Client initiates rpcbind and requests NFS port info from server.
  4. Server returns assigned NFS port.
  5. Client connects using the received port for data exchange.

Export Options Overview

Option Effect
rw Read/write access
ro Read-only access
sync Write operations committed synchronously
async Writes cached, risking data loss on failure
subtree_check Verifies parent dir permissions
no_subtree_check Skips parent permission check for performance
no_root_squash Retains root privileges for client root user
root_squash Maps root to anonymous user
all_squash Maps all users to anonymous

Server-Side Setup

# Install required services
rpm -q rpcbind nfs-utils || yum -y install rpcbind nfs-utils

# Define export
mkdir -p /shared_data
cat >> /etc/exports <<EOF
/shared_data 192.168.44.0/24(rw,sync,no_root_squash)
EOF

# Activate services
systemctl enable --now rpcbind
systemctl enable --now nfs-server

# Apply changes
exportfs -rav

Verify exported paths:

showmount -e localhost

Client-Side Configuration

# Install tools
rpm -q rpcbind nfs-utils || yum -y install rpcbind nfs-utils

# Start services
systemctl enable --now rpcbind

# Discover shares
showmount -e 192.168.44.10

# Mount remotely
d mkdir -p /mnt/nfs_share
mount -t nfs 192.168.44.10:/shared_data /mnt/nfs_share

Tags: Yum repository FTP HTTP NFS

Posted on Wed, 13 May 2026 12:57:35 +0000 by Helljumper