This guide will detail how to build a standalone SAMBA server on CentOS 7. I used a HP MicroServer Gen8 with an Adaptec 6405E RAID card and 4x Western Digital Red 2TB drives in RAID 10. This guide will also work with RHEL 7.
Because I’m becoming lazy in my old age I’ll presume you’ve already installed CentOS 7 (I used the minimal ISO) and have it configured with networking and you’re syncing time with your local NTP server (mine is ‘au.pool.ntp.org‘) and have also run an initial ‘yum update -y‘ to make sure you’ve got all the latest basic system updates.
- Install SAMBA
yum install -y samba
- Disable SELinux (Not recommended in corporate production but I’m keeping things simple)
setenforce 0 sed -i 's/SELINUX=enforcing/SELINUX=permissive/' /etc/sysconfig/selinux
- Rename the default SAMBA config
mv /etc/samba/smb.conf /etc/samba/smb.conf.orig
- Use the following config file. You might need to customise it based on your requirements, which I’ve highlighted in bold, but you can use the defaults for testing.
vi /etc/samba/smb.conf
[global] workgroup = WORKGROUP server string = Samba Server Version %v security = user passdb backend = tdbsam local master = yes preferred master = yes socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=131072 SO_SNDBUF=131072 use sendfile = true log file = /var/log/samba/log.%m #============================ Share Definitions ============================== [samba] comment = SAMBA Data path = /data/samba writeable = yes force user = samba force group = samba force directory mode = 0770 force create mode = 0660 directory mode 0770 create mode 0660
- Add a user to own your data
groupadd samba useradd -g samba samba smbpasswd -a samba # Specify your password when prompted.
- Create the filesystem location where the SAMBA data will be stored
mkdir /data/samba chown samba.samba /data/samba chmod 0770 /data/samba
- Allow the SAMBA services through the firewall
firewall-cmd --permanent --add-service=samba firewall-cmd --reload
- Start the SAMBA services
systemctl enable smb systemctl enable nmb systemctl start smb systemctl start nmb
- You should now be able to connect to your SAMBA server using its IP or hostname.
0 Comments