Noted: This guide also applied to setup secondary Exchange server or DAG
***Exchange server must join to domain controller
Login to Exchange server and open PowerShell with administrative privileges and execute the following command to install required roles.
Install-WindowsFeature AS-HTTP-Activation, Desktop-Experience, NET-Framework-45-Features, RPC-over-HTTP-proxy, RSAT-Clustering, RSAT-Clustering-CmdInterface, RSAT-Clustering-Mgmt, RSAT-Clustering-PowerShell, Web-Mgmt-Console, WAS-Process-Model, Web-Asp-Net45, Web-Basic-Auth, Web-Client-Auth, Web-Digest-Auth, Web-Dir-Browsing, Web-Dyn-Compression, Web-Http-Errors, Web-Http-Logging, Web-Http-Redirect, Web-Http-Tracing, Web-ISAPI-Ext, Web-ISAPI-Filter, Web-Lgcy-Mgmt-Console, Web-Metabase, Web-Mgmt-Console, Web-Mgmt-Service, Web-Net-Ext45, Web-Request-Monitor, Web-Server, Web-Stat-Compression, Web-Static-Content, Web-Windows-Auth, Web-WMI, Windows-Identity-Foundation, ADLDS, RSAT-ADDS

After completed install pre-requisites role, restart if needed. Next to finish with all pre-requisites, install below 3 components:
- Installing Microsoft Unified Communications Managed API 4.0
Download and installĀ Microsoft Unified Communications Managed API (UCMA) 4.0, Runtime. - Installing Visual C++ Redistributable Packages for Visual Studio 2013 Download and install https://www.microsoft.com/en-us/download/confirmation.aspx?id=40784
- Installing .NetFramework 4.7.2 Download and install http://go.microsoft.com/fwlink/?linkid=863265
Next, install Exchange Server





Next change the installation path which contain Exchange database (Recommended to install on different disk or location)

***This step will automatically skip if you setup secondary Exchange server


If there is a warning after pre-requisites analysis check about AD prepare, you can ignored and press install to continue
***Setup will not prompt if you install secondary exchange server for DAG


Next, login to Exchange administrator console: https://x.x.x.x/ecp

Go to mail flow > accepted domains > add accepted domain

Go to email address policies > edit Default policy > email address format > add detail as below:

You need to click Apply to apply the policy, at right corner and make sure STATUS show applied

Next go to send connectors > add > enter Name and select Type as Internet

Next, leave this as default unless MX smart host need route to any spam services

Next, click Add

Enter the information same as below:

Next, Add Server

Select Server to add

Click Finish

Next, go to servers > virtual directories

Click edit to change all virtual directories internal and external URL to external URL address, Example:

After changed all virtual directories URL to external URL, go to domain controller DNS and public DNS to add below DNS record:
1. Add this two record to domain controller DNS, example:
mail.titancloud.com.my A 1.1.1.1 —> local exchange server IP
autodiscover.titancloud.com.my A 1.1.1.1 —> local exchange server IP

2. Add record to Public DNS services like cloudflare or others
mail.titancloud.com.my A 11.11.11.11 —> local exchange server WAN IP
autodiscover.titancloud.com.my A 11.11.11.11 —> local exchange WAN IP
***Please noted that you also need to add PTR, MX and SPF recordin Public DNS server
3. Go to firewall port-forwarding Exchange server to WAN
Port to open for mail server:
25
110
143
445
587
993
995
2525
443
Done!