Prerequisite
To login the system by root account and update the yum repositories and packages by using the yum update command.
To disable SELinux for reducing complications issue
yum -y install gcc make wget python-devel gnutls-devel openssl-devel libacl-devel krb5-server krb5-libs krb5-workstation bind bind-libs bind-utils command (# 2)
To query the rpm database to find any older samba package by using the rpm –qa | grep samba or yum list installed | grep samba commandDownload, compile & install Samba 4
Option (1):To download manually the latest Samba tarball from the Samba Website
After finish any option, we have to switch to the extracted directory next to configure it by executing the command ./configure - -enable-selftest
Provision Samba 4.0.x
To provision a new domain by executing the command /usr/local/samba/bin/samba-tool domain provision and change the default setting if necessary (# 6)
Configure Samba 4 with Bind as DNS backend
To setup Bind 9 folder permission as follows:
To append
include "/usr/local/samba/private/named.conf"; at the end of the file and add tkey-gssapi-keytab "/usr/local/samba/private/dns.keytab";
to the options by editing /etc/named.confTo generate rndc.key in the /etc directory by executing the rndc-confgen –a –r /dev/urandom command it this key never appear.
To generate rndc.conf in the /etc directory by running the rndc-confgen > /etc/rndc.conf command
Add Reverse Zone Record
Due to this is the fist DNS Server that is built with Samba Server, we have to add some record as Reverse Zone for configuring Primary(Master) Name Server by editing /etc/named.conf file
Based on our mention in the additional record of the /etc/named.conf file, we will create rev.dwlab.mooo.com file in the /var/named directory and add the entries for reverse zone.
Start Bind Service
To start named service by executing the service named start or /etc/init.d/named start command manually
Verify DNS function
To set the samba will use the own internal DNS firstly by editing the /etc/sysconfig/network-script/ifcfg-eth0 file
Install and Configure NTP
Due to the time synchronization between DC and Client is very important, we need to enable NTP daemon in each Samba 4 as AD role.
How to do it? please refer to this article NTP --- Install & Configure NTP daemon on Minimal CentOS 6.x to realize it in detail
Configure Kerberos
Due to the kerberos in CentOS 6.3 or later is handled by the /etc/krb5.conf file,we will backup this original file and replace it with the /usr/local/samba/setup/krb5.conf file
Configure & Start Samba 4
Start Samba 4 manually
To start manually the samba daemon by using the /usr/local/samba/sbin/samba command
Start Samba 4 automatically
To start it at boot by appending the /usr/local/samba/sbin/samba command to the /etc/rc.d/rc.local file
To initialize samba daemon start at boot by using the chkconfig - - levels 235 samba4 on command if we ever create a samba init script.
Configure iptables rule
To realize which listening port require for AD/Samba4 by using the netstat –lntup | grep –e samba –e smbd command
53, TCP & UDP (DNS)
88, TCP & UDP (Kerberos authentication)
123, TCP & UDP (NTP)
135, TCP (MS RPC)
137, UDP (NetBIOS name service)
138, UDP (NetBIOS datagram service)
139, TCP (NetBIOS session service)
389, TCP & UDP (LDAP)
445, TCP (MS-DS AD/SMB CIFS)
464, TCP & UDP (Kerberos change/set password)
636, TCP (LDAP SSL)
3268, TCP (LDAP Global Catalog)
3269, TCP (LDAP Global Catalog SSL)
To add the above port number to the iptables rule by executing the following command
Don’t forget to execute the service iptables save and service iptables restart command for applying the new rule right now. (# 8)
Verify Samba 4 AD DC
Test Samba
To confirm the samba version by using the /usr/local/samba/sbin/samba –V command
Test DNS
To confirm the DNS record for ldap, kerberos and samba by using the following command.
Test Kerberos
To confirm whether kerberos authentication is working by using the kinit administrator@DWLAB.MOOO.COM command (# 9)
Until now, we have already finished building the Samba 4 AD DC!
Reference :
(# 1) If we has interesting to realize what the new changes in Samba 4, please refer to this Samba WiKi
(# 2) Which the development library and program need to be installed? Maybe we can refer to this web site Samba 4/OS Requirements to find the solution.
(# 3) If the samba ever is installed by yum, we will see what packages have already been existed now by using the rpm –qa | grep samba or yum list installed | grep samba command
(# 5) When we need to install the necessary missing packages for fix error that run configure, make, make install command,please remember to do make clean command before running make again
(# 6) If we need to re-run the provision command, we have to remove the /usr/local/samba/etc/smb.conf file ,and Samba database by using the command rm –rf /usr/local/samba/private/*
(# 7) If no add these values, maybe we will get the error message as follows when run the service named status command
AS-IS