How to install Samba on CentOS 7/RHEL 7

Installation requirements:

Samba installation on CentOS 7/RHEL 7

Samba has become one of the most used (DC) for the administration of domain controllers in both Linux and Windows, this is because in addition to being open source software it offers features and compatibility in the integration of (DC). on Windows and Linux with acceptable stability and security.

Next, we will see the installation of Samba in CentOS 7/RHEL 7 step by step taking into account that the installation is performed on a system with minimal installation.

1. We are going to access our system with the permissions of the root user and update our system with the following commands:

# yum update

2. Once the update of our system is finished, we will install the necessary repositories for the Samba installation.

Red Hat Enterprise Linux 8/CentOS 8

We install the following packages for Samba installation as an Active Directory (AD) domain controller (DC) on a minimal installation of Red Hat Enterprise Linux (RHEL) 8 or CentOS 8:

# yum install docbook-style-xsl gcc gdb gnutls-devel gpgme-devel jansson-devel \
keyutils-libs-devel krb5-workstation libacl-devel libaio-devel \
ibarchive-devel libattr-devel libblkid-devel libtasn1 libtasn1-tools \
libxml2-devel libxslt lmdb-devel openldap-devel pam-devel perl \
perl-ExtUtils-MakeMaker perl-Parse-Yapp popt-devel python3-cryptography \
python3-dns python3-gpg python36-devel readline-devel rpcgen systemd-devel \
tar zlib-devel

System Security Services Daemon (SSSD) is software originally developed for the Linux operating system that manages access to domain services, remote directory and authentication mechanisms. The beginnings of SSSD are found in the FreeIPA (Identity, Policy and Audit) open source software project. We install the SSSD packages with the following code:

# yum install sssd realmd oddjob oddjob-mkhomedir adcli krb5-workstation openldap-clients policycoreutils-python samba samba-client samba-common samba-common-tools ntpdate ntp

Red Hat Enterprise Linux 7/CentOS 7/Scientific Linux 7

We install the following packages for Samba installation as an Active Directory (AD) domain controller (DC) on a minimal installation of Red Hat Enterprise Linux 7, CentOS 7 or Scientific Linux 7:

# yum install attr bind-utils docbook-style-xsl gcc gdb krb5-workstation \
libsemanage-python libxslt perl perl-ExtUtils-MakeMaker \
perl-Parse-Yapp perl-Test-Base pkgconfig policycoreutils-python \
python2-crypto gnutls-devel libattr-devel keyutils-libs-devel \
libacl-devel libaio-devel libblkid-devel libxml2-devel openldap-devel \
pam-devel popt-devel python-devel readline-devel zlib-devel systemd-devel \
lmdb-devel jansson-devel gpgme-devel pygpgme libarchive-devel

3. edit the configuration of our host so that it responds appropriately to the assigned IPv4 address, we will add a new line with the IPv4 address and the name of our server (FQDN).

# nano /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
1                localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.65 serv01.midominio.com serv01

We check the configuration of our (hostname).

# nano /etc/hostname
Serv01.midominio.com

We check the configuration of our (resolv.conf)

# nano /etc/resolv.conf
search midominio.com             //Nuestro dominio
nameserver 192.168.1.254      // dirección IPv4 de nuestro Reuter
nameserver 8.8.8.8                   //DNS de Google Optional

We edit our network settings in my case (eth0).

# cd /etc/sysconfig/network-scripts/

# nano ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.1.65
NETMASK=255.255.255.0
GATEWAY=192.168.1.254

We reboot our system for the changes to take effect.

# reboot

Firewall configuration:

Ports required in Samba (DC)

Service Puert protocol
DNS 53 tcp/udp
Kerberos 88 tcp/udp
End Point Mapper (DCE/RPC Locator Service) 135 tcp
NetBIOS Name Service 137 udp
NetBIOS Datagram 138 udp
NetBIOS Session 139 tcp
LDAP 389 tcp/udp
SMB over TCP 445 tcp
Kerberos kpasswd 464 tcp/udp
LDAPS (only if “tls enabled = yes”) 636 tcp
Dynamic RPC Ports* 1024-5000 tcp
Global Cataloge 3268 tcp
Global Cataloge SSL (only if “tls enabled = yes”) 3269 tcp
Multicast DNS 5353 tcp/udp

We add the required ports for Samba in the configuration of our firewall.

firewall-cmd --permanent --add-port=53/tcp
firewall-cmd --permanent --add-port=53/udp
firewall-cmd --permanent --add-port=88/tcp
firewall-cmd --permanent --add-port=88/udp
firewall-cmd --permanent --add-port=135/tcp
firewall-cmd --permanent --add-port=137/tcp
firewall-cmd --permanent --add-port=137/udp
firewall-cmd --permanent --add-port=138/udp
firewall-cmd --permanent --add-port=139/tcp
firewall-cmd --permanent --add-port=389/tcp
firewall-cmd --permanent --add-port=389/udp
firewall-cmd --permanent --add-port=445/tcp
firewall-cmd --permanent --add-port=464/tcp
firewall-cmd --permanent --add-port=464/udp
firewall-cmd --permanent --add-port=636/tcp
firewall-cmd --permanent --add-port=1024-5000/tcp
firewall-cmd --permanent --add-port=1024-5000/udp
firewall-cmd --permanent --add-port=3268/tcp
firewall-cmd --permanent --add-port=3269/tcp
firewall-cmd --permanent --add-port=5353/tcp
firewall-cmd --permanent --add-port=5353/udp

We restart our firewall settings for the changes to take effect.

# systemctl restart firewalld

Finally we can perform the Samba installation with the following command:

# yum install samba* -y
Dependency Installed:
avahi-libs.x86_64 0:0.6.31-20.el7
cups-libs.x86_64 1:1.6.3-43.el7
glusterfs.x86_64 0:6.0-29.el7
glusterfs-api.x86_64 0:6.0-29.el7
glusterfs-client-xlators.x86_64 0:6.0-29.el7
glusterfs-libs.x86_64 0:6.0-29.el7
libldb.x86_64 0:1.5.4-1.el7
libsmbclient.x86_64 0:4.10.4-11.el7_8
libtalloc.x86_64 0:2.1.16-1.el7
libtalloc-devel.x86_64 0:2.1.16-1.el7
libtdb.x86_64 0:1.3.18-1.el7
libtevent.x86_64 0:0.9.39-1.el7
libtevent-devel.x86_64 0:0.9.39-1.el7
libwbclient.x86_64 0:4.10.4-11.el7_8
pyldb.x86_64 0:1.5.4-1.el7
pytalloc.x86_64 0:2.1.16-1.el7
python-tdb.x86_64 0:1.3.18-1.el7
python-tevent.x86_64 0:0.9.39-1.el7
Complete!

We can check the version of Samba installed with the following command:

# smbd -V
version 4.10.4

If you have any questions, please feel free to contact Picaraza Domains Ltd support team 24/7/365.
  • 3 Users Found This Useful
Was this answer helpful?

Related Articles

 CentOS & RHEL Repositories

The Linux repositories are a fundamental part in the stability and smooth operation of systems...

 Remove packages in Linux

To eliminate packages in Linux we could do them in several ways: through the YUM or RPM command,...

 Minimal installation of CentOS 7

CentOS 7, minimal installation To start with the installation of CentOS 7.3, we will need the...

 How to create a network (Bridge) in CentOS 7/RHEL 7

Network (Bridge) on CentOS 7 / RHEL 7 The creation or configuration of a network bridge or...

 GUI Gnome on CentOS 7/RHEL 7

Installing GUI Gnome on CentOS 7/RHEL 7 By default, the Linux installation is done with a...