CentOS 7
Sponsored Link

Samba AD DC : Configure Server2018/06/27

 
Configure Samba Active Directory Domain Controller.
The Samba package provided from CentOS official repository does not provide the DC function yet, so Download and Install Samba from Source Code.
[1] Install required packages for compile and Install Samba.
[root@smb ~]#
yum groups -y install "Development Tools"

[root@smb ~]#
yum -y install iniparser libldb libtalloc libtdb libtevent python-devel gnutls-devel libacl-devel openldap-devel pam-devel readline-devel krb5-devel cups-devel
[root@smb ~]#
curl -O https://download.samba.org/pub/samba/stable/samba-4.8.3.tar.gz

[root@smb ~]#
tar zxvf samba-4.8.3.tar.gz

[root@smb ~]#
cd samba-4.8.3

[root@smb samba-4.8.3]#
./configure \
--prefix=/usr \
--localstatedir=/var \
--with-configdir=/etc/samba \
--libdir=/usr/lib64 \
--with-modulesdir=/usr/lib64/samba \
--with-pammodulesdir=/lib64/security \
--with-lockdir=/var/lib/samba \
--with-logfilebase=/var/log/samba \
--with-piddir=/run/samba \
--with-privatedir=/etc/samba \
--enable-cups \
--with-acl-support \
--with-ads \
--with-automount \
--enable-fhs \
--with-pam \
--with-quotas \
--with-shared-modules=idmap_rid,idmap_ad,idmap_hash,idmap_adex \
--with-syslog \
--with-utmp \
--with-dnsupdate

[root@smb samba-4.8.3]#
make

[root@smb samba-4.8.3]#
make install
# create Systemd file

[root@smb samba-4.8.3]#
vi /usr/lib/systemd/system/samba.service
# create new

[Unit]
Description=Samba AD Daemon
Wants=network-online.target
After=network.target network-online.target rsyslog.service

[Service]
Type=forking
PIDFile=/run/samba/samba.pid
LimitNOFILE=16384
ExecStart=/usr/sbin/samba --daemon
ExecReload=/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target

[root@smb samba-4.8.3]#
vi /etc/tmpfiles.d/samba.conf
# create new

d /var/run/samba 0755 root root -
[2] Configure Samba AD DC.
# rename or remove default krb5.conf

[root@smb ~]#
mv /etc/krb5.conf /etc/krb5.conf.org

[root@smb ~]#
samba-tool domain provision

# specify Realm
Realm [SRV.WORLD]: 
# specify Domain name
 Domain [SRV]: SMB01 
# Enter with default because it sets DC
 Server Role (dc, member, standalone) [dc]:
# Enter with default because it uses Built-in DNS
 DNS backend (SAMBA_INTERNAL, BIND9_FLATFILE, BIND9_DLZ, NONE) [SAMBA_INTERNAL]:
# if you set DNS forwarder, specify it, if not specify [none]
 DNS forwarder IP address (write 'none' to disable forwarding) [10.0.0.10]: 
# set admin password
# Do not set trivial password, if you input it, configuration wizard shows error and stops
Administrator password:
Retype password:
Looking up IPv4 addresses
Looking up IPv6 addresses
No IPv6 address will be assigned
Setting up share.ldb
Setting up secrets.ldb
Setting up the registry
Setting up the privileges database
Setting up idmap db
Setting up SAM db
Setting up sam.ldb partitions and settings
Setting up sam.ldb rootDSE
Pre-loading the Samba 4 and AD schema
Adding DomainDN: DC=srv,DC=world
Adding configuration container
Setting up sam.ldb schema
Setting up sam.ldb configuration data
Setting up display specifiers
Modifying display specifiers
Adding users container
Modifying users container
Adding computers container
Modifying computers container
Setting up sam.ldb data
Setting up well known security principals
Setting up sam.ldb users and groups
Setting up self join
Adding DNS accounts
Creating CN=MicrosoftDNS,CN=System,DC=srv,DC=world
Creating DomainDnsZones and ForestDnsZones partitions
Populating DomainDnsZones and ForestDnsZones partitions
Setting up sam.ldb rootDSE marking as synchronized
Fixing provision GUIDs
A Kerberos configuration suitable for Samba AD has been generated at /etc/samba/krb5.conf
Merge the contents of this file with your system krb5.conf or replace it with this one. Do not create a symlink!
Once the above files are installed, your Samba AD server will be ready to use
Server Role:           active directory domain controller
Hostname:              smb
NetBIOS Domain:        SMB01
DNS Domain:            srv.world
DOMAIN SID:            S-1-5-21-343028061-3500809607-2232077892

# change DNS setting to refer to localhost

[root@smb ~]#
nmcli connection modify eth0 ipv4.dns 127.0.0.1

[root@smb ~]#
nmcli connection down eth0; nmcli connection up eth0
[root@smb ~]#
cp /etc/samba/krb5.conf /etc/

[root@smb ~]#
systemctl start samba

[root@smb ~]#
systemctl enable samba

# show domain level

[root@smb ~]#
samba-tool domain level show

Domain and forest function level for domain 'DC=srv,DC=world'

Forest function level: (Windows) 2008 R2
Domain function level: (Windows) 2008 R2
Lowest function level of a DC: (Windows) 2008 R2

# add a domain user

[root@smb ~]#
samba-tool user create cent

New Password:  
# set password

Retype Password:
User 'cent' created successfully
[3] If Firewalld is running, allow related ports.
[root@smb ~]#
firewall-cmd --add-service={dns,kerberos,kpasswd,ldap,ldaps,samba} --permanent

success
[root@smb ~]#
firewall-cmd --add-port={135/tcp,137-138/udp,139/tcp,3268-3269/tcp,49152-65535/tcp} --permanent

success
[root@smb ~]#
firewall-cmd --reload

success
Matched Content