preface

I have compiled and installed Samba4 on Ubuntu 20.04. The official website documentation has not been updated in time.

Installation steps

  • Dependency package Installation
  • Compiling and installing Samba
  • Configuring Samba

Dependency package Installation

The website address of wiki: wiki.samba.org/index.php/P…

It is strongly recommended that the installation be carried out entirely in the root environment to save the occurrence of various permissions

First you need the version of Samba you expect to install, Samba 4.12.7 is installed here

Ubuntu 18.04 is not much different from 20.04, so

We select the script, the initial installation, the script is as follows:

#! /bin/bash

#
# This file is generated by 'bootstrap/template.py --render'
# See also bootstrap/config.py
#
set -xueo pipefail export DEBIAN_FRONTEND=noninteractive apt-get -y update apt-get -y install \ acl \ apt-utils \ attr \  autoconf \ bind9utils \ binutils \ bison \ build-essential \ chrpath \ curl \ debhelper \ dnsutils \ docbook-xml \ docbook-xsl \ flex \ gcc \ gdb \ git \ glusterfs-common \ gzip \ heimdal-multidev \ hostname \ htop \ krb5-config \ krb5-kdc \ krb5-user \ language-pack-en \ lcov \ libacl1-dev \ libarchive-dev \ libattr1-dev \ libavahi-common-dev \ Libblkid-dev \ libbsd-dev \ libcap-dev \ libcephfs-dev \ libcups2-dev \ libdbus-1-dev \ libglib2.0-dev \ libgnutls28-dev  \ libgpgme11-dev \ libicu-dev \ libjansson-dev \ libjs-jquery \ libjson-perl \ libkrb5-dev \ libldap2-dev \ liblmdb-dev  \ libncurses5-dev \ libpam0g-dev \ libparse-yapp-perl \ libpcap-dev \ libpopt-dev \ libreadline-dev \ libsystemd-dev \ libtasn1-bin \ libtasn1-dev \ libunwind-dev \ lmdb-utils \ locales \ lsb-release \ make \ mawk \ mingw-w64 \ patch \ perl \ perl-modules \ pkg-config \ procps \ psmisc \ python3 \ python3-dbg \ python3-dev \ python3-dnspython \ python3-gpg \ python3-iso8601 \ python3-markdown \ python3-matplotlib \ python3-pexpect \ rng-tools \ rsync \ sed \ sudo  \ tar \ tree \ uuid-dev \ xfslibs-dev \ xsltproc \ zlib1g-dev apt-get -y autoremove apt-get -y autoclean apt-get -y cleanCopy the code

During the installation, you need to enter the Kerberos domain name.

DC installation

After installing the dependency packages, you need to install the Samba DC

Here, the official website installation dependency is as follows:

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-utilsCopy the code

If the above command is installed, an error will be reported if no accident occurs.

According to our previous setup script, we need to make some adjustments and add a few needed dependencies

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 python3-dbg python-dev python-dnspython \ python3-dnspython python3-gpg python-markdown python3-markdown \ python3-dev xsltproc zlib1g-dev liblmdb-dev lmdb-utils libsystemd-dev libkrb5-dev krb5-kdcCopy the code

At this point, the dependency packages should be installed.

Compile and install Samba4

Samba source code package website: www.samba.org/samba/histo…

Download /usr/local/ SRC/and decompress the file

Command execution
Root @ ubuntu1: / usr/local/samba - 4.12.7 src# CD/root @ ubuntu1: / usr/local/SRC/samba - 4.12.7 #. / configureCopy the code

If the preceding message is displayed, the configuration is successful.

Perform the installation

Root @ ubuntu1: / usr/local/SRC/samba - 4.12.7 # make && make installCopy the code

The default installation directory is /usr/local/samba

Add the Samba command to the $PATH variable

If Samba is built, add the directory containing the command to the beginning of the variable. For example: $PATH

export PATH=/usr/local/samba/bin/:/usr/local/samba/sbin/:$PATH
Copy the code