Setting up Ubuntu 16.04 as Samba DC in Hyper-V Server 2016 -PART 2

The second part of our tutorial series will take us through installing Ubuntu 16.04 LTS as virtual machine into our Hyper-V server


Package Installation

apt update 
                                                                               
apt upgrade                                                                   

apt install --install-recommends linux-virtual-lts-xenial                                  

apt install --install-recommends linux-tools-virtual-lts-xenial linux-cloud-tools-virtual-lts-xenial                                                          

apt install acl attr autoconf bison build-essential \
debhelper dnsutils docbook-xml docbook-xsl flex gdb krb5-user \                             
libacl1-dev libaio-dev libattr1-dev libblkid-dev libbsd-dev \  
libcap-dev libcups2-dev libgnutls-dev libjson-perl \                 
libldap2-dev libncurses5-dev libpam0g-dev libparse-yapp-perl \ 
libpopt-dev libreadline-dev perl perl-modules pkg-config \             
python-all-dev python-dev python-dnspython python-crypto \ 
xsltproc zlib1g-dev

apt dist-upgrade                                                                      

apt autorem

lsmod =>check hv_storvsc ,    hv_netsvc ,    hv_utils    hv_vmbus


cp      /etc/default/{grub,grub_bak}  &&  echo  OK

nano   /etc/default/grub

GRUB_CMDLINE_LINUX_DEFAULT=”elevator=noop”

Exit

update-grub


apt  install  acl  attr

cp          /etc/{fstab,fstab_bak}  &&  echo  OK

nano  /etc/fstab

/ ext4  user_xattr,acl,barrier=1,errors=remountro 0 1

exit

mount  -a     

service lxd restart 


nano   /etc/hosts127.0.0.1  localhost                                           127.0.1.1       DC.köln.dennytheitguy.de. DC                        192.168.2.1  DC.köln.dennytheitguy.de  DC                       


apt  install  ntp

timedatectl  list-timezone

timedatectl  list-timezones                                                           

timedatectl  set-timezone Europe/Berlin

timedatectl  status


Kerberos                                                                                                apt  install  krb5-user smbclient                                                          kerberos Realm=         KÖLN.DENNYTHEITGUY.DE                               kerberos Server=   DC.KÖLN.DENNYTHEITGUY.DE                            Admin   Server=     DC.KÖLN.DENNYTHEITGUY.DE


nano  /etc/krb5.conf                                                               [libdefaults                                                                           default_realm  =  KÖLN.DENNYTHEITGUY.DE


Enable SystemD                                                                           

ifdown  eth0 && echo OK                                                                  

cp   /etc/network/{interfaces,interfaces_bak                                      

cat  /dev/null  >  /etc/network/interfaces 

updaterc.d networking remove    


systemctl  enable systemd-networkd && echo OK

systemctl  enable systemd-resolved && echo OK

systemctl  start  systemd-resolved && echo OK


ls -l /etc/resolv.conf && echo OK                                                 

rm    /etc/resolv.conf && echo OK                                                     

rm    /etc/resolvconf/resolv.conf.d/*  && echo OK                          

ln –sfv /var/run/systemd/resolve/resolv.conf    /etc/resolv.conf 

resolvconf  -u && echo OK

cp /etc/systemd/{resolved.conf,resolved.conf_bak}                      

nano    /etc/systemd/resolved.conf                                          

[Resolve]  #DNS=192.168.2.1

#Domains=köln.dennytheitguy.de


SystemD Networking

nano  /etc/systemd/network/10-static-eth0.network

[Match]                                                                                       Name=eth0

[Network]                                                       Address=192.168.2.1/24                                               Gateway=192.168.2.254                                             DNS=192.168.2.1                                                                       Domains= köln.dennytheitguy.de


systemctl restart  systemd-networkd                                           

systemctl restart  systemd-resolved                                        

systemctl  status  systemd-networkd                                                

systemctl  status  systemd-resolved

systemctl  enable  – –now  systemd–resolved && echo OK


Configure Samba

check latest samba==> www.samba.org/samba/history/

cd  /usr/src

wget  http://www.samba.org/samba/ftp/stable/samba4.5.5.tar.gz

tar   -xzf   samba-4.5.5.tar.gz

cd   samba-4.5.5                                                                                


./configure.developer   –enable-debug   –enable-selftest

make  &&  make install  && echo OK                                                        


echo ‘export   PATH=/usr/local/samba/bin/:/usr/local/samba/sbin/:$PATH  >>   /root/.bash_profile   && echo OK


ln -s   /usr/local/samba/etc    /etc/samba   && echo OK                                                                                                                


sambatool  domain provision  userfc2307 –interactive   

realm=KÖLN.DENNYTHEITGUY.DE

domain=KÖLN

server-role=dc                                                                    

dns-backend=SAMBA_INTERNAL

dns forwarder =  8.8.8.8


samba-tool    user    setexpiry   administrator   noexpiry


nano   /etc/samba/smb.conf                                                           

[global]

workgroup  =  KÖLN

realm  =   KÖLN.DENNYTHEITGUY.DE

netbios  name  =  DC

server  role  =  active directory domain controller

dns  forwarder  =  8.8.8.8                                                


smbcontrol   all   reload-config  && echo OK            

 testparm


rm      /etc/krb5.conf   && echo OK

ln -sf /usr/local/samba/private/krb5.conf  /etc/krb5.conf && echo OK


Test Samba4 DC                                                                      

samba   -i   -M   single

samba                                                                                   

samba   start                                                                           

samba  


Test Kerberos                 

nano  /etc/krb5.conf                                                              [libdefaults]                                                                        default_realm    = KÖLN.DENNYTHEITGUY.DE            dns_lookup_realm = false                                                 dns_lookup_kdc   = true


kinit  administrator

klist   -e


Test DNS                             

host  -t  SRV    _ldap._tcp.köln.dennytheitguy.de

host  -t  SRV   _kerberos._udp. köln.dennytheitguy.de

host  -t   A   DC. köln.dennytheitguy.de

host  -t  mx    dennytech.com

host  www.dennytech.com


net ads  info

net ads  lookup                                                                    

nmblookup DC

smbclient   L   localhost   U%                                     

smbclient   //localhost/netlogon   UAdministrator  c   ‘ls’


That rouds off the tutorial.

Next we shall be looking into File Server!