.. Reminder for header structure: Parts (H1) : #################### with overline Chapters (H2) : ******************** with overline Sections (H3) : ==================== Subsections (H4) : -------------------- Subsubsections (H5) : ^^^^^^^^^^^^^^^^^^^^ Paragraphs (H6) : """"""""""""""""""""" .. |date| date:: .. meta:: :description: Compiling Samba from source :keywords: Redhat8, Debian, Samba-AD, compile, sources .. _samba_compile_from_source: ########################### Compiling Samba from source ########################### ******************************************** Compiling Samba from source on Debian Buster ******************************************** .. attention:: The development version is not to be installed in a production environment. It is not stable and contains many bugs. You can compile it in an isolated environment to test new features. This documentation is based on the Debian Buster 64bits distribution. We assume that the machine is freshly installed, up to date and that no service other than SSH is installed. .. code-block:: bash apt-get update && apt-get upgrade We install the necessary dependencies to compile Samba: .. code-block:: bash export DEBIAN_FRONTEND=noninteractive apt-get install acl attr autoconf bind9utils bison build-essential \ debhelper dnsutils docbook-xml docbook-xsl flex gdb libjansson-dev krb5-user \ libacl1-dev libaio-dev libarchive-dev libattr1-dev libblkid-dev libbsd-dev \ libcap-dev libcups2-dev libgnutls28-dev libgpgme-dev libjson-perl \ libldap2-dev libncurses5-dev libpam0g-dev libparse-yapp-perl \ libpopt-dev libreadline-dev nettle-dev perl perl-modules pkg-config \ python-all-dev python-crypto python-dbg python-dev python-dnspython \ python3-dnspython python-gpgme python3-gpgme python-markdown python3-markdown \ python3-dev xsltproc zlib1g-dev liblmdb-dev lmdb-utils As we will get the master branch of Samba from the Samba github, we will download :program:`Git`: .. code-block:: bash apt-get install git We go to :file:`/usr/src` to download the Samba sources. We will then compile Samba. .. code-block:: bash cd /usr/src git clone https://github.com/samba-team/samba.git cd samba ./configure make make install By default, Samba will be compiled into the :file:`/usr/local/samba` directory. For example, the :command:`samba-tool` command can be found in :file:`/usr/local/samba/bin/samba-tool`. Adding the path to Samba commands to your Linux user ==================================================== In order not to write the full path of a Samba command, we will add the Samba tools in $PATH: .. code-block:: bash echo "export PATH=$PATH:/usr/local/samba/sbin:/usr/local/samba/bin" >> /root/.bashrc source /root/.bashrc Setting up Samba-AD to start automatically ========================================== * Create the :file:`/etc/systemd/system/samba.service` file: .. code-block:: bash [Service] Type=forking PIDFile=/usr/local/samba/var/run/samba.pid LimitNOFILE=16384 EnvironmentFile=-/etc/conf.d/samba ExecStart=/usr/local/samba/sbin/samba ExecReload=/usr/bin/kill -HUP $MAINPID [Install] WantedBy=multi-user.target * To start Samba automatically, run :command:`systemctl enable samba`: .. code-block:: bash systemctl enable samba Compiling Samba from source on Redhat8 and derivatives ====================================================== To do