Samba4在Ubuntu20.04 编译安装指南

Samba4在Ubuntu20.04 编译安装指南_第1张图片

前言

在Ubuntu系统20.04上编译安装Samba4,官网文档没有及时更新,在此,把为了给大家避坑,特此分享。

安装步骤
  • 依赖包安装
  • 编译安装Samba
  • 配置Samba
依赖包安装

官网wiki地址: https://wiki.samba.org/index.php/Package_Dependencies_Required_to_Build_Samba

强烈建议,此处安装,完全在root环境下进行,省的出现各样的权限问题

首先需要预计安装Samba的版本,此处安装Samba 4.12.7

Ubuntu 18.04与20.04相差不是很大,因此

Samba4在Ubuntu20.04 编译安装指南_第2张图片

我们选择该脚本,初步安装,脚本如下:

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

安装期间,需要输入Kerberos协议的域名信息,正确填写即可,此处不多赘述。

DC安装

安装完依赖包之后,需要安装Samba DC

此处,官网安装依赖如下:

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

如果安装以上命令安装,不出意外会报错。

根据我们之前安装脚本,需要做一下调整,并且添加几个需要的依赖

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-kdc

此时,应该依赖包安装完毕。

编译安装Samba4

Samba源码包网址: https://www.samba.org/samba/history/samba-4.12.7.html

下载,上传服务器目录,/usr/local/src/,解压文件

命令执行
root@ubuntu1:/usr/local/src# cd samba-4.12.7/
root@ubuntu1:/usr/local/src/samba-4.12.7# ./configure

Samba4在Ubuntu20.04 编译安装指南_第3张图片

如果出现如上提示,配置成功。

执行安装

root@ubuntu1:/usr/local/src/samba-4.12.7# make && make install 

Samba4在Ubuntu20.04 编译安装指南_第4张图片

显示以上,就安装成功了,默认安装目录: /usr/local/samba

Samba4在Ubuntu20.04 编译安装指南_第5张图片

将Samba命令添加到$PATH变量

如果构建了Samba,请将包含命令的目录添加到变量的开头。例如:$PATH

export PATH=/usr/local/samba/bin/:/usr/local/samba/sbin/:$PATH

你可能感兴趣的:(AD活动目录)