Samba AD
As is Build for Domain Controller installation
Date : 08.08.2016
Document Version : 1.0
Table of Contents1.Setup a Samba Active Directory Domain Controller4
- 1.1.Configure yum repository for Packages installation.4
- 1.2.Assign the Ipv4 address and restart the network services.5
- 1.3.Assign the Ipv6 address and restart the network services. And set hostname.6
- 1.4.Edit /etc/hosts file and make below entries.7
- 1.5.Restart network service.8
- 1.6.Reboot server.9
- 1.7.Install Dependencies for samba installation.9
- 1.8.Dependencies Installation is completed.10
2.Samba Installation11
- 2.1.Download samba file from https://www.samba.org/ and extract it.11
- 2.2.Enter in samba-4.4.4 directory and run configure command.11
- 2.3.Run make command.13
- 2.4.Run make install command.14
- 2.5.Provision a new domain:14
- 2.6.Provisioning completed successfully.15
3.Initialisation16
- 3.1.Samba doesn't yet have init scripts included16
- 3.2.Set the permissions on samba4 file.19
- 3.3.Restart samba19
- 3.4.Run "smbclient"20
- 3.5.Open /etc/named.conf file.21
- 3.6.DNS keytab22
- 3.7.Also make below entry in named.conf22
- 3.8.Change the owner ship as below and restart named services.23
- 3.9.Copy Kerberos23
Template:Anchor Setup a Samba Active Directory Domain Controller
Template:Anchor Configure yum repository for Packages installation.
Edit /etc/yum.repos.d/local.repo
# vi /etc/yum.repos.d/local.repo
File:GSTNSAMBAPDC1
Make below entries. Save file and exit.
[local]
name=local
baseurl=file:///mnt
gpgcheck=0
enabled=1
File:GSTNSAMBAPDC2
Template:Anchor Assign the Ipv4 address and restart the network services.
# nmcli connection modify eth0 ipv4.addresses 172.18.101.14/24 ipv4.method manual ipv4.gateway 172.18.101.1 connection.autoconnect yes ipv4.dns 172.18.101.14
# systemctl restart network.service
File:GSTNSAMBAPDC3
Template:Anchor Assign the Ipv6 address and restart the network services. And set hostname.
# nmcli connection modify eth0 ipv6.addresses 2404:a800:1000:d:7800::e/69 ipv6.method manual ipv6.gateway 2404:a800:1000:d:7800::1 connection.autoconnect yes ipv6.dns 2404:a800:1000:d:7800::e
# hostnamectl set-hostname gd9103.gstn.local
File:GSTNSAMBAPDC4== Template:Anchor Edit /etc/hosts file and make below entries. ==
# vi /etc/hosts
172.18.101.14gd9103.gstn.localgd9103
2404:a800:1000:d:7800::egd9103.gstn.localgd9103
File:GSTNSAMBAPDC5
# systemctl restart network.service
File:GSTNSAMBAPDC6
# init 6
File:GSTNSAMBAPDC7== Template:Anchor Install Dependencies for samba installation. ==
# yum install perl gcc attr libacl-devel libblkid-devel gnutls-devel readline-devel python-devel gdb pkgconfig krb5-workstation zlib-devel setroubleshoot-server libaio-devel setroubleshoot-plugins policycoreutils-python libsemanage-python perl-ExtUtils-MakeMaker perl-Parse-Yapp perl-Test-Base popt-devel libxml2-devel libattr-devel keyutils-libs-devel cups-devel bind-utils libxslt docbook-style-xsl openldap-devel autoconf python-crypto pam-devel
File:GSTNSAMBAPDC8== Template:Anchor Dependencies Installation is completed. ==
File:GSTNSAMBAPDC9
= Template:Anchor Samba Installation =
# tar xvzf samba-4.4.4.tar.gz
File:GSTNSAMBAPDC10== Template:Anchor Enter in samba-4.4.4 directory and run configure command. ==
# cd samba-4.4.4/
# ./configure
File:GSTNSAMBAPDC11
Now configure done successfully.
File:GSTNSAMBAPDC12
# make
File:GSTNSAMBAPDC13
Make command finished successfully.
File:GSTNSAMBAPDC14== Template:Anchor Run make install command. ==
# make install
File:GSTNSAMBAPDC15== Template:Anchor Provision a new domain: ==
# /usr/local/samba/bin/samba-tool domain provision --use-rfc2307 --interactive
File:GSTNSAMBAPDC16== Template:Anchor Provisioning completed successfully. ==
File:GSTNSAMBAPDC17
Template:Anchor Samba doesn't yet have init scripts included
- we can copy script from below link. https://wiki.samba.org/index.php/Samba4/InitScript
- create a file /etc/rc.d/init.d/samba4
# vi /etc/rc.d/init.d/samba4
and paste the below content in this file.
________________________________
#! /bin/bash
#
# samba4 Bring up/down samba4 service
#
# chkconfig: - 90 10
# description: Activates/Deactivates all samba4 interfaces configured to \
# start at boot time.
#
### BEGIN INIT INFO
# Provides:
# Should-Start:
# Short-Description: Bring up/down samba4
# Description: Bring up/down samba4
### END INIT INFO
# Source function library.
. /etc/init.d/functions
if [ -f /etc/sysconfig/samba4 ]; then
. /etc/sysconfig/samba4
fi
CWD=$(pwd)
prog="samba4"
start() {
# Attach irda device
echo -n $"Starting $prog: "
/usr/local/samba/sbin/samba
sleep 2
if ps ax | grep -v "grep" | grep -q /samba/sbin/samba ; then success $"samba4 startup"; else failure $"samba4 startup"; fi
echo
}
stop() {
# Stop service.
echo -n $"Shutting down $prog: "
killall samba
sleep 2
if ps ax | grep -v "grep" | grep -q /samba/sbin/samba ; then failure $"samba4 shutdown"; else success $"samba4 shutdown"; fi
echo
}
status() {
/usr/local/samba/sbin/samba --show-build
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status irattach
;;
restart|reload)
stop
start
;;
*)
echo $"Usage: $0 {start|stop|restart|status}"
exit 1
esac
exit 0
______________________________________________________________________________
File:GSTNSAMBAPDC18
Template:Anchor Set the permissions on samba4 file.
# chmod 755 /etc/rc.d/init.d/samba4
# chmod +x /etc/rc.d/init.d/samba4
# ln -s /etc/rc.d/init.d/samba4 /etc/rc3.d/S80samba4
# chkconfig --add samba4
# chkconfig samba4 on
File:GSTNSAMBAPDC19== Template:Anchor Restart samba ==
# service samba4 restart
or systemctl start samba4.service
File:GSTNSAMBAPDC20
This is done to check if Samba provides the AD DC default shares "netlogon" and "sysvol", that were created in "smb.conf" during provisioning.
# /usr/local/samba/bin/smbclient -L localhost -U%
File:GSTNSAMBAPDC21== Template:Anchor Open /etc/named.conf file. ==
# vi /etc/named.conf
File:GSTNSAMBAPDC22== Template:Anchor DNS keytab ==
This file was automatically created during provisioning/updating. Add the following' tkey-gssapi-keytab' option to the 'options' section of your named.conf, and set other values as shown in screen shot.
tkey-gssapi-keytab "/usr/local/samba/private/dns.keytab";
File:GSTNSAMBAPDC23== Template:Anchor Also make below entry in named.conf ==
include "/usr/local/samba/private/named.conf";
File:GSTNSAMBAPDC24== Template:Anchor Change the owner ship as below and restart named services. ==
# chown named.named /var/named/
# chgrp named /usr/local/samba/private/dns.keytab
# chmod g+r /usr/local/samba/private/dns.keytab
# systemctl enable named.service
# systemctl restart named.service
== Template:Anchor Copy Kerberos ==
file /usr/local/samba/private/krb5.conf to /etc/krb5.conf
# cp /etc/krb5.conf /etc/krb5.conf.ori
# cp /usr/local/samba/private/krb5.conf /etc/krb5.conf
File:GSTNSAMBAPDC25