Update Ubuntu Samba DC installation script

This commit is contained in:
Johan 2024-01-02 14:28:00 +01:00
parent 29ec1bb831
commit f0da46e9ba

View File

@ -1,4 +1,5 @@
# Install using: sudo su -c "bash <(wget -qO- /url/to/install-ubuntu-dc.sh)"
# https://www.youtube.com/watch?v=zzpEIezhues
function version { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; }
@ -67,7 +68,9 @@ ${DCREALM^^} = {
EOT
fi
export DEBIAN_FRONTEND=noninteractive
# export DEBIAN_FRONTEND=noninteractive
echo "In the next step, just confirm the default settings."
read -p "Press any key to resume ..."
apt -y install samba krb5-config winbind smbclient 2>>install.log &&
# samba package may display errors about "samba-ad-dc.service" when installing, these can be ignored. - https://ubuntu-server-bugs.narkive.com/NxgfWkki/bug-1658273-re-failed-to-preset-unit-unit-file-etc-systemd-system-samba-ad-dc-service-is-masked
@ -79,7 +82,10 @@ EOT
fi
{
mv /etc/samba/smb.conf /etc/samba/smb.conf.original &&
mv /etc/samba/smb.conf /etc/samba/smb.conf.original
echo "In the next step, enter '${DCREALM,,}' as realm. Then use the default settings."
echo "Press any key to resume ..."
read -p "Press any key to resume ..."
samba-tool domain provision --function-level=2008_R2 --interactive &&
# https://wiki.samba.org/index.php/Setting_up_Samba_as_an_Active_Directory_Domain_Controller#Provisioning_Samba_AD_in_Non-interactive_Mode
# samba-tool domain provision --function-level=2008_R2 --server-role=dc --dns-backend=SAMBA_INTERNAL --realm=${DCREALM^^} --domain=${DCDOMAIN^^} --adminpass=$DCPASSWORD &&