How to Install Samba 4.3.4 on CentOS/RHEL 7

Samba is a free Open Source software which provides a standard interoperability between Windows OS and Linux/Unix Operating Systems.

Samba 4.3.4

Major features for Samba4:
1) Support for the ‘Active Directory’ logon and administration protocols that support Windows XP, Windows7, and Mac OS X clients
2) Support for Group Policy definitions
3) Full NTFS semantics for sharing backends
4) An internal LDAP server, with AD semantics
5) An internal Kerberos server, including PAC support
6) Bind9 integration for AD DNS support
7) Fully asynchronous internals
8) Better scalability from micro to very large installations
9) A flexible database architecture (LDB)

Install Required Packages:

First, install packages required by Samba4 before compiling samba4. Run below command to install it.

# yum install libacl-devel e2fsprogs-devel gnutls-devel readline-devel python-devel gdb pkgconfig gcc libblkid-devel zlib-devel setroubleshoot-server setroubleshoot-plugins policycoreutils-python libsemanage-python setools-libs-python setools-libs popt-devel libpcap-devel sqlite-devel libidn-devel libxml2-devel libacl-devel libsepol-devel libattr-devel keyutils-libs-devel cyrus-sasl-devel krb5-workstation perl openldap-devel bind bind-sdb

Download & Extract Samba 4.3.4:

Run below command to download Samba 4.3.4 binary files.

 
#cd /root
# wget http://download.techoism.com/samba-4.3.4.tar.gz
# tar -xvf samba-4.3.4.tar.gz

Compile & Install Samba 4.3.4:

After extracting the file install it using following command.

# ./configure --enable-selftest --enable-debug --prefix=/opt/samba/ --sysconfdir=/etc/samba/ --includedir=/usr/include/samba4/ --bindir=/bin/ --sbindir=/sbin/ --mandir=/usr/share/man/
# make
# make install

–prefix: Installation Directory
–sysconfdir: smb.conf should be places
–includedir: Includes the header files for C compilers
–bindir: user executables
–sbindir: system admin executables
–mandir: man pages to be placed

Build Samba4 with Active Directory:

After samba4 has been success compile and install, you can provisioning samba4 and make it as Active Directory.

# samba-tool domain provision --use-rfc2307 --interactive
Realm [LINUXROOT.INFO]: TECHOSIM.COM
 Domain [LINUXROOT]: TECHOISM
 Server Role (dc, member, standalone) [dc]: dc 
 DNS backend (SAMBA_INTERNAL, BIND9_FLATFILE, BIND9_DLZ, NONE) [SAMBA_INTERNAL]: BIND9_DLZ
 DNS forwarder IP address (write 'none' to disable forwarding) [192.168.0.162]: 8.8.8.8
Administrator password: redhat
Retype password: redhat
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=techoism,DC=com
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=LinuxDNS,CN=System,DC=techoism,DC=com
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 4 has been generated at /opt/samba/private/krb5.conf
Once the above files are installed, your Samba4 server will be ready to use
Server Role:           active directory domain controller
Hostname:              server
NetBIOS Domain:        TECHOISM
DNS Domain:            techoism.com
DOMAIN SID:            S-1-5-21-1623651871-590293421-3205222097

Copy New Kerberos File:

Rename main configuration file of Kerberos and copy new kerbose file or make a symlink of new file using below command:

# cp -p /etc/krb5.conf /etc/krb5.conf.new
# ln -s /opt/samba/private/krb5.conf /etc/

Starting Samba4:

For start samba while booting, you can make init script for easy starting or stopping samba.

# vim  /etc/rc.d/init.d/samba4
#!/bin/bash
#
# samba4        This shell script takes care of starting and stopping
#               samba4 daemons.
#
# chkconfig: - 58 74
# description: Samba 4.0 will be the next version of the Samba suite
# and incorporates all the technology found in both the Samba4 alpha
# series and the stable 3.x series. The primary additional features
# over Samba 3.6 are support for the Active Directory logon protocols
# used by Windows 2000 and above.

### BEGIN INIT INFO
# Provides: samba4

# Required-Start: $network $local_fs $remote_fs
# Required-Stop: $network $local_fs $remote_fs
# Should-Start: $syslog $named
# Should-Stop: $syslog $named
# Short-Description: start and stop samba4
# Description: Samba 4.0 will be the next version of the Samba suite
# and incorporates all the technology found in both the Samba4 alpha
# series and the stable 3.x series. The primary additional features
# over Samba 3.6 are support for the Active Directory logon protocols
# used by Windows 2000 and above.
### END INIT INFO

# Source function library.
. /etc/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

prog=samba
prog_dir=/sbin/
lockfile=/var/lock/subsys/$prog

start() {
        [ "$NETWORKING" = "no" ] && exit 1
#       [ -x /usr/sbin/ntpd ] || exit 5
                # Start daemons.
                echo -n $"Starting samba4: "
                daemon $prog_dir/$prog -D
        RETVAL=$?
                echo
        [ $RETVAL -eq 0 ] && touch $lockfile
        return $RETVAL
}

stop() {
        [ "$EUID" != "0" ] && exit 4
                echo -n $"Shutting down samba4: "
        killproc $prog_dir/$prog
        RETVAL=$?
                echo
        [ $RETVAL -eq 0 ] && rm -f $lockfile
        return $RETVAL
}

# See how we were called.
case "$1" in
start)
        start
        ;;
stop)
        stop
        ;;
status)
        status $prog
        ;;
restart)
        stop
        start
        ;;
reload)
        echo "Not implemented yet."
        exit 3
        ;;
*)
        echo $"Usage: $0 {start|stop|status|restart|reload}"
        exit 2
esac

Make file executable and add the file to execute at boot time.

# chmod +x /etc/rc.d/init.d/samba4
# chkconfig --add /etc/rc.d/init.d/samba4
# chkconfig samba4 on
# service samba4 start

Enjoy it!

No Responses

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.