• WordPress
  • cPanel
  • Softaculous
  • KVM Virtualization
  • Vmware Virtualization
  • Proxmox
Monday, May 12, 2025
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux
No Result
View All Result
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux

How to set up a file server on CentOS 7 using Samba or NFS

in CentOS, Linux OS
How to set up a file server on CentOS 7 using Samba or NFS

A file server is an essential part of any organization or enterprise, allowing users to share files and resources. In this blog, we will guide you through the process of setting up a file server on CentOS 7 using either Samba or NFS.

Option 1: Setting up a file server using Samba

Samba is a popular file server software that is used to share files and printers between Windows, Linux, and Mac OS X computers. Here is how you can set up a file server using Samba on CentOS 7.

Step 1: Install Samba

The first step is to install Samba on your CentOS 7 server. You can do this by running the following command:

sudo yum install samba samba-client samba-common

Step 2: Create a directory to share

Next, create a directory that you want to share with other computers on the network. You can do this by running the following command:

sudo mkdir /samba/share

Step 3: Configure Samba

Now, you need to configure Samba to share the directory you just created. Open the Samba configuration file by running the following command:

sudo nano /etc/samba/smb.conf

Add the following lines at the end of the file:

[share]
comment = Shared directory
path = /samba/share
browseable = yes
writable = yes
guest ok = yes

Save and close the file.

Step 4: Restart Samba

After making changes to the Samba configuration file, you need to restart the Samba service for the changes to take effect. You can do this by running the following command:

sudo systemctl restart smb.service

Step 5: Allow Samba through the firewall

By default, CentOS 7 comes with a firewall that blocks incoming connections. You need to allow Samba through the firewall by running the following commands:

sudo firewall-cmd --permanent --zone=public --add-service=samba
sudo firewall-cmd --reload

That’s it! You have successfully set up a file server using Samba on CentOS 7.

Option 2: Setting up a file server using NFS

NFS (Network File System) is another popular file server software that is used to share files between Linux and UNIX computers. Here is how you can set up a file server using NFS on CentOS 7.

Step 1: Install NFS

The first step is to install NFS on your CentOS 7 server. You can do this by running the following command:

sudo yum install nfs-utils

Step 2: Create a directory to share

Next, create a directory that you want to share with other computers on the network. You can do this by running the following command:

sudo mkdir /nfs/share

Step 3: Configure NFS

Now, you need to configure NFS to share the directory you just created. Open the exports file by running the following command:

sudo nano /etc/exports

Add the following line at the end of the file:

/nfs/share *(rw,sync,no_root_squash)

Save and close the file.

Step 4: Restart NFS

After making changes to the exports file, you need to restart the NFS service for the changes to take effect. You can do this by running the following command:

sudo systemctl restart nfs-server.service

Step 5: Allow NFS through the firewall

By default, CentOS 7 comes with a firewall that blocks incoming connections. You need to allow NFS through the firewall by running the following commands:

sudo firewall-cmd --permanent --zone=public

In conclusion, setting up a file server using either Samba or NFS on CentOS 7 is a straightforward process. Samba is a great option if you need to share files between Windows, Linux, and Mac OS X computers, while NFS is a better choice if you are sharing files between Linux and UNIX computers. Both options provide secure and reliable ways to share files and resources over a network. By following the steps outlined in this blog, you should be able to set up a file server on CentOS 7 using either Samba or NFS without any issues.

ShareTweet
Previous Post

How to configure and manage system services in CentOS 7 with systemd

Next Post

How to configure and use SSH for secure remote access to CentOS 7

Related Posts

How to Install Tomcat on Rocky Linux

How to Install Apache Tomcat on Rocky Linux

How to Set up NTP Server on Rocky Linux

How to Set up NTP Server on Rocky Linux

How to Install Bacula Backup Server on Rocky Linux

How to Install Bacula Backup Server on Rocky Linux

Leave a Reply Cancel reply

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

Golden Host VPS
  • Privacy Policy
  • Terms and Conditions
  • About Us
  • Contact Us

Copyright © 2023 linuxboost.com All Rights Reserved.

  • Privacy Policy
  • Terms and Conditions
  • About Us
  • Contact Us

Copyright © 2023 linuxboost.com All Rights Reserved.