Hide navigation sidebar
Hide table of contents sidebar
Skip to content
SAMBA 4.24
Back to top
View this page
Toggle table of contents sidebar

# 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.

    apt-get update && apt-get upgrade

We install the necessary dependencies to compile Samba:

    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 Git:

    apt-get install git

We go to `/usr/src` to download the Samba sources. We will then compile Samba.

    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 `/usr/local/samba` directory.

For example, the samba-tool command can be found in `/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:

    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 `/etc/systemd/system/samba.service` file:

      [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 systemctl enable samba:

      systemctl enable samba

### Compiling Samba from source on RedHat10 and derivatives

To do