If you want to run a domain controller on your network but don’t have access to a Windows Server license, you can use SAMBA, the free open-source software, and VirtualBox, the free virtualization software. We’ll describe the procedure for setting up a virtual server using VirtualBox and netboot.xyz iPXE and move on to setting up your domain controller with SAMBA.
Read more here:
https://4sysops.com/archives/set-up-ubuntu-as-a-domain-controller-with-samba-on-virtualbox/