Blog Post

Pro Services Blog
3 MIN READ

How to Set Up an NFS Server for SL1 Backups

EugeneC's avatar
EugeneC
Icon for Employee rankEmployee
4 days ago

Backing up your ScienceLogic SL1 database is essential for ensuring data integrity and disaster recovery. One effective way to store backups is by setting up a Network File System (NFS) server. NFS allows you to share a directory across multiple machines, making it an ideal solution for centralized SL1 backups.

This guide will walk you through the process of installing and configuring an NFS server to store SL1 backups.


Step 1: Install the NFS Server

Before setting up the NFS server, ensure that your Linux machine has the necessary NFS packages installed. If the nfs-server package is missing, you need to install it.

For RHEL, CentOS, Rocky Linux, or AlmaLinux:
sudo yum install -y nfs-utils
For Ubuntu or Debian:
sudo apt update 
sudo apt install -y nfs-kernel-server

After installation, start and enable the NFS service:

sudo systemctl start nfs-server 
sudo systemctl enable nfs-server

Verify the NFS server is running:

sudo systemctl status nfs-server

If it is not running, restart it:

sudo systemctl restart nfs-server

Step 2: Configure the NFS Server

Once NFS is installed, follow these steps to configure the shared directory for SL1 backups.

1. Create a Backup Directory
sudo mkdir -p /backups 
sudo chmod 777 /backups
2. Set a Fixed Port for mountd

On Ubuntu/Debian:
Edit /etc/default/nfs-kernel-server and add:

RPCMOUNTDOPTS="--port 20048"

On RHEL/CentOS/Rocky/Oracle:
Edit /etc/sysconfig/nfs and add:

MOUNTD_PORT=20048

This ensures the mountd service always uses port 20048, making firewall configuration simpler and more secure.

3. Define NFS Exports

Edit the /etc/exports file to specify which clients can access the NFS share:

sudo vi /etc/exports

Add the following line, replacing with the IP address of your SL1 database server:

/backups (rw,sync,no_root_squash,no_all_squash)

This configuration allows the SL1 server to read and write (rw) to /backups, ensures data consistency (sync), and prevents permission issues.

3. Apply the NFS Configuration

Run the following command to apply the changes:

sudo exportfs -a

Restart the NFS service to ensure the changes take effect:

sudo systemctl restart nfs-server

Step 3: Configure Firewall Rules for NFS

If a firewall is enabled on your NFS server, you must allow NFS-related services. Run the following commands to open the necessary ports:

sudo firewall-cmd --permanent --add-service=mountd
sudo firewall-cmd --permanent --add-service=rpc-bind
sudo firewall-cmd --permanent --add-service=nfs
sudo firewall-cmd --reload

If Command 'firewall-cmd' not found on your device:

1. Using iptables (For RHEL, CentOS, Debian, or older distributions)

If your system uses iptables, you can manually allow NFS traffic with the following commands:

sudo iptables -A INPUT -p tcp --dport 2049 -j ACCEPT   # NFS
sudo iptables -A INPUT -p tcp --dport 111 -j ACCEPT    # Portmapper
sudo iptables -A INPUT -p tcp --dport 20048 -j ACCEPT  # Fixed mountd port
sudo iptables -A INPUT -p udp --dport 2049 -j ACCEPT
sudo iptables -A INPUT -p udp --dport 111 -j ACCEPT
sudo iptables -A INPUT -p udp --dport 20048 -j ACCEPT
# Save the rules
sudo iptables-save | sudo tee /etc/sysconfig/iptables

To restart iptables and apply the rules:

sudo systemctl restart iptables
2. Using UFW (For Ubuntu and Debian)

If your system uses ufw (Uncomplicated Firewall), enable NFS traffic with:

Enable UFW (if it is inactive)

sudo ufw enable

Allow NFS, RPC, and Mountd Ports

sudo ufw allow 2049/tcp      # NFS
sudo ufw allow 111/tcp       # rpcbind
sudo ufw allow 111/udp
sudo ufw allow 20048/tcp     # mountd (fixed)
sudo ufw allow 20048/udp

To apply the changes:

sudo ufw reload

To check if the rules are added:

sudo ufw status

Step 4: Verify the NFS Server

To confirm that the NFS share is accessible, use the following command:

showmount -e <NFS server IP>

If the setup is correct, you should see the following listed as an exported directory.

Export list for <NFS server IP>:
/backups <NFS client IP>

Next Steps: Mount the NFS Share on SL1 Database Server

Now that the NFS server is set up, you need to mount the share on your SL1 database server to store backups.

For step-by-step instructions on mounting an NFS share in SL1, refer to the official ScienceLogic documentation Backup Management.

Updated 5 days ago
Version 1.0
No CommentsBe the first to comment