Exchange Server 2019 单机版安装
Exchange Server 是由微软开发的企业级邮件和日历服务器。它是一个高效、可靠且灵活的邮件系统,广泛应用于企业和组织中,用于管理电子邮件、日历、联系人和任务。
1.准备工作
- 第1步,资源规划
补:若用户规模达到 500-1000用户,则推荐配置:12核-64GB-2TB(SSD)
| ip地址 | 机器名 | 配置 | OS版本 | 软件清单 |
|---|---|---|---|---|
| 192.168.31.101 | dc | - | Windows Server 2012 R2 以上 | DC域控(示例 dc 为 xxx.com) |
| 192.168.31.102 | exserver | 4C-16G-500GB | Windows Server 2019 数据中心版 | Exchange2019(50-100用户) |
- 第2步,登录域控服务器,创建 Exchange 管理员账号,示例 exadmin
注:首次安装需要配置这几个高权限群组:[Domain Admins]、[Schema Admins]、[Enterprise Admins],安装完成之后,则可以移除这些高权限
:: 创建OU组织单位,比如 某某公司
dsadd ou "OU=某某公司,DC=xxx,DC=com"
dsadd ou "OU=技术部,OU=某某公司,DC=xxx,DC=com"
:: 创建用户
dsadd user "CN=exadmin,OU=技术部,OU=某某公司,DC=xxx,DC=com" -samid exadmin -desc "Exchange管理员" -pwd Passw0rd_123 -mustchpwd no
:: 确认用户是否存在
dsquery user "OU=某某公司,DC=xxx,DC=com"
:: 添加到特定组
dsmod group "CN=Domain Admins,CN=Users,DC=xxx,DC=com" -addmbr "CN=exadmin,OU=技术部,OU=某某公司,DC=xxx,DC=com"
dsmod group "CN=Schema Admins,CN=Users,DC=xxx,DC=com" -addmbr "CN=exadmin,OU=技术部,OU=某某公司,DC=xxx,DC=com"
dsmod group "CN=Enterprise Admins,CN=Users,DC=xxx,DC=com" -addmbr "CN=exadmin,OU=技术部,OU=某某公司,DC=xxx,DC=com"
:: 确认域账号隶属于哪些组
dsquery user -name exadmin | dsget user -memberof
- 第3步,登录 exchange 服务器,更改服务器名称,然后重启生效,示例改为 exserver
:: 更改机器名
wmic computersystem where name="%computername%" call rename name="exserver"
:: 立刻重启
shutdown /r /t 0
- 第4步,登录 exchange 服务器,通过 dism 启用 .NET Framework 3.5 功能
cd /d c:\
wget -c http://iso.sqlfans.cn/windows/win2019/sources.zip
unzip sources.zip
dism /online /enable-feature /featurename:NetFX3 /All /Source:C:\sources\sxs /LimitAccess
- 第5步,登录 exchange 服务器,将首选DNS服务器设置为域控ip,然后加域并重启服务器
:: 修改网络连接的名称, 示例将 以太网 改为 Ethernet0
:: netsh interface set interface name="以太网" newname="Ethernet0"
:: 将首选dns设置为域控ip,备用dns设置为阿里云dns
netsh interface ip set dns name="Ethernet0" source=static addr=192.168.31.101 register=primary
netsh interface ip add dns name="Ethernet0" addr=223.5.5.5 index=2
netsh interface ip show config
:: 加域, 域管理员 xxx\wsus_admin 密码为 nXWNiSR2A3_YcQzV
netdom join %computername% /domain:xxx.com /UserD:xxx\wsus_admin /PasswordD:nXWNiSR2A3_YcQzV
:: 添加域账号到本地管理员组
net localgroup administrators xxx\exadmin /add
:: 立刻重启
shutdown /r /t 0
- 第6步,重启之后,以域账号(xxx\exadmin)登录 exchange 服务器,配置防火墙端口放行,主要是开放 TCP 80/443/25/587 给
192.168.*.*访问
netsh advfirewall set allprofiles state off
netsh advfirewall firewall set rule name=all dir=in new enable=no
netsh advfirewall firewall set rule name=all dir=out new enable=no
netsh advfirewall firewall add rule name="permit_ping_echo_request" protocol=ICMPv4 dir=in action=allow
netsh advfirewall firewall add rule name="permit_mstsc_tcp_3389" protocol=TCP dir=in remoteip=192.168.0.0/255.255.0.0 localport=3389 action=allow
netsh advfirewall firewall add rule name="permit_http_tcp_80" protocol=TCP dir=in remoteip=192.168.0.0/255.255.0.0 localport=80 action=allow
netsh advfirewall firewall add rule name="permit_https_tcp_443" protocol=TCP dir=in remoteip=192.168.0.0/255.255.0.0 localport=443 action=allow
netsh advfirewall firewall add rule name="permit_smtp_tcp_25" protocol=TCP dir=in remoteip=192.168.0.0/255.255.0.0 localport=25 action=allow
netsh advfirewall firewall add rule name="permit_smtp_tcp_587" protocol=TCP dir=in remoteip=192.168.0.0/255.255.0.0 localport=587 action=allow
netsh advfirewall firewall add rule name="block_in_tcp_135_137_138_139_445" protocol=TCP dir=in localport=135,137,138,139,445 action=block
netsh advfirewall firewall add rule name="block_in_udp_135_137_138_139_445" protocol=UDP dir=in localport=135,137,138,139,445 action=block
netsh advfirewall firewall add rule name="block_out_tcp_135_137_138_139_445" protocol=TCP dir=out localport=135,137,138,139,445 action=block
netsh advfirewall firewall add rule name="block_out_udp_135_137_138_139_445" protocol=UDP dir=out localport=135,137,138,139,445 action=block
netsh advfirewall set allprofiles state on
2.安装 Exchange
- 第1步,以域账号(xxx\exadmin)登录 exchange 服务器,参考先决条件,以管理员身份运行 PowerShell,安装必需组件
# 优化下载
$ProgressPreference = 'SilentlyContinue'
# 安装 .NET Framework 版本 4.8, 大小 115 MB
Invoke-WebRequest -Uri "https://download.microsoft.com/download/f/3/a/f3a6af84-da23-40a5-8d1c-49cc10c8e76f/NDP48-x86-x64-AllOS-ENU.exe" -OutFile "C:\NDP48-x86-x64-AllOS-ENU.exe"
start C:\NDP48-x86-x64-AllOS-ENU.exe
# 装完 .NET Framework 会提示重启
shutdown /r /t 0
# 安装 Visual Studio 2012 的 Visual C++ 可再发行组件包, 大小 6.86 MB
Invoke-WebRequest -Uri "https://download.microsoft.com/download/f/3/5/f3500770-8a08-488e-94b6-17a1e1dd526f/vcredist_x64.exe" -OutFile "C:\vcredist_x64.exe"
start C:\vcredist_x64.exe
# 安装 Unified Communications Managed API 4.0 Runtime, 简体中文, 大小 240 MB
Invoke-WebRequest -Uri "https://download.microsoft.com/download/d/d/e/dde74f32-b59d-4763-8286-e133e4a8a9a3/UcmaRuntimeSetup.exe" -OutFile "C:\UcmaRuntimeSetup.exe"
start C:\UcmaRuntimeSetup.exe
# 安装必需的角色和服务, 比如 IIS/HTTP代理/RPC等
Install-WindowsFeature Server-Media-Foundation, NET-Framework-45-Core, NET-Framework-45-ASPNET, NET-WCF-HTTP-Activation45, NET-WCF-Pipe-Activation45, NET-WCF-TCP-Activation45, NET-WCF-TCP-PortSharing45, RPC-over-HTTP-proxy, RSAT-Clustering, RSAT-Clustering-CmdInterface, RSAT-Clustering-PowerShell, 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-Metabase, Web-Mgmt-Service, Web-Net-Ext45, Web-Request-Monitor, Web-Server, Web-Stat-Compression, Web-Static-Content, Web-Windows-Auth, Web-WMI, RSAT-ADDS
# 单独安装 IIS Management Console 角色
Install-WindowsFeature -Name Web-Server -IncludeManagementTools
# 安装 IIS URL Rewrite 模块, 简体中文x64, 大小 5.78 MB
Invoke-WebRequest -Uri "https://download.microsoft.com/download/1/2/8/128E2E22-C1B9-44A4-BE2A-5859ED1D4592/rewrite_amd64_zh-CN.msi" -OutFile "C:\rewrite_amd64_zh-CN.msi"
start C:\rewrite_amd64_zh-CN.msi
- 第2步,重启服务器
shutdown /r /t 0
- 第3步,安装 Exchange Server 2019 CU 15,即 KB5042461(2025/2/11发布、最新的累计更新)
#.下载iso, 大小 5.97 GB
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest -Uri "https://download.microsoft.com/download/7/0/a/70a4d908-eacb-426e-ad9f-e7768e27f873/ExchangeServer2019-x64-cu15.iso" -OutFile "C:\ExchangeServer2019-x64-cu15.iso"
#.挂载iso, 示例盘符 H:
$mountResult = Mount-DiskImage -ImagePath "c:\ExchangeServer2019-x64-cu15.iso" -NoDriveLetter -PassThru
$volumeId = ($mountResult | Get-Volume).UniqueId
mountvol.exe H: $volumeId
#.无人值守安装, 安装耗时约45分钟, 示例组织名称 SQLFANS
H:\Setup.exe /Mode:Install /Roles:Mailbox /OrganizationName:"SQLFANS" /IAcceptExchangeServerLicenseTerms_DiagnosticDataOFF
- 第4步,建议再次重启服务器
shutdown /r /t 0
- 第5步,登录 Exchange 控制台
| 站点名称 | URL地址 | 登录账号 | 登录密码 |
|---|---|---|---|
| OWA邮箱地址 | https://192.168.31.102/owa | xxx\exadmin | Passw0rd_123 |
| ECP管理中心 | https://192.168.31.102/ecp | xxx\exadmin | Passw0rd_123 |
3.配置 Exchange
- 首次登录 Exchange 控制台,需要配置时区:(UTC+08:00)北京
注:初始化完成之前,会出现无法保存语言和时区配置的情况,过会再试吧。
3.1.创建发送连接器
- 第1步,以管理员登录 exchange 管理中心,依次点击 邮件流 - 发送连接器,点击“+”图标,新建发送连接器,示例名称 ToPublic,类型选择 Internet
- 第2步,进入“网络设置”页,选择“与收件人域关联的 MX 记录”
- 第3步,进入“地址空间”页,点击“+”按钮。在弹出的窗口中,类型:SMTP,完全限定的域名:*
- 第4步,进入“源服务器”页,点击“+”按钮,选择你的Exchange服务器并“添加”,示例 exserver
- 第5步,写一封邮件,测试发送给外部邮箱地址,比如 78667417@qq.com 确认是否可以收到
3.2.修改域名指向
- 登录域名注册商,在DNS管理后台添加一条A记录,比如将
mail.xxx.com指向 exchange 服务器的ip地址




