To install Active Directory on a Windows Server host, use PowerShell to install the AD DS role:

Install-WindowsFeature -name AD-Domain-Services -IncludeManagementTools
# run Get-Command -Module ADDSDeployment to see available AD DS installation commands
# Run desired ADDS deployment commands
# - InstallADDSForest
# - InstallADDSDomain
# - InstallADDSDomainController
 
# Example for installing new forest root domain
Install-ADDSForest [-SkipPreChecks] -DomainName <string> -SafeModeAdministratorPassword <SecureString> [-CreateDNSDelegation] [-DatabasePath <string>] [-DNSDelegationCredential <PS Credential>] [-NoDNSOnNetwork] [-DomainMode <DomainMode> {Win2003 | Win2008 | Win2008R2 | Win2012}] [-DomainNetBIOSName <string>] [-ForestMode <ForestMode> {Win2003 | Win2008 | Win2008R2 | Win2012}] [-InstallDNS] [-LogPath <string>] [-NoRebootOnCompletion] [-SkipAutoConfigureDNS] [-SYSVOLPath] [-Force] [-WhatIf] [-Confirm] [<CommonParameters>]

Alternatively, use Server Manager (GUI) to install AD DS role.

See Install Active Directory Domain Services (Level 100) | Microsoft Learn.