Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Create RPM Samba4 4.9.2 OpenSUSE Leap 15
## Create RPM package Samba4 4.9.2 (OpenSUSE 15)
## Run as root (sudo su)
## docker run --rm -it -v "${PWD}:/usr/src" -e LANG=en_US.UTF-8 opensuse/leap:15 /bin/bash
zypper in -y ruby-devel rpm-build wget tar gzip
zypper in -y pkg-config libblkid-devel autoconf make python-devel gdb sqlite3-devel libgnutls-devel libjansson-devel
zypper in -y perl perl-TimeDate git-core pam-devel libsepol-devel ccache cracklib-devel gdbm-devel libgpgme-devel
zypper in -y e2fsprogs-devel libiniparser-devel libuuid-devel libaio-devel libtdb-devel python-tdb libnscd-devel
zypper in -y policycoreutils-python setools-libs setools-libs popt-devel libpcap-devel keyutils-devel libarchive-devel
zypper in -y libidn-devel libxml2-devel libsepol-devel libacl-devel libattr-devel zlib-devel cyrus-sasl-devel cups-devel
zypper in -y krb5-client pam-devel openldap2-devel libopenssl-devel bind-utils libavahi-devel binutils bison libffi-devel
zypper in -y flex gcc-c++ make flex docbook2x gcc pam-devel readline-devel krb5-devel lmdb-devel docbook-xsl-stylesheets
zypper in -y python python-tdb krb5-client
gem install fpm
mkdir -p /build && cd /build
PKG=$(basename ${get_samba4}|sed "s/.tar.gz//")
PKG_NAME=$(basename ${get_samba4}|sed "s/.tar.gz//"|cut -d- -f1)
PKG_VERSION=$(basename ${get_samba4}|sed "s/.tar.gz//"|cut -d- -f2)
wget -c ${get_samba4}
tar xvfz $(basename ${get_samba4})
cd $(basename ${get_samba4}|sed "s/.tar.gz//")
./configure --with-ads --systemd-install-services --with-shared-modules=idmap_ad --enable-debug --enable-selftest --with-systemd --prefix=/opt/samba4
make -j 2
make install install DESTDIR=/tmp/installdir
mkdir -p /tmp/installdir/etc/systemd/system
echo '[Unit]
Description=Samba4 AD Daemon
ExecStart=/opt/samba4/sbin/samba $SAMBAOPTIONS
ExecReload=/usr/bin/kill -HUP $MAINPID
[Install]' > /tmp/installdir/etc/systemd/system/samba4.service
fpm.ruby2.5 -s dir -t rpm -n ${PKG_NAME} -v ${PKG_VERSION} -C /tmp/installdir \
-d "python" \
-d "acl" \
-d "liblmdb-0_9_17" \
-d "libpython2_7-1_0" \
-d "libbsd0" \
-d "libpopt0" \
-d "libgnutls30" \
-d "libldap-2_4-2" \
-d "libcups2" \
-d "libjansson4" \
-d "libgpgme11" \
-p ${PKG}-lp150.0.1.x86_64.rpm .
mv ${PKG}-lp150.0.1.x86_64.rpm /root/
## Install RPM
## zypper in -y libpython2_7-1_0 python liblmdb-0_9_17 libbsd0 libpopt0
## zypper in -y acl libgnutls30 libldap-2_4-2 libcups2 libjansson4 libgpgme11
## rpm -ivh samba-4.9.2-lp150.0.1.x86_64.rpm
### 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
# useradd -d /nonexistent -M -s /usr/sbin/nologin -u 65534 nobody
# 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
You can’t perform that action at this time.