Installing Samba On Debian
To get started with our Samba environment, we need to install the OS, and for that, the first task must be to choose of the right installation media. To install the Debian 7.0/Wheezy, released in May 04, 2013, we will use the network-installed ISO image. The installation is a very simple and quick process where we will go through using all the default configuration options. You can download the latest ISO (net install) 32-bit image file from the following link (for example, debian-7.0.0-i386-netinst.iso .
Take a look at the proper hardware architecture for the system that you will install, and then choose the right ISO image file accordingly for your system’s hardware. The Debian GNU/Linux distribution is available for many different platforms (amd64, ia64, powerpc, and sparc, just to name a few). We did choose i386, because our hardware is 32-bit.
It’s really important for any environment to have all systems with the time properly synchronized. Because Samba 4 uses Kerberos as the authentication mechanism, it’s even more important to have the system time in sync, so we will configure the ntp services on our server. The dhcp server provides us with a powerful solution to manage the IPs on the network, integrate them with DNS services, and also automatically register their hostnames (another essential feature for AD services).
If you already have a dhcp server on your network, you don’t need to configure this service again on the Samba 4 Server. If you already have an installed OS where you intend to install the Samba 4 Server you can go ahead with below pre-requisites and install steps below.
With our system up, running, and up to date, we can start installing and configuring the Samba 4 Server’s dependencies. Working with all the dependencies provided directly by the GNU/Linux distribution gives us all the support from the Debian community to maintain our system that is patched against security issues.
Run below commands to update the dependency software’s in your OS:
root@debian7:~# apt-get install build-essential python-dev pkg-config libcups2-dev cups krb5-user docbook-xsl libldap2-dev libattr1-dev libacl1-dev libgnutls-dev attr python-dnspython libreadline-dev libbsd-dev libblkid-dev libpopt-dev cups git acl gdb xsltproc libsasl2-dev libaio-dev libpam-dev valgrind resolvconf autoconf ldap utils ntp isc-dhcp-server
It’s recommended and is a best practice to just use the root account as needed, and to use su or sudo to execute the commands that need super user privileges (for example, to install the software). While the installation of these packages is running, we only need to provide some information for the Kerberos configuration. If you have provided your domain information during the installation of the system, the Default Realm will already be filled with the right information. If not, you can do it now and add the information about the Realm and Administrative Server in the dialog box that apt-get install will bring up while installing krb5-user:
Default Realm: EAAL.COM.US Realm: 127.0.0.1 Administrative Server: 127.0.0.1
In a standard Debian installation, we can check the availability of the features of file-systems we need just by issuing the following script on the command-line prompt:
grep CONFIG_EXT4_FS /boot/config-`uname -r`
The Output shall look like below:
CONFIG_EXT4_FS=m CONFIG_EXT4_FS_XATTR=y CONFIG_EXT4_FS_POSIX_ACL=y CONFIG_EXT4_FS_SECURITY=y
What the previous output tells us is that the ext4 filesystem was configured as a dynamically loadable module and the features of xattr (extended file attributes), posix_acl (access control lists), and security have been built on it.
All these extensions are needed by the samba4 debian Server for its proper execution, as it’s needed by the Samba 4 AD/DC functions (for example, ACLs are required to handle Microsoft Windows OS permissions properly). With all these features available, we are in good shape and ready to proceed.
Installing Samba 4 Server:
For the installation of the samba4 debian software, we will use GIT. So, we should start creating a workspace (for example, directory) to download the sources of the Samba 4 Server stable branch into it. In a terminal window, just execute the following command:
$ mkdir ~/workspace; cd ~/workspace && echo "OK"
We must receive an OK output in our terminal, and that is sufficient to be aware that the workspace was created successfully and we are already inside it. Now, let’s download the Samba 4 source code and continue our installation process.
Now, we will clone the Samba 4 stable branch from the official project’s repository, configure it, and compile the software:\
$ git clone -b v4-0-stable git://git.samba.org/samba.git samba4
This command will take some time to complete as all the Samba 4 source code will need to be downloaded (the total time will vary depending on your Internet
connection). Next, note the use of the –enable-self test option it the following configure command, as we will need the features added by this option in a later phase:
$ cd samba4 $ ./configure --enable-debug --enable-selftest $ make && echo "OK"
This command will take some time to actually compile all the sources of the Samba 4 Server, and at the end, the output must be OK (the total time will vary depending on your system’s resources). Here, you can see the last lines of the compilation process that I got on my system, along with the final successful result and the total elapsed time:
Waf: Leaving directory '/home/user/workspace/samba4/bin' 'build' finished successfully (13m0.539s) OK /workspace/samba4$
The Samba 4 project helps us a lot with its built-in test suite, which is a great starting point for our environment’s validation. Just issue the following command:
$ sudo make quicktest
We will receive a verbose output that will report the execution of many invaluable tests to verify whether our Samba 4 Server’s installation is fully working. Pay close attention to each line as you’ll be able to follow the status of each test that is being executed.
Example output of quick test:
[256/310 in 43m56s] samba4.raw.ioctl(dc) [257/310 in 43m56s] samba4.raw.seek(dc) [258/310 in 43m57s] samba4.raw.eas(dc) [259/310 in 43m57s] samba4.raw.qfileinfo.ipc(dc) [260/310 in 43m57s] samba4.ntvfs.cifs.krb5.base.delete(dc) … ALL OK (2061 tests in 310 testsuites)
All tests must pass OK, as you can see in the preceding code so we can perform the installation of the binaries into their final destination (/usr/local/).
You can do this by issuing the following command:
$ sudo make install
This command will copy all the required files to their final destination on our file system. So, we will have the Samba 4 Server properly installed and ready to be configured and provide our network services.
Credits:
This excerpt has been taken from "Implementing Samba 4" by Marcelo Leal. If you like the post then support author by buying the book available on Amazon. Link here
In case of any ©Copyright or missing credits issue please check CopyRights page for faster resolutions.
content is heavily copied from Marcelo Leal’s book ‘Implementing Samba 4’
Thanks for pointing the same. Credits has been updated to reflect correct source.