Friday, 17 April 2015

Install Samba 4 in Centos



Samba 4.
Install Samba 4 in Centos 7
Install Required Software
1.       yum install libacl-devel
2.       yum install e2fsprogs-devel
3.       yum install gnutls-devel
4.       yum install readline-devel
5.       yum install python-devel
6.       yum install gdb
7.       yum install gcc
8.       yum install gcc-c++
9.       yum install cups-devel
10.   yum install pam-devel
11.   yum install ctdb-devel
12.   yum install openldap-devel
13.   yum install libsmbclient
14.   yum install libacl-devel
15.   yum install libblkid-devel
16.   yum install gnutls-devel
17.   yum install readline-devel
18.   yum install python-devel
19.   yum install gdb
20.   yum install pkgconfig
21.   yum install krb5-workstation
22.   yum install zlib-devel
23.   yum install setroubleshoot-server
24.   yum install setroubleshoot-plugins
25.   yum install policycoreutils-python
26.   yum install popt-devel
27.   yum install libpcap-devel
28.   yum install sqlite-devel
29.   yum install libidn-devel
30.   yum install libsemanage-python
31.   yum install setools-libs-python
32.   yum install setools-libs
33.   yum install libxml2-devel
34.   yum install libacl-devel
35.   yum install libsepol-devel
36.   yum install libattr-devel
37.   yum install keyutils-libs-devel
38.   yum install cyrus-sasl-devel



Download and Install Samba

1.       Download Installer




2.       Extract the the compresed installer

    -    tar zxvf samba-4.0.0.tar.gz

3.       Go to the extract directory ant run installer

    -    ./configure  --enable-old-ctdb
4.       Run make
    -    make
5.       Run make install
    -    make install





Create the startup script (Auto start service)

1.       Create the script

     a.       # vi /etc/init.d/samba

    


#! /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

 



1.       Give the ownership
-    # chmod 755 /etc/init.d/samba
-    # chown root:root /etc/init.d/samba

To Provision Domain
-    # /usr/local/samba/bin/samba-tool domain provision



Configure Windows XP/7/8 to join domain
Install RSAT on this PC – You can manage active directory using this pc. The login name must be administtator.
Setup File Share
-    # mkdir /var/share
-    # vi /usr/local/samba/etc/smb.conf
[myshare]
path = /var/share
comment = The Share
read only = no
-