Last active
October 12, 2021 16:45
-
-
Save jniltinho/87169f628cced009c6aab895d54219ed to your computer and use it in GitHub Desktop.
FPM CentOS 7 Samba 4.11.5 RPM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
## Create RPM package Samba4 4.11.5 (CentOS 7) | |
## http://sig9.hatenablog.com/entry/2017/12/04/000000 | |
## Run as root (sudo su) | |
VERSION=4.11.5 | |
yum -y install epel-release | |
yum update -y | |
yum -y install gcc python3-devel curl rpm-build ruby ruby-devel rubygems ruby-libs make | |
gem install fpm | |
yum -y install \ | |
bind-utils \ | |
cups-devel libtasn1 libtasn1-devel \ | |
cyrus-sasl-devel \ | |
docbook-style-xsl \ | |
lmdb-devel libarchive-devel \ | |
gdb gpgme-devel pygpgme \ | |
gnutls-devel jansson-devel \ | |
keyutils-libs-devel \ | |
krb5-workstation \ | |
libacl-devel \ | |
libaio-devel \ | |
libattr-devel \ | |
libblkid-devel \ | |
libidn-devel \ | |
libpcap-devel \ | |
libsemanage-python \ | |
libsepol-devel \ | |
libxml2-devel \ | |
libxslt \ | |
openldap-devel \ | |
pam-devel \ | |
perl \ | |
pkgconfig \ | |
policycoreutils-python \ | |
popt-devel \ | |
python-devel \ | |
readline-devel \ | |
setools-libs \ | |
setools-libs-python \ | |
setroubleshoot-plugins \ | |
setroubleshoot-server \ | |
sqlite-devel \ | |
zlib-devel | |
curl -L -O http://www.samba.org/samba/ftp/samba-latest.tar.gz | |
tar zxvf samba-latest.tar.gz | |
cd samba-${VERSION}* | |
./configure --with-ads --with-shared-modules=idmap_ad --enable-debug --enable-selftest --with-systemd --prefix=/opt/samba4 | |
make | |
mkdir ~/work | |
make install install DESTDIR=~/work | |
fpm \ | |
-d "python" \ | |
-d "python3" \ | |
-d "pam" \ | |
-d "gnutls" \ | |
-d "cups-libs" \ | |
-d "acl" \ | |
-d "attr" \ | |
-d "python-dns" \ | |
-s dir \ | |
-t rpm \ | |
-n samba \ | |
-v ${VERSION} \ | |
-C ~/work \ | |
-p samba-${VERSION}-1.el7.x86_64.rpm . | |
## Build CentOS 7 Docker | |
#docker run --rm -it -v "${PWD}:/install" centos:7 /bin/bash | |
#cd /install/ | |
#bash create-rpm-samba4.sh | |
## Install RPM | |
## rpm -i samba-${VERSION}-1.el7.x86_64.rpm | |
#echo '[Unit] | |
#Description=Samba4 AD Daemon | |
#After=syslog.target network.target | |
#[Service] | |
#Type=forking | |
#PIDFile=/opt/samba4/var/run/samba.pid | |
#LimitNOFILE=16384 | |
#EnvironmentFile=-/etc/sysconfig/samba4 | |
#ExecStart=/opt/samba4/sbin/samba $SAMBAOPTIONS | |
#ExecReload=/usr/bin/kill -HUP $MAINPID | |
#[Install] | |
#WantedBy=multi-user.target' > /etc/systemd/system/samba4.service | |
### Add PATH | |
#echo 'export PATH=$PATH:/opt/samba4/bin:/opt/samba4/sbin' >> /etc/profile | |
#source /etc/profile | |
### Create Domain Samba4 like AD | |
# hostnamectl set-hostname samba4.linuxpro.net | |
# samba-tool domain provision --server-role=dc --use-rfc2307 --dns-backend=SAMBA_INTERNAL --realm=LINUXPRO.NET --domain=LINUXPRO --adminpass=Linuxpro123456 | |
# or | |
# samba-tool domain provision --server-role=dc --use-rfc2307 --function-level=2008_R2 --use-xattrs=yes --dns-backend=SAMBA_INTERNAL --realm=LINUXPRO.NET --domain=LINUXPRO --adminpass=Linuxpro123456 | |
### Add start script on boot | |
# systemctl daemon-reload | |
# systemctl enable samba4.service | |
# systemctl start samba4.service |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hi,os:RHEL 7.7 compiled with your script samba-4.11.6-1.el7.x86_64.rpm ,I got the following error.
[root@rpm-test bin]# ./samba-tool
Traceback (most recent call last):
File "./samba-tool", line 34, in
from samba.netcmd.main import cmd_sambatool
ModuleNotFoundError: No module named 'samba'