﻿<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>学习日记 &#187; 系统</title>
	<atom:link href="https://www.softwareace.cn/?cat=95&#038;feed=rss2" rel="self" type="application/rss+xml" />
	<link>https://www.softwareace.cn</link>
	<description>时刻想着为自己的产品多做一些对他好的事情</description>
	<lastBuildDate>Fri, 20 Mar 2026 06:58:28 +0000</lastBuildDate>
	<language>zh-CN</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>centos(7.0) 上 crontab 计划任务</title>
		<link>https://www.softwareace.cn/?p=1597</link>
		<comments>https://www.softwareace.cn/?p=1597#comments</comments>
		<pubDate>Fri, 03 Mar 2017 07:35:51 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[系统]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=1597</guid>
		<description><![CDATA[[crayon-69feb06cc4e06250704602/] &#160; 补充： 1、crontab相关 [&#8230;]]]></description>
				<content:encoded><![CDATA[<p></p><pre class="crayon-plain-tag">yum install vixie-cron
yum install crontabs
/bin/systemctl restart crond.service  #启动服务
/bin/systemctl reload  crond.service  #重新载入配置
/bin/systemctl status  crond.service  #查看crontab服务状态</pre><p>&nbsp;</p>
<p style="color: #444444;"><span style="color: #ff0000;"><strong>补充：</strong></span></p>
<p style="color: #444444;"><strong>1、crontab相关命令</strong></p>
<p style="color: #444444;"><strong>功能说明：</strong>设置计时器。</p>
<p style="color: #444444;"><strong>语　　法：</strong>crontab [-u &lt;用户名称&gt;][配置文件] 或 crontab [-u &lt;用户名称&gt;][-elr]</p>
<p style="color: #444444;"><strong>补充说明：</strong>cron是一个常驻服务，它提供计时器的功能，让用户在特定的时间得以执行预设的指令或程序。只要用户会编辑计时器的配置文件，就可以使用计时器的功能。</p>
<p style="color: #444444;"><strong>配置文件格式：</strong>Minute Hour Day Month DayOFWeek Command</p>
<p style="color: #444444;"><strong>参　　数： </strong><br />
-e 　编辑该用户的计时器设置。<br />
-l 　列出该用户的计时器设置。<br />
-r 　删除该用户的计时器设置。<br />
-u&lt;用户名称&gt; 　指定要设定计时器的用户名称。</p>
<p style="color: #444444;">
<p style="color: #444444;"><strong>2、crontab 配置文件格式</strong></p>
<p style="color: #444444;"><strong>　　基本格式 :</strong><br />
*      * 　 *　  *　  *　　command<br />
分　  时　 日　 月　 周　  命令</p>
<p style="color: #444444;">　　第1列表示分钟1～59 每分钟用*或者 */1表示<br />
第2列表示小时1～23（0表示0点）<br />
第3列表示日期1～31<br />
第4列表示月份1～12<br />
第5列标识号星期0～6（0表示星期天）<br />
第6列要运行的命令</p>
<p style="color: #444444;"> 除了数字还有几个个特殊的符号就是&#8221;*&#8221;、&#8221;/&#8221;和&#8221;-&#8221;、&#8221;,&#8221;，*代表所有的取值范围内的数字，&#8221;/&#8221;代表每的意思,&#8221;*/5&#8243;表示每5个单位，&#8221;-&#8221;代表从某个数字到某个数字,&#8221;,&#8221;分开几个离散的数字。</p>
<p style="color: #444444;"><strong>crontab文件的一些例子：</strong></p>
<p></p><pre class="crayon-plain-tag">30 21 * * * /usr/local/etc/rc.d/apache restart  #每晚的21:30 重启apache 

45 4 1,10,22 * * /usr/local/etc/rc.d/apache restart  #每月1、10、22日的4 : 45重启apache 

10 1 * * 6,0 /usr/local/etc/rc.d/apache restart #每周六、周日的1 : 10重启apache  

0,30 18-23 * * * /usr/local/etc/rc.d/apache restart  #每天18 : 00至23 : 00之间每隔30分钟重启apache  

0 23 * * 6 /usr/local/etc/rc.d/apache restart  #每星期六的11 : 00 pm重启apache

* 23-7/1 * * * /usr/local/etc/rc.d/apache restart  #晚上11点到早上7点之间，每隔一小时重启  apache

* */1 * * * /usr/local/etc/rc.d/apache restart  #每一小时重启apache   

0 11 4 * mon-wed /usr/local/etc/rc.d/apache restart #每月的4号与每周一到周三的11点重启apache   

0 4 1 jan * /usr/local/etc/rc.d/apache restart  #一月一号的4点重启apache  

*/30 * * * * /usr/sbin/ntpdate 210.72.145.44  #每半小时同步一下时间 

0 */2 * * * www /usr/bin/somecommand  &gt;&gt;  /dev/null 2&gt;&amp;1 #以用户www的身份每两小时就运行某个程序：</pre><p>&nbsp;</p>
<p><strong>3、其他任务调度</strong></p>
<p>cron默认配置了调度任务，分别为：hourly、daily、weekly、mouthly，默认配置文件为/etc/anacrontab</p>
<p>将需要执行的脚本放到相应的目录下即可，目录分别为：</p>
<p>/etc/cron.hourly</p>
<p>/etc/cron.daily</p>
<p>/etc/cron.weekly</p>
<p>/ect/cron.mouthly</p>
<p>&nbsp;</p>
<p style="color: #2d374b;">cron 的主配置文件是 /etc/crontab，它包括下面几行：</p>
<p></p><pre class="crayon-plain-tag">SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
&lt;span class=&quot;hljs-section&quot; style=&quot;color: #efef8f;&quot;&gt;#&nbsp;run-parts&lt;/span&gt;
01&nbsp;&lt;span class=&quot;hljs-bullet&quot; style=&quot;color: #dca3a3;&quot;&gt;*&nbsp;*&lt;/span&gt;&nbsp;&lt;span class=&quot;hljs-bullet&quot; style=&quot;color: #dca3a3;&quot;&gt;*&nbsp;*&lt;/span&gt;&nbsp;root&nbsp;run-parts&nbsp;/etc/cron.hourly
02&nbsp;4&nbsp;&lt;span class=&quot;hljs-bullet&quot; style=&quot;color: #dca3a3;&quot;&gt;*&nbsp;*&lt;/span&gt;&nbsp;*&nbsp;root&nbsp;run-parts&nbsp;/etc/cron.daily
22&nbsp;4&nbsp;&lt;span class=&quot;hljs-bullet&quot; style=&quot;color: #dca3a3;&quot;&gt;*&nbsp;*&lt;/span&gt;&nbsp;0&nbsp;root&nbsp;run-parts&nbsp;/etc/cron.weekly
42&nbsp;4&nbsp;1&nbsp;&lt;span class=&quot;hljs-bullet&quot; style=&quot;color: #dca3a3;&quot;&gt;*&nbsp;*&lt;/span&gt;&nbsp;root&nbsp;run-parts&nbsp;/etc/cron.monthly</pre><p></p>
<p style="color: #2d374b;">
<h3 id="h3_0" style="font-weight: 500; color: #3d464d;">4. 关于cron配置文件/etc/crontab</h3>
<p style="color: #2d374b;">cron 的主配置文件是 /etc/crontab，它包括下面几行：</p>
<p></p><pre class="crayon-plain-tag">SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
&lt;span class=&quot;hljs-section&quot; style=&quot;color: #efef8f;&quot;&gt;#&nbsp;run-parts&lt;/span&gt;
01&nbsp;&lt;span class=&quot;hljs-bullet&quot; style=&quot;color: #dca3a3;&quot;&gt;*&nbsp;*&lt;/span&gt;&nbsp;&lt;span class=&quot;hljs-bullet&quot; style=&quot;color: #dca3a3;&quot;&gt;*&nbsp;*&lt;/span&gt;&nbsp;root&nbsp;run-parts&nbsp;/etc/cron.hourly
02&nbsp;4&nbsp;&lt;span class=&quot;hljs-bullet&quot; style=&quot;color: #dca3a3;&quot;&gt;*&nbsp;*&lt;/span&gt;&nbsp;*&nbsp;root&nbsp;run-parts&nbsp;/etc/cron.daily
22&nbsp;4&nbsp;&lt;span class=&quot;hljs-bullet&quot; style=&quot;color: #dca3a3;&quot;&gt;*&nbsp;*&lt;/span&gt;&nbsp;0&nbsp;root&nbsp;run-parts&nbsp;/etc/cron.weekly
42&nbsp;4&nbsp;1&nbsp;&lt;span class=&quot;hljs-bullet&quot; style=&quot;color: #dca3a3;&quot;&gt;*&nbsp;*&lt;/span&gt;&nbsp;root&nbsp;run-parts&nbsp;/etc/cron.monthly</pre><p></p>
<p style="color: #2d374b;">前四行是用来配置 cron 任务运行环境的变量：</p>
<p style="color: #2d374b;">Shell 变量的值指定shell 环境（此处默认为 bash shell）；PATH 变量定义用来执行命令的程序路径；cron 任务的输出被邮寄给 MAILTO 变量定义的用户名，如果 MAILTO 变量被定义为空白字符串（MAILTO=&#8221;&#8221;），电子邮件就不会被寄出；HOME 变量可以用来设置在执行命令或脚本时使用的主目录。如在 /etc/crontab 文件中run-parts部分所示，它使用 run-parts 脚本来执行存在于 /etc/cron.hourly、/etc/cron.daily、/etc/cron.weekly 和 /etc/cron.monthly 目录中的脚本，这些脚本被相应地按照预设时间在每小时、每日、每周、或每月执行。这些目录中的文件应该是 shell 脚本，并且具有可执行权限(chmod +x filename)。</p>
<p style="color: #2d374b;">如果某 cron 任务需要根据调度来执行，而不是每小时、每日、每周、或每月地执行，它可以被添加到/etc/cron.d目录中。该目录中的所有文件使用和 /etc/crontab 中一样的语法。</p>
<p style="color: #2d374b;">每次编辑完某个用户的cron设置后，cron自动在/var/spool/cron下生成一个与此用户同名的文件，此用户的cron信息都记录在这个文件中，这个文件是不可以直接编辑的，只可以用crontab -e 来编辑。cron启动后每过一份钟读一次这个文件，检查是否要执行里面的命令。因此此文件修改后不需要重新启动cron服务。</p>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=1597</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows 10 下载已经签名的程序，提示签名无效或损坏</title>
		<link>https://www.softwareace.cn/?p=1429</link>
		<comments>https://www.softwareace.cn/?p=1429#comments</comments>
		<pubDate>Wed, 20 Jan 2016 09:48:21 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[系统]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=1429</guid>
		<description><![CDATA[原文  http://www.wosign.com/news/STOP_SHA1.htm 解决  SHA-1  [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>原文  http://www.wosign.com/news/STOP_SHA1.htm</p>
<p>解决  <strong>SHA-1 + <strong>SHA-2 双签名    </strong></strong></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=1429</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VMware 11安装Mac OS X 10.10</title>
		<link>https://www.softwareace.cn/?p=1337</link>
		<comments>https://www.softwareace.cn/?p=1337#comments</comments>
		<pubDate>Wed, 27 May 2015 02:48:56 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[系统]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=1337</guid>
		<description><![CDATA[VM11安装Mac OS X 10.10 网上竟没有搜到相似的内容，所以拿出来大家分享 工具/原料 1.VMw [&#8230;]]]></description>
				<content:encoded><![CDATA[<div class="exp-content-block">
<div class="exp-content-body exp-brief-step">
<div class="exp-content-listblock">
<div class="content-listblock-text">
<p>VM11安装Mac OS X 10.10</p>
<p>网上竟没有搜到相似的内容，所以拿出来大家分享</p>
</div>
</div>
</div>
</div>
<div class="exp-content-block">
<h2 class="exp-content-head"><a name="section-2"></a> 工具/原料</h2>
<div class="exp-content-body">
<ul class="exp-content-unorderlist ">
<li class="exp-content-list list-item-1">
<div class="content-list-text">1.VMware Workstation 11</div>
</li>
<li class="exp-content-list list-item-2">
<div class="content-list-text">2.unlocker 203（for OS X 插件补丁）</div>
</li>
<li class="exp-content-list list-item-3">
<div class="content-list-text">3.Mac OS X 10.10镜像</div>
</li>
</ul>
</div>
</div>
<h2 class="exp-content-head"><a name="section-3"></a> 方法/步骤</h2>
<ol class="exp-conent-orderlist">
<li class="exp-content-list list-item-1">
<div class="content-list-text">
<p>有图有真相，哈哈</p>
</div>
<div class="content-list-media">
<div class="content-list-image clearfix"><a class="exp-image-wraper" href="http://jingyan.baidu.com/album/ff411625b9011212e48237b4.html?picindex=1" target="_self"> <img class="exp-image-default" src="http://f.hiphotos.baidu.com/exp/w=500/sign=5e8b15d7dec451daf6f60ceb86fc52a5/b64543a98226cffc5b49323bba014a90f703eadc.jpg" alt="VMware 11安装Mac OS X 10.10" /> </a></div>
</div>
</li>
<li class="exp-content-list list-item-2">
<div class="content-list-text">
<p>一、下载以上文件</p>
<p>1. 百度软件下载即可</p>
<p>2. unlocker 203       链接：http://pan.baidu.com/s/1o6iI9tg  密码：km1c</p>
<p>3. Mac OS X 10.10镜像     链接：http://pan.baidu.com/s/1sj4ri5R 密码：y86w</p>
</div>
</li>
<li class="exp-content-list list-item-3">
<div class="content-list-text">
<p>二、基本步骤</p>
<p>1.虚拟机的安装</p>
<p>下载Vmare Workstation，以管理员身份运行，安装，一直下一步即可。VM安装好后，注册码百度一大堆。</p>
</div>
</li>
<li class="exp-content-list list-item-4">
<div class="content-list-text">
<p>2.插件安装</p>
<p>步骤一完成后，打开任务管理器，找到服务项，选择按名称排序，将框中四项全部停止运行。</p>
<p>然后打开下载的插件，解压unlock203.zip文件，找到 unlock203\win-install.cmd，右键以管理员身份运行，等待运行完即可。（完成这一步vmware才能识别OS X）。</p>
</div>
<div class="content-list-media">
<div class="content-list-image clearfix"><a class="exp-image-wraper" href="http://jingyan.baidu.com/album/ff411625b9011212e48237b4.html?picindex=2" target="_self"> <img class="exp-image-default" src="http://g.hiphotos.baidu.com/exp/w=500/sign=9558ed5e35d12f2ece05ae607fc3d5ff/9d82d158ccbf6c816ebea061bf3eb13532fa40aa.jpg" alt="VMware 11安装Mac OS X 10.10" /> </a></div>
</div>
</li>
<li class="exp-content-list list-item-5">
<div class="content-list-text">
<p>3.Mac OS X 10.10的载入</p>
<p>相信你以上步骤已做好了，开启下面旅程吧。基本都是图片，所以很容易，just follow。</p>
</div>
<div class="content-list-media">
<div class="content-list-image clearfix"><a class="exp-image-wraper" href="http://jingyan.baidu.com/album/ff411625b9011212e48237b4.html?picindex=3" target="_self"> <img class="exp-image-default" src="http://d.hiphotos.baidu.com/exp/w=500/sign=cc98c4880955b3199cf9827573a88286/1c950a7b02087bf4698adf60f1d3572c10dfcfd1.jpg" alt="VMware 11安装Mac OS X 10.10" /> </a></div>
<div class="content-list-image clearfix"><a class="exp-image-wraper" href="http://jingyan.baidu.com/album/ff411625b9011212e48237b4.html?picindex=4" target="_self"> <img class="exp-image-default" src="http://c.hiphotos.baidu.com/exp/w=500/sign=e87d72451d178a82ce3c7fa0c602737f/562c11dfa9ec8a13097cdf69f403918fa1ecc0d1.jpg" alt="VMware 11安装Mac OS X 10.10" /> </a></div>
<div class="content-list-image clearfix"><a class="exp-image-wraper" href="http://jingyan.baidu.com/album/ff411625b9011212e48237b4.html?picindex=5" target="_self"> <img class="exp-image-default" src="http://h.hiphotos.baidu.com/exp/w=500/sign=8c9f0afc40a98226b8c12b27ba83b97a/0bd162d9f2d3572c768414558913632763d0c3d1.jpg" alt="VMware 11安装Mac OS X 10.10" /> </a></div>
<div class="content-list-image clearfix"><a class="exp-image-wraper" href="http://jingyan.baidu.com/album/ff411625b9011212e48237b4.html?picindex=6" target="_self"> <img class="exp-image-default" src="http://h.hiphotos.baidu.com/exp/w=500/sign=f5ba4aba928fa0ec7fc7640d1696594a/359b033b5bb5c9ea82a48b6ad639b6003bf3b3e0.jpg" alt="VMware 11安装Mac OS X 10.10" /> </a></div>
<div class="content-list-image clearfix"><a class="exp-image-wraper" href="http://jingyan.baidu.com/album/ff411625b9011212e48237b4.html?picindex=7" target="_self"> <img class="exp-image-default" src="http://g.hiphotos.baidu.com/exp/w=500/sign=f54ddf69f403918fd7d13dca613c264b/2934349b033b5bb55f80a87735d3d539b700bce0.jpg" alt="VMware 11安装Mac OS X 10.10" /> </a></div>
<div class="content-list-image clearfix"><a class="exp-image-wraper" href="http://jingyan.baidu.com/album/ff411625b9011212e48237b4.html?picindex=8" target="_self"> <img class="exp-image-default" src="http://e.hiphotos.baidu.com/exp/w=500/sign=f78f0ea58401a18bf0eb124fae2e0761/4e4a20a4462309f7ec09259b710e0cf3d6cad6d1.jpg" alt="VMware 11安装Mac OS X 10.10" /> </a></div>
</div>
</li>
<li class="exp-content-list list-item-6">
<div class="content-list-text">
<p>4.开启安装</p>
<p>我遇到了如下问题，百度后知道 出现这种情况，只要找到并打开安装目录下的 XXXX.vmx 文件，使用记事本打开后，在 smc.present = &#8220;TRUE&#8221; 后添加“smc.version = 0”(建议您复制，不包括引号)后保存，问题即可解决。</p>
<p>重新启动</p>
</div>
<div class="content-list-media">
<div class="content-list-image clearfix"><a class="exp-image-wraper" href="http://jingyan.baidu.com/album/ff411625b9011212e48237b4.html?picindex=9" target="_self"> <img class="exp-image-default" src="http://e.hiphotos.baidu.com/exp/w=500/sign=c7a30de8fb1986184147ef847aec2e69/503d269759ee3d6d21430f4240166d224e4adeb6.jpg" alt="VMware 11安装Mac OS X 10.10" /> </a></div>
<div class="content-list-image clearfix"><a class="exp-image-wraper" href="http://jingyan.baidu.com/album/ff411625b9011212e48237b4.html?picindex=10" target="_self"> <img class="exp-image-default" src="http://h.hiphotos.baidu.com/exp/w=500/sign=f8d699c69d2f07085f052a00d925b865/91529822720e0cf3a8cac5720946f21fbe09aa7e.jpg" alt="VMware 11安装Mac OS X 10.10" /> </a></div>
<div class="content-list-image clearfix"><a class="exp-image-wraper" href="http://jingyan.baidu.com/album/ff411625b9011212e48237b4.html?picindex=11" target="_self"> <img class="exp-image-default" src="http://g.hiphotos.baidu.com/exp/w=500/sign=acdbefb6daf9d72a1764101de42b282a/77094b36acaf2edd155bc2608e1001e938019395.jpg" alt="VMware 11安装Mac OS X 10.10" /> </a></div>
</div>
</li>
<li class="exp-content-list list-item-7">
<div class="content-list-text">
<p>5.just follow。。。。。。。。。。</p>
<p>&nbsp;</p>
</div>
<div class="content-list-media">
<div class="content-list-image clearfix"><a class="exp-image-wraper" href="http://jingyan.baidu.com/album/ff411625b9011212e48237b4.html?picindex=12" target="_self"> <img class="exp-image-default" src="http://e.hiphotos.baidu.com/exp/w=500/sign=8ccc39a1357adab43dd01b43bbd5b36b/58ee3d6d55fbb2fb37c3d29b4c4a20a44723dc4b.jpg" alt="VMware 11安装Mac OS X 10.10" /> </a></div>
<div class="content-list-image clearfix"><a class="exp-image-wraper" href="http://jingyan.baidu.com/album/ff411625b9011212e48237b4.html?picindex=13" target="_self"> <img class="exp-image-default" src="http://c.hiphotos.baidu.com/exp/w=500/sign=bcbf99573e6d55fbc5c676265d234f40/d439b6003af33a877378f593c55c10385343b526.jpg" alt="VMware 11安装Mac OS X 10.10" /> </a></div>
<div class="content-list-image clearfix"><a class="exp-image-wraper" href="http://jingyan.baidu.com/album/ff411625b9011212e48237b4.html?picindex=14" target="_self"> <img class="exp-image-default" src="http://d.hiphotos.baidu.com/exp/w=500/sign=e50bc94e93529822053339c3e7cb7b3b/faf2b2119313b07e69a8a5810fd7912397dd8c26.jpg" alt="VMware 11安装Mac OS X 10.10" /> </a></div>
<div class="content-list-image clearfix"><a class="exp-image-wraper" href="http://jingyan.baidu.com/album/ff411625b9011212e48237b4.html?picindex=15" target="_self"> <img class="exp-image-default" src="http://g.hiphotos.baidu.com/exp/w=500/sign=8b880baa4a540923aa69637ea259d1dc/738b4710b912c8fcc5f70344ff039245d6882136.jpg" alt="VMware 11安装Mac OS X 10.10" /> </a></div>
</div>
</li>
<li class="exp-content-list list-item-8">
<div class="content-list-text">
<p>然后点击左上角的磁盘工具，选择退出磁盘工具。然后在安装界面点击继续,再点击安装，，，，静待佳音，，，，，，，，，，，，，，可以干点别的、、、、、、、、、、、、、、、、、、以后就是初次进入系统的配置了（省略一千字）</p>
</div>
</li>
<li class="exp-content-list list-item-9">
<div class="content-list-text">
<p>6.VMTool以及Darwin6.0.3的安装 以及共享文件夹。</p>
<p>以下是网上OS X 10.9的图，10.10也是一样的just follow。。。。。。。。。。</p>
<p>共享文件夹的说明：由于虚拟机无法访问本机的硬盘，所以需要设置共享文件夹来方便虚拟机读取电脑的物理内存。</p>
</div>
<div class="content-list-media">
<div class="content-list-image clearfix"><a class="exp-image-wraper" href="http://jingyan.baidu.com/album/ff411625b9011212e48237b4.html?picindex=16" target="_self"> <img class="exp-image-default" src="http://g.hiphotos.baidu.com/exp/w=500/sign=ab3ace6e922397ddd67998046983b216/ae51f3deb48f8c545aec32a639292df5e0fe7f78.jpg" alt="VMware 11安装Mac OS X 10.10" /> </a></div>
<div class="content-list-image clearfix"><a class="exp-image-wraper" href="http://jingyan.baidu.com/album/ff411625b9011212e48237b4.html?picindex=17" target="_self"> <img class="exp-image-default" src="http://c.hiphotos.baidu.com/exp/w=500/sign=f100cb6861d9f2d3201124ef99ee8a53/eaf81a4c510fd9f95ddea1e0262dd42a2934a46a.jpg" alt="VMware 11安装Mac OS X 10.10" /> </a></div>
<div class="content-list-image clearfix"><a class="exp-image-wraper" href="http://jingyan.baidu.com/album/ff411625b9011212e48237b4.html?picindex=18" target="_self"> <img class="exp-image-default" src="http://h.hiphotos.baidu.com/exp/w=500/sign=56e672a2b351f819f125034aeab64a76/09fa513d269759ee52999442b1fb43166c22df6a.jpg" alt="VMware 11安装Mac OS X 10.10" /> </a></div>
<div class="content-list-image clearfix"><a class="exp-image-wraper" href="http://jingyan.baidu.com/album/ff411625b9011212e48237b4.html?picindex=19" target="_self"> <img class="exp-image-default" src="http://h.hiphotos.baidu.com/exp/w=500/sign=c494cd8a8444ebf86d71643fe9fbd736/d1a20cf431adcbefd9fd8a8fafaf2edda2cc9f6a.jpg" alt="VMware 11安装Mac OS X 10.10" /> </a></div>
<div class="content-list-image clearfix"><a class="exp-image-wraper" href="http://jingyan.baidu.com/album/ff411625b9011212e48237b4.html?picindex=20" target="_self"> <img class="exp-image-default" src="http://f.hiphotos.baidu.com/exp/w=500/sign=e641085316ce36d3a20483300af13a24/b90e7bec54e736d192da788198504fc2d462696a.jpg" alt="VMware 11安装Mac OS X 10.10" /> </a></div>
<div class="content-list-image clearfix"><a class="exp-image-wraper" href="http://jingyan.baidu.com/album/ff411625b9011212e48237b4.html?picindex=21" target="_self"> <img class="exp-image-default" src="http://b.hiphotos.baidu.com/exp/w=500/sign=d4a197f79158d109c4e3a9b2e15accd0/c2cec3fdfc039245df7d15868494a4c27c1e256a.jpg" alt="VMware 11安装Mac OS X 10.10" /> </a></div>
<div class="content-list-image clearfix"><a class="exp-image-wraper" href="http://jingyan.baidu.com/album/ff411625b9011212e48237b4.html?picindex=22" target="_self"> <img class="exp-image-default" src="http://a.hiphotos.baidu.com/exp/w=500/sign=f8090277c0fdfc03e578e3b8e43d87a9/a50f4bfbfbedab6433bab949f436afc378311e6a.jpg" alt="VMware 11安装Mac OS X 10.10" /> </a></div>
<div class="content-list-image clearfix"><a class="exp-image-wraper" href="http://jingyan.baidu.com/album/ff411625b9011212e48237b4.html?picindex=23" target="_self"> <img class="exp-image-default" src="http://b.hiphotos.baidu.com/exp/w=500/sign=867308ae7c3e6709be0045ff0bc59fb8/34fae6cd7b899e512e46ce9d41a7d933c9950d6a.jpg" alt="VMware 11安装Mac OS X 10.10" /> </a></div>
<div class="content-list-image clearfix"><a class="exp-image-wraper" href="http://jingyan.baidu.com/album/ff411625b9011212e48237b4.html?picindex=24" target="_self"> <img class="exp-image-default" src="http://h.hiphotos.baidu.com/exp/w=500/sign=dbf6f314c8ef76093c0b999f1edca301/9825bc315c6034a889dd4f08c813495409237678.jpg" alt="VMware 11安装Mac OS X 10.10" /> </a></div>
</div>
</li>
<li class="exp-content-list list-item-10">
<div class="list-icon" style="visibility: visible;">10</div>
<div class="content-list-text">
<p>博主是不是很用心呢，嘿嘿，</p>
<p>当然要感谢网上已经提供的思路，赞一个</p>
<p>http://jingyan.baidu.com/article/ff411625b9011212e48237b4.html?qq-pf-to=pcqq.group</p>
</div>
</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=1337</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Postfix+Dovecot+MySQL搭建邮件服务器</title>
		<link>https://www.softwareace.cn/?p=1325</link>
		<comments>https://www.softwareace.cn/?p=1325#comments</comments>
		<pubDate>Fri, 15 May 2015 03:44:23 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[系统]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=1325</guid>
		<description><![CDATA[网上有很多使用Postfix搭建邮件服务器的文章，但目前貌似没有看到较为完整的一篇。本例将尝试在Ubuntu系 [&#8230;]]]></description>
				<content:encoded><![CDATA[<p><span style="color: #000000;">网上有很多使用Postfix搭建邮件服务器的文章，但目前貌似没有看到较为完整的一篇。本例将尝试在Ubuntu系统中使用Postfix+Dovecot+MySQL搭建邮件服务器。</span></p>
<div class="BlogAnchor" style="color: #000000;">
<p style="color: #15a230;"><span id="AnchorContentToggle" class="corner" style="color: #ffffff;" title="点击收起目录">目录[-]</span></p>
<div id="AnchorContent" class="AnchorContent">
<ul>
<li class="osc_h2"><a style="color: #4466bb;" href="http://my.oschina.net/baratsemet/blog/413923#OSC_h2_1">开始之前</a></li>
<li class="osc_h2"><a style="color: #4466bb;" href="http://my.oschina.net/baratsemet/blog/413923#OSC_h2_2">工作原理</a></li>
<li class="osc_h3"><a style="color: #4466bb;" href="http://my.oschina.net/baratsemet/blog/413923#OSC_h3_3">服务器接收邮件的过程</a></li>
<li class="osc_h3"><a style="color: #4466bb;" href="http://my.oschina.net/baratsemet/blog/413923#OSC_h3_4">用户查收邮件的过程</a></li>
<li class="osc_h3"><a style="color: #4466bb;" href="http://my.oschina.net/baratsemet/blog/413923#OSC_h3_5">用户发送邮件的过程</a></li>
<li class="osc_h2"><a style="color: #4466bb;" href="http://my.oschina.net/baratsemet/blog/413923#OSC_h2_6">DNS配置</a></li>
<li class="osc_h2"><a style="color: #4466bb;" href="http://my.oschina.net/baratsemet/blog/413923#OSC_h2_7">SSL证书</a></li>
<li class="osc_h2"><a style="color: #4466bb;" href="http://my.oschina.net/baratsemet/blog/413923#OSC_h2_8">修改hostname</a></li>
<li class="osc_h2"><a style="color: #4466bb;" href="http://my.oschina.net/baratsemet/blog/413923#OSC_h2_9">MySQL安装及配置</a></li>
<li class="osc_h3"><a style="color: #4466bb;" href="http://my.oschina.net/baratsemet/blog/413923#OSC_h3_10">MySQL安装</a></li>
<li class="osc_h3"><a style="color: #4466bb;" href="http://my.oschina.net/baratsemet/blog/413923#OSC_h3_11">新建数据库及用户</a></li>
<li class="osc_h3"><a style="color: #4466bb;" href="http://my.oschina.net/baratsemet/blog/413923#OSC_h3_12">新建表格</a></li>
<li class="osc_h3"><a style="color: #4466bb;" href="http://my.oschina.net/baratsemet/blog/413923#OSC_h3_13">插入数据</a></li>
<li class="osc_h3"><a style="color: #4466bb;" href="http://my.oschina.net/baratsemet/blog/413923#OSC_h3_14">测试数据</a></li>
<li class="osc_h2"><a style="color: #4466bb;" href="http://my.oschina.net/baratsemet/blog/413923#OSC_h2_15">Postfix安装及配置</a></li>
<li class="osc_h3"><a style="color: #4466bb;" href="http://my.oschina.net/baratsemet/blog/413923#OSC_h3_16">Postfix的安装</a></li>
<li class="osc_h3"><a style="color: #4466bb;" href="http://my.oschina.net/baratsemet/blog/413923#OSC_h3_17">Postfix的配置</a></li>
<li class="osc_h2"><a style="color: #4466bb;" href="http://my.oschina.net/baratsemet/blog/413923#OSC_h2_18">Dovecot安装及配置</a></li>
<li class="osc_h3"><a style="color: #4466bb;" href="http://my.oschina.net/baratsemet/blog/413923#OSC_h3_19">Dovecot的安装</a></li>
<li class="osc_h3"><a style="color: #4466bb;" href="http://my.oschina.net/baratsemet/blog/413923#OSC_h3_20">Dovecot的配置</a></li>
<li class="osc_h3"><a style="color: #4466bb;" href="http://my.oschina.net/baratsemet/blog/413923#OSC_h3_21">修改/etc/dovecot/dovecot.conf文件</a></li>
<li class="osc_h3"><a style="color: #4466bb;" href="http://my.oschina.net/baratsemet/blog/413923#OSC_h3_22">修改/etc/dovecot/conf.d/10-mail.conf文件</a></li>
<li class="osc_h3"><a style="color: #4466bb;" href="http://my.oschina.net/baratsemet/blog/413923#OSC_h3_23">修改/etc/dovecot/conf.d/10-auth.conf文件</a></li>
<li class="osc_h3"><a style="color: #4466bb;" href="http://my.oschina.net/baratsemet/blog/413923#OSC_h3_24">修改/etc/dovecot/conf.d/auth-sql.conf.ext文件</a></li>
<li class="osc_h3"><a style="color: #4466bb;" href="http://my.oschina.net/baratsemet/blog/413923#OSC_h3_25">修改/etc/dovecot/dovecot-sql.conf.ext文件</a></li>
<li class="osc_h3"><a style="color: #4466bb;" href="http://my.oschina.net/baratsemet/blog/413923#OSC_h3_26">修改/etc/dovecot/conf.d/10-master.conf文件</a></li>
<li class="osc_h3"><a style="color: #4466bb;" href="http://my.oschina.net/baratsemet/blog/413923#OSC_h3_27">修改/etc/dovecot/conf.d/10-ssl.conf文件</a></li>
<li class="osc_h2"><a style="color: #4466bb;" href="http://my.oschina.net/baratsemet/blog/413923#OSC_h2_28">测试邮件服务器是否正常</a></li>
</ul>
</div>
</div>
<div class="BlogContent">
<p>说到邮件服务器，网上有许多不同解决方案。Window操作系统下常见的邮件服务器有<a style="color: #ff8373;" href="http://https//www.hmailserver.com/" rel="nofollow">hMailServer</a>、<a style="color: #ff8373;" href="http://www.mailenable.com/" rel="nofollow">MailEnable</a>、<a style="color: #ff8373;" href="http://www.evomailserver.com/" rel="nofollow">EVOMailServer</a>、<a style="color: #ff8373;" href="http://james.apache.org/" rel="nofollow">Apache James(纯Java跨平台)</a>等。</p>
<p>而在Linux/Unix系统中常用的邮件服务器也有不少选择，最经典也是最常见的莫过于Postfix。这篇文章将会讲述如何在Ubuntu系统之下，通过<a style="color: #ff8373;" href="http://www.postfix.org/" rel="nofollow">Postfix</a>、<a style="color: #ff8373;" href="http://www.dovecot.org/" rel="nofollow">Dovecot</a>、<a style="color: #ff8373;" href="https://www.mysql.com/" rel="nofollow">MySQL</a>整合实现普通意义上「邮件服务器」的大部分功能。</p>
<p><span id="OSC_h2_1"></span></p>
<h2>开始之前</h2>
<p>配置邮件服务器并不是一项简单的工作，其过程不仅需要一定的技术能力，同时也需要大家具有一定的耐心，同时也需要大家非常细心。为了能够「看懂」并「最终实践」这篇文章，大家还需要了解或掌握以下知识：</p>
<ul>
<li><strong>Postfix:</strong> 是一个标准的MTA「Mail Transfer Agent」服务器，它负责通过SMTP协议管理发送到本机的邮件以及由本机发向外界的邮件。在本例中，Postfix会把邮件的本地投递工作「接受到邮件之后将邮件存档到本地磁盘」交给Dovecot的LMTP服务「Local Mail Transfer Protocol service」处理。当然，当大家想通过服务器向外界发送邮件时，Postfix还将负责验证权限以确保服务器不被滥用。「很多邮件服务器根本没有对SMTP做用户验证，这将导致任何匿名用户都可以通过服务器向外界发送邮件，从而使得服务器变成垃圾中转站」</li>
<li><strong>Dovecot:</strong> 是一个非常优秀的IMAP/POP服务器用以接收外界发送到本机的邮件。通常，Dovecot的工作内容包括：验证用户身份以确保邮件不会被泄露。在本例中，Dovecot将负责所有的「身份验证」工作，我们会配置Dovecot查询本地的MySQL数据库以确认用户身份</li>
<li><strong>MySQL:</strong> 不必多说，它将存储所有的用户信息，其中包括：需要监听的域名信息、用户邮箱地址、登录密码、邮箱别名「alias」等</li>
<li><strong>Ubuntu:</strong> 本例中的OS将选择Ubuntu14.10作为标准，其他Linux发行版的相关操作不在描述</li>
</ul>
<p><span id="OSC_h2_2"></span></p>
<h2>工作原理</h2>
<p><span id="OSC_h3_3"></span></p>
<h3>服务器接收邮件的过程</h3>
<p>在开始讲述本例的内容之前，我们先来看看Postfix+Dovecot+MySQL是如何相互协作以实现邮件服务器的各项功能。我们假设 张三通过oschina.net的邮箱<code style="color: #40aa53;">zhangsan@oschina.net</code> 发送一份邮件给 李四<code style="color: #40aa53;">lisi@mydomain.com</code>，则服务器接收邮件的过程大致如下图所示：</p>
<p><a style="color: #ff8373;" href="http://static.oschina.net/uploads/space/2015/0511/165916_Tmyl_2340783.png" target="_blank"><img src="http://static.oschina.net/uploads/space/2015/0511/165916_Tmyl_2340783.png" alt="imcoming mail" /></a></p>
<ol>
<li><code style="color: #40aa53;">zhangsan@oschina.net</code>发送邮件到<code style="color: #40aa53;">lisi@mydomain.com</code></li>
<li>oschina.net服务器会通过DNS查询mydomain.com的MX记录并找到Postfix所在的服务器</li>
<li>邮件被发送给Postfix</li>
<li>Postfix转向MySQL求助，以查询mydomain.com是不是需要处理的域名</li>
<li>MySQL返回确认信息给Postfix</li>
<li>Postfix将接受到的邮件投递给Dovecot的LMTP服务以便做处理</li>
<li>Dovecot将邮件内容保存到<code style="color: #40aa53;">lisi@mydomain.com</code>用户对应的磁盘路径</li>
</ol>
<p><span id="OSC_h3_4"></span></p>
<h3>用户查收邮件的过程</h3>
<p>上述例子中我们看到了服务器接收邮件的过程，接下来我们看看，当大家通过用户名密码登录邮箱查看邮件时，会发生什么事情：</p>
<p><a style="color: #ff8373;" href="http://static.oschina.net/uploads/space/2015/0511/184339_NEpI_2340783.png" target="_blank"><img src="http://static.oschina.net/uploads/space/2015/0511/184339_NEpI_2340783.png" alt="checking mail" /></a></p>
<ol>
<li>邮件客户端 to Dovecot：尊敬的Dovecot大人，您好！我阔以建立一个IMAP加密连接吗？</li>
<li>Dovecot to 邮件客户端：当然阔以。这是我的SSL证书，请您告诉我帐号和密码！</li>
<li>邮件客户端 to Dovecot：好滴！这是我的用户名和密码，千万不要告诉别人哦！</li>
<li>Dovecot to MySQL：Hi 美女！请问下，这个用户名和密码是正确的嘛？</li>
<li>MySQL to Dovecot：好的，请稍后！呃……这个用户名和密码是正确的哦！</li>
<li>Dovecot打开存放在本地磁盘/var/mail/mydomain.com/llisi的mailbox</li>
<li>Dovecot获取到最新的邮件及其他相关信息</li>
<li>Dovecot将邮件及其相关的其他信息通过IMAP协议发送给客户端</li>
</ol>
<p><span id="OSC_h3_5"></span></p>
<h3>用户发送邮件的过程</h3>
<p>查收了最新的邮件之后，李四<code style="color: #40aa53;">lisi@mydomain.com</code>发现张三给他发来了邮件。现在，李四回复一封邮件给张三，会发生什么事情：</p>
<p><a style="color: #ff8373;" href="http://static.oschina.net/uploads/space/2015/0511/192105_DpWe_2340783.png" target="_blank"><img src="http://static.oschina.net/uploads/space/2015/0511/192105_DpWe_2340783.png" alt="sending mail" /></a></p>
<ol>
<li>邮件客户端 to Postfix：尊敬的Postfix大人，您好！我阔以建立一个安全的SMTP连接嘛？</li>
<li>Postfix to 邮件客户端：说人话！可以就是可以，干嘛要说「阔以」啊！你丫贱啊，找抽啊！想建立SMTP连接可以，不过要加密。这是我的SSL证书，告诉我你的帐号和密码，你个贱人！</li>
<li>邮件客户端 to Postfix：对不起，大人，我错鸟！这是我的帐号和密码，不要告诉别人哦！</li>
<li>Postfix to Dovecot：Hi 帅哥，帮我查一下这个帐号和密码！</li>
<li>Dovecot to MySQL：Hi 美女，这个帐号和密码是正确的呢？！还是正确的呢？！还是……</li>
<li>MySQL to Dovecot：好啦，你乖啦！我查过啦，这个帐号密码是正确的啦！表卖萌哦，Dovecot君！</li>
<li>Dovecot to Postfix：大锅，则个帐号密码斯正缺滴！</li>
<li>Postfix to 邮件客户端：贱人，过来！你给的帐号密码是正确的，允许你发送邮件！</li>
<li>邮件客户端将编写好的邮件通过SMTP协议发送给Postfix</li>
<li>Postfix将收到的邮件转发给对方</li>
</ol>
<p>以上，大家已经看到邮件收、发的整个过程。接下来看看如何才能成功配置邮件服务器。</p>
<p><span id="OSC_h2_6"></span></p>
<h2>DNS配置</h2>
<p>首先，你需要有一个域名。本例中假定我们的域名为<code style="color: #40aa53;">mydomain.com</code>，以此为基础去做后续的所有工作。<strong>请注意：在DNS相关配置没有成功之前，请勿尝试后续的操作。即使你配置好了Postifx，只要DNS相关配置没有成功，邮件服务器一样不能正常工作。</strong></p>
<p>其次，登录域名管理系统「强烈推荐使用<a style="color: #ff8373;" href="https://www.dnspod.cn/" rel="nofollow">DNSPod</a>做域名管理」，新增几条MX记录指向你的邮件服务器。</p>
<p>第三，关于TTL设置。在测试邮件服务器的过程中，大家大可把TTL时间设置的短一点，这样可以让DNS服务器在很短的时间之内就起作用。当测试阶段过后，请即使将TTL时间设置成较大的值。什么？你问为什么要这样？自己去Google一下看看吧！TTL设置的太短会带来什么安全隐患。</p>
<p>设置完以后，DNS的MX记录及TTL时间大致如下：</p><pre class="crayon-plain-tag">mydomain&lt;span class=&quot;hljs-class&quot;&gt;.com&lt;/span&gt;         MX     &lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;10&lt;/span&gt;      mydomain&lt;span class=&quot;hljs-class&quot;&gt;.com&lt;/span&gt;    
mydomain&lt;span class=&quot;hljs-class&quot;&gt;.com&lt;/span&gt;            MX      &lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;10&lt;/span&gt;      &lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;12.34&lt;/span&gt;.&lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;56.78&lt;/span&gt;  
mail&lt;span class=&quot;hljs-class&quot;&gt;.mydomain&lt;/span&gt;&lt;span class=&quot;hljs-class&quot;&gt;.com&lt;/span&gt;    MX     &lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;10&lt;/span&gt;      &lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;12.34&lt;/span&gt;.&lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;56.78&lt;/span&gt;</pre><p><span id="OSC_h2_7"></span></p>
<h2>SSL证书</h2>
<p>关于SSL认证的问题，大家可以根据自己的情况做决定。有人偏向于购买第三方权威的SSL认证，也有人使用OpenSSL自己制作签名。当然，上述两种方法本质上是没有什么区别的，唯一的区别在于：如果是自己制作的SSL证书，大部分的邮件客户端都会弹出提示框询问是否信任等。</p>
<p><span id="OSC_h2_8"></span></p>
<h2>修改hostname</h2>
<p>哈，终于进入了正题。现在，请大家打开终端「window系统用户可以选择使用putty等ssh工具连接服务器」并连接自己的服务器。</p><pre class="crayon-plain-tag">&lt;span class=&quot;hljs-title&quot; style=&quot;color: #e28964;&quot;&gt;ssh&lt;/span&gt; username@&lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;12.34.56.78&lt;/span&gt;</pre><p>连接成功以后，请第一时间执行下述命令切换到root用户：</p><pre class="crayon-plain-tag">sudo &lt;span class=&quot;hljs-operator&quot;&gt;-s&lt;/span&gt;</pre><p></p>
<blockquote><p><strong>请注意</strong><br />
为什么要切换到root用户？纯属个人爱好，因为我很懒，懒得每次执行命令时在命令的前面带上<code style="color: #40aa53;">sudo</code>这样的参数，因此直接切换到root用户好了。</p></blockquote>
<p>接下来，在命令行中输入如下命令查看hostname：</p><pre class="crayon-plain-tag">&lt;span class=&quot;hljs-title&quot; style=&quot;color: #e28964;&quot;&gt;hostname&lt;/span&gt;</pre><p>接着，在命令行输入如下命令查看FQDN「fully-qualified domain name」：</p><pre class="crayon-plain-tag">hostname &lt;span class=&quot;hljs-operator&quot;&gt;-f&lt;/span&gt;</pre><p>将上述两个名称记录下来，安装postfix时你将会使用到。</p>
<p>当然，上述的机器名是可以随时修改的，如果你想要修改，可以直接通过vi编辑器打开<code style="color: #40aa53;">/etc/hostname</code>文件，并将自己想要的机器名写入其中并保存即可</p>
<p><span id="OSC_h2_9"></span></p>
<h2>MySQL安装及配置</h2>
<p>本例中我们使用MySQL数据库保存Postfix需要服务的虚拟域名、用户帐号及密码、邮件别名三个重要的信息。</p>
<blockquote><p><strong>请注意：</strong><br />
其实Postfix和Dovecot是完全可以不使用数据库的，二者都可以通过各种配置文件完成「零数据库」的邮件服务器。但是，既然可以使用数据库这么方便，为什么不用呢？将这些需要配置的信息存储在数据库中「如：用户帐号及密码等」，对今后的维护来说是非常方便的事情。不是么？！</p></blockquote>
<p><span id="OSC_h3_10"></span></p>
<h3>MySQL安装</h3>
<p>在Ubuntu种安装软件，是再简单不过的事情了。安装MySQL请在命令行中执行如下命令：</p><pre class="crayon-plain-tag">apt-get &lt;span class=&quot;hljs-operator&quot;&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;install&lt;/span&gt; mysql-&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;server&lt;/span&gt;
&lt;/span&gt;</pre><p>安装过程中会需要你输入两次MySQL的root口令，请牢记该口令</p>
<p><a style="color: #ff8373;" href="http://static.oschina.net/uploads/space/2015/0511/195225_PcQr_2340783.png" target="_blank"><img src="http://static.oschina.net/uploads/space/2015/0511/195225_PcQr_2340783.png" alt="MySQL install" /></a></p>
<p><span id="OSC_h3_11"></span></p>
<h3>新建数据库及用户</h3>
<p>接下来，我们需要新建一个MySQL用户及一个数据库：</p>
<ol>
<li>使用root口令登录MySQL<br />
<pre class="crayon-plain-tag">mysql -u root -&lt;span class=&quot;hljs-tag&quot; style=&quot;color: #89bdff;&quot;&gt;p&lt;/span&gt;</pre>
</li>
<li>输入root口令</li>
<li>新建一个数据库，名称叫做mailserver：<br />
<pre class="crayon-plain-tag">&lt;span class=&quot;hljs-operator&quot;&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;create&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;database&lt;/span&gt; mailserver &lt;span class=&quot;hljs-built_in&quot;&gt;character&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;set&lt;/span&gt; utf8;&lt;/span&gt;</pre>
</li>
<li>输入如下命令以新建一个用户mailserver，并指定密码为mailserver123：<br />
<pre class="crayon-plain-tag">&lt;span class=&quot;hljs-operator&quot;&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;create&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;user&lt;/span&gt; mailserver@&lt;span class=&quot;hljs-string&quot; style=&quot;color: #65b042;&quot;&gt;'localhost'&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;identified&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;by&lt;/span&gt; &lt;span class=&quot;hljs-string&quot; style=&quot;color: #65b042;&quot;&gt;'mailserver123'&lt;/span&gt;;&lt;/span&gt;</pre>
</li>
<li>将数据库mailserver的所有权限赋给用户mailserver：<br />
<pre class="crayon-plain-tag">&lt;span class=&quot;hljs-operator&quot;&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;grant&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;all&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;on&lt;/span&gt; mailserver.* &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;to&lt;/span&gt; mailserver@&lt;span class=&quot;hljs-string&quot; style=&quot;color: #65b042;&quot;&gt;'localhost'&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;identified&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;by&lt;/span&gt; &lt;span class=&quot;hljs-string&quot; style=&quot;color: #65b042;&quot;&gt;'mailserver123'&lt;/span&gt;;&lt;/span&gt;</pre>
</li>
<li>退出root用户：<br />
<pre class="crayon-plain-tag">&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;exit&lt;/span&gt;;</pre>
</li>
<li>使用mailserver用户登录：<br />
<pre class="crayon-plain-tag">mysql -u mailserver -&lt;span class=&quot;hljs-tag&quot; style=&quot;color: #89bdff;&quot;&gt;p&lt;/span&gt;</pre>
</li>
<li>输入mailserver帐号的口令</li>
<li>将默认数据库切换为mailserver数据库：<br />
<pre class="crayon-plain-tag">&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;hljs-title&quot; style=&quot;color: #89bdff;&quot;&gt;mailserver&lt;/span&gt;;</pre>
</li>
</ol>
<p><span id="OSC_h3_12"></span></p>
<h3>新建表格</h3>
<ol>
<li>输入如下SQL语句以新建<code style="color: #40aa53;">virtual_domains</code>表，该表是本地服务器用以接收邮件的域名：<br />
<pre class="crayon-plain-tag">&lt;span class=&quot;hljs-operator&quot;&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;CREATE&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;TABLE&lt;/span&gt; &lt;span class=&quot;hljs-string&quot; style=&quot;color: #65b042;&quot;&gt;`virtual_domains`&lt;/span&gt; (  
  &lt;span class=&quot;hljs-string&quot; style=&quot;color: #65b042;&quot;&gt;`id`&lt;/span&gt; &lt;span class=&quot;hljs-built_in&quot;&gt;int&lt;/span&gt;(&lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;11&lt;/span&gt;) &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;NOT&lt;/span&gt; &lt;span class=&quot;hljs-literal&quot;&gt;NULL&lt;/span&gt; auto_increment,  
  &lt;span class=&quot;hljs-string&quot; style=&quot;color: #65b042;&quot;&gt;`name`&lt;/span&gt; &lt;span class=&quot;hljs-built_in&quot;&gt;varchar&lt;/span&gt;(&lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;50&lt;/span&gt;) &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;NOT&lt;/span&gt; &lt;span class=&quot;hljs-literal&quot;&gt;NULL&lt;/span&gt;,  
  &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;PRIMARY&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;KEY&lt;/span&gt; (&lt;span class=&quot;hljs-string&quot; style=&quot;color: #65b042;&quot;&gt;`id`&lt;/span&gt;))  
  &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;ENGINE&lt;/span&gt;=&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;InnoDB&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;DEFAULT&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;CHARSET&lt;/span&gt;=utf8;&lt;/span&gt;</pre>
</li>
<li>输入如下SQL语句以新建<code style="color: #40aa53;">virtual_users</code>表，该表邮件服务器的终端用户表，记录用户的邮件地址及密码「千万不要保存明文密码」：<br />
<pre class="crayon-plain-tag">&lt;span class=&quot;hljs-operator&quot;&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;CREATE&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;TABLE&lt;/span&gt; &lt;span class=&quot;hljs-string&quot; style=&quot;color: #65b042;&quot;&gt;`virtual_users`&lt;/span&gt; (  
&lt;span class=&quot;hljs-string&quot; style=&quot;color: #65b042;&quot;&gt;`id`&lt;/span&gt; &lt;span class=&quot;hljs-built_in&quot;&gt;int&lt;/span&gt;(&lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;11&lt;/span&gt;) &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;NOT&lt;/span&gt; &lt;span class=&quot;hljs-literal&quot;&gt;NULL&lt;/span&gt; auto_increment,  
&lt;span class=&quot;hljs-string&quot; style=&quot;color: #65b042;&quot;&gt;`domain_id`&lt;/span&gt; &lt;span class=&quot;hljs-built_in&quot;&gt;int&lt;/span&gt;(&lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;11&lt;/span&gt;) &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;NOT&lt;/span&gt; &lt;span class=&quot;hljs-literal&quot;&gt;NULL&lt;/span&gt;,  
&lt;span class=&quot;hljs-string&quot; style=&quot;color: #65b042;&quot;&gt;`password`&lt;/span&gt; &lt;span class=&quot;hljs-built_in&quot;&gt;varchar&lt;/span&gt;(&lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;106&lt;/span&gt;) &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;NOT&lt;/span&gt; &lt;span class=&quot;hljs-literal&quot;&gt;NULL&lt;/span&gt;,  
&lt;span class=&quot;hljs-string&quot; style=&quot;color: #65b042;&quot;&gt;`email`&lt;/span&gt; &lt;span class=&quot;hljs-built_in&quot;&gt;varchar&lt;/span&gt;(&lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;100&lt;/span&gt;) &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;NOT&lt;/span&gt; &lt;span class=&quot;hljs-literal&quot;&gt;NULL&lt;/span&gt;,  
&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;PRIMARY&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;KEY&lt;/span&gt; (&lt;span class=&quot;hljs-string&quot; style=&quot;color: #65b042;&quot;&gt;`id`&lt;/span&gt;),  
&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;UNIQUE&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;KEY&lt;/span&gt; &lt;span class=&quot;hljs-string&quot; style=&quot;color: #65b042;&quot;&gt;`email`&lt;/span&gt; (&lt;span class=&quot;hljs-string&quot; style=&quot;color: #65b042;&quot;&gt;`email`&lt;/span&gt;),  
&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;FOREIGN&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;KEY&lt;/span&gt; (domain_id) &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;REFERENCES&lt;/span&gt; virtual_domains(id) &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;ON&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;DELETE&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;CASCADE&lt;/span&gt;)  
&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;ENGINE&lt;/span&gt;=&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;InnoDB&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;DEFAULT&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;CHARSET&lt;/span&gt;=utf8;&lt;/span&gt;</pre>
</li>
<li>输入如下SQL语句以新建<code style="color: #40aa53;">virtual_aliases</code>表，该表是邮件服务器别名表「邮件服务器种的<code style="color: #40aa53;">别名alias</code>的概念大家可以Google一番」：<br />
<pre class="crayon-plain-tag">&lt;span class=&quot;hljs-operator&quot;&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;CREATE&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;TABLE&lt;/span&gt; &lt;span class=&quot;hljs-string&quot; style=&quot;color: #65b042;&quot;&gt;`virtual_aliases`&lt;/span&gt; (  
&lt;span class=&quot;hljs-string&quot; style=&quot;color: #65b042;&quot;&gt;`id`&lt;/span&gt; &lt;span class=&quot;hljs-built_in&quot;&gt;int&lt;/span&gt;(&lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;11&lt;/span&gt;) &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;NOT&lt;/span&gt; &lt;span class=&quot;hljs-literal&quot;&gt;NULL&lt;/span&gt; auto_increment,  
&lt;span class=&quot;hljs-string&quot; style=&quot;color: #65b042;&quot;&gt;`domain_id`&lt;/span&gt; &lt;span class=&quot;hljs-built_in&quot;&gt;int&lt;/span&gt;(&lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;11&lt;/span&gt;) &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;NOT&lt;/span&gt; &lt;span class=&quot;hljs-literal&quot;&gt;NULL&lt;/span&gt;,  
&lt;span class=&quot;hljs-string&quot; style=&quot;color: #65b042;&quot;&gt;`source`&lt;/span&gt; &lt;span class=&quot;hljs-built_in&quot;&gt;varchar&lt;/span&gt;(&lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;100&lt;/span&gt;) &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;NOT&lt;/span&gt; &lt;span class=&quot;hljs-literal&quot;&gt;NULL&lt;/span&gt;,  
&lt;span class=&quot;hljs-string&quot; style=&quot;color: #65b042;&quot;&gt;`destination`&lt;/span&gt; &lt;span class=&quot;hljs-built_in&quot;&gt;varchar&lt;/span&gt;(&lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;100&lt;/span&gt;) &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;NOT&lt;/span&gt; &lt;span class=&quot;hljs-literal&quot;&gt;NULL&lt;/span&gt;,  
&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;PRIMARY&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;KEY&lt;/span&gt; (&lt;span class=&quot;hljs-string&quot; style=&quot;color: #65b042;&quot;&gt;`id`&lt;/span&gt;),  
&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;FOREIGN&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;KEY&lt;/span&gt; (domain_id) &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;REFERENCES&lt;/span&gt; virtual_domains(id) &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;ON&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;DELETE&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;CASCADE&lt;/span&gt;)  
&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;ENGINE&lt;/span&gt;=&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;InnoDB&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;DEFAULT&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;CHARSET&lt;/span&gt;=utf8          
&lt;/span&gt;</pre><br />
<span id="OSC_h3_13"></span></p>
<h3>插入数据</h3>
<p>为了便于查看结果，接下来给上述三张表种插入一些测试数据：</li>
<li>给<code style="color: #40aa53;">virtual_domains</code>表插入测试数据，大致如下：</p><pre class="crayon-plain-tag">&lt;span class=&quot;hljs-operator&quot;&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;insert&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;into&lt;/span&gt; virtual_domains(id,name) &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;values&lt;/span&gt;(&lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;1&lt;/span&gt;,&lt;span class=&quot;hljs-string&quot; style=&quot;color: #65b042;&quot;&gt;'mail.mydomain.com'&lt;/span&gt;);&lt;/span&gt;     
&lt;span class=&quot;hljs-operator&quot;&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;insert&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;into&lt;/span&gt; virtual_domains(id,name) &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;values&lt;/span&gt;(&lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;2&lt;/span&gt;,&lt;span class=&quot;hljs-string&quot; style=&quot;color: #65b042;&quot;&gt;'mydomain.com'&lt;/span&gt;);&lt;/span&gt;</pre><p></p>
<blockquote><p><strong>请注意：</strong><br />
上述表种id字段是自增列，可以不赋值。但无论如何，接下来的两张表种我们将需要上述表种的逐渐列id的值。比如：我将要添加mydomain.com域名下的邮箱帐号，而mydomain.com在<code style="color: #40aa53;">virtual_domains</code>表种的id值为2。</p></blockquote>
</li>
<li>给<code style="color: #40aa53;">virtual_users</code>表添加用户数据：<br />
<pre class="crayon-plain-tag">&lt;span class=&quot;hljs-operator&quot;&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;insert&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;into&lt;/span&gt; virtual_users(id,domain_id,&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;password&lt;/span&gt;,email)  
&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;values&lt;/span&gt; (&lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;1&lt;/span&gt;,&lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;2&lt;/span&gt;,&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;ENCRYPT&lt;/span&gt;(&lt;span class=&quot;hljs-string&quot; style=&quot;color: #65b042;&quot;&gt;'zhangsan123456'&lt;/span&gt;, &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;CONCAT&lt;/span&gt;(&lt;span class=&quot;hljs-string&quot; style=&quot;color: #65b042;&quot;&gt;'$7$'&lt;/span&gt;, &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;SUBSTRING&lt;/span&gt;(&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;SHA&lt;/span&gt;(&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;RAND&lt;/span&gt;()), -&lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;16&lt;/span&gt;))),&lt;span class=&quot;hljs-string&quot; style=&quot;color: #65b042;&quot;&gt;'zhangsan@mydomain.com'&lt;/span&gt;);&lt;/span&gt;


&lt;span class=&quot;hljs-operator&quot;&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;insert&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;into&lt;/span&gt; virtual_users(id,domain_id,&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;password&lt;/span&gt;,email)  
&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;values&lt;/span&gt; (&lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;2&lt;/span&gt;,&lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;2&lt;/span&gt;,&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;ENCRYPT&lt;/span&gt;(&lt;span class=&quot;hljs-string&quot; style=&quot;color: #65b042;&quot;&gt;'123456lisi'&lt;/span&gt;, &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;CONCAT&lt;/span&gt;(&lt;span class=&quot;hljs-string&quot; style=&quot;color: #65b042;&quot;&gt;'$7$'&lt;/span&gt;, &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;SUBSTRING&lt;/span&gt;(&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;SHA&lt;/span&gt;(&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;RAND&lt;/span&gt;()), -&lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;16&lt;/span&gt;))),&lt;span class=&quot;hljs-string&quot; style=&quot;color: #65b042;&quot;&gt;'lisi@mydomain.com'&lt;/span&gt;);&lt;/span&gt;</pre>
</li>
<li>给<code style="color: #40aa53;">virtual_aliases</code>表添加别名数据：<br />
<pre class="crayon-plain-tag">&lt;span class=&quot;hljs-operator&quot;&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;insert&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;into&lt;/span&gt; virtual_aliases(id,domain_id,source,destination)  
&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;values&lt;/span&gt; (&lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;1&lt;/span&gt;,&lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;2&lt;/span&gt;,&lt;span class=&quot;hljs-string&quot; style=&quot;color: #65b042;&quot;&gt;'all@mydomain.com'&lt;/span&gt;,&lt;span class=&quot;hljs-string&quot; style=&quot;color: #65b042;&quot;&gt;'zhangsan@mydomain.com'&lt;/span&gt;);&lt;/span&gt;

&lt;span class=&quot;hljs-operator&quot;&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;insert&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;into&lt;/span&gt; virtual_aliases(id,domain_id,source,destination)  
&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;values&lt;/span&gt; (&lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;1&lt;/span&gt;,&lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;2&lt;/span&gt;,&lt;span class=&quot;hljs-string&quot; style=&quot;color: #65b042;&quot;&gt;'all@mydomain.com'&lt;/span&gt;,&lt;span class=&quot;hljs-string&quot; style=&quot;color: #65b042;&quot;&gt;'lisi@mydomain.com'&lt;/span&gt;);&lt;/span&gt;</pre></p>
<blockquote><p><strong>请注意：</strong><br />
通过上述别名表的数据，当有人给<code style="color: #40aa53;">all@mydomain.com</code>发送邮件时，系统将自动将邮件转发给<code style="color: #40aa53;">zhangsan@mydomain.com</code>和<code style="color: #40aa53;">lisi@mydomain.com</code><br />
这种场景，在公司内部「发送通知」等情况下适用</p></blockquote>
</li>
</ol>
<p><span id="OSC_h3_14"></span></p>
<h3>测试数据</h3>
<p>写几个SQL查询语句查看下结果吧</p><pre class="crayon-plain-tag">&lt;span class=&quot;hljs-operator&quot;&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;select&lt;/span&gt; * &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;from&lt;/span&gt; virtual_domains;&lt;/span&gt;  
&lt;span class=&quot;hljs-operator&quot;&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;select&lt;/span&gt; * &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;from&lt;/span&gt; virtual_users;&lt;/span&gt;  
&lt;span class=&quot;hljs-operator&quot;&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;select&lt;/span&gt; * &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;from&lt;/span&gt; virtual_aliases;&lt;/span&gt;</pre><p><span id="OSC_h2_15"></span></p>
<h2>Postfix安装及配置</h2>
<p>Postfix是邮件发送的核心服务器，所有向内、向外投递的邮件都需要经过Postfix通过SMTP协议完成。接下来的内容，大家需要修改Postfix相关的一些参数，它们是：</p>
<ul>
<li>告诉Postfix如何连接MySQL数据库，并让Postfix通过数据库种的表确定收发邮件的域名、用户帐号及密码、邮件别名等</li>
<li>告诉Postfix将收到的邮件转发给Dovecot的LMTP服务以完成本地投递</li>
<li>告诉Postfix所有的连接都需要STARTTLS加密，如果有必要「废话啊，当然必须这样」</li>
<li>开放本地端口25、465、587之一或全部</li>
</ul>
<p><span id="OSC_h3_16"></span></p>
<h3>Postfix的安装</h3>
<p>在命令行种执行以下命令以安装Postfix：</p><pre class="crayon-plain-tag">apt-&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;get&lt;/span&gt; install &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;postfix&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;postfix&lt;/span&gt;-mysql</pre><p>安装过程中需要选择Postfix的类型，请选择<code style="color: #40aa53;">Internet Site</code>：</p>
<p><a style="color: #ff8373;" href="http://static.oschina.net/uploads/space/2015/0511/205329_10Lq_2340783.png" target="_blank"><img src="http://static.oschina.net/uploads/space/2015/0511/205329_10Lq_2340783.png" alt="Postfix Config" /></a></p>
<p>Postfix安装过程中还会需要输入<strong>System mail name</strong>，这里请输入你要收发邮件的域名地址「随便写也可以，反正后面需要修改配置文件」</p>
<p><span id="OSC_h3_17"></span></p>
<h3>Postfix的配置</h3>
<ol>
<li>备份Postfix的配置文件<code style="color: #40aa53;">/etc/postfix/main.cf</code>，先！<br />
<pre class="crayon-plain-tag">cp /etc/postfix/main&lt;span class=&quot;hljs-class&quot;&gt;.cf&lt;/span&gt; /etc/postfix/main&lt;span class=&quot;hljs-class&quot;&gt;.cf_backup_20150511&lt;/span&gt;</pre></p>
<blockquote><p><strong>请注意</strong><br />
任何时候，对任何配置进行修改之前，先做好备份总是非常必要的<br />
同时，这也是一个非常良好的操作习惯</p></blockquote>
</li>
<li>使用vi编辑器打开<code style="color: #40aa53;">/etc/postfix/main.cf</code>文件<br />
<pre class="crayon-plain-tag">vi /etc/postfix/main&lt;span class=&quot;hljs-class&quot;&gt;.cf&lt;/span&gt;</pre>
</li>
<li>打开之后，按下<code style="color: #40aa53;">i</code>键进入编辑模式</li>
<li>鉴于我们没有打算使用Postfix做用户的权限验证「上述几个图种已经展示清楚」，我们将要把Postfix默认的用户验证参数屏蔽，因此请在如下几行前边加入<code style="color: #40aa53;">#</code>符号以注释：<br />
<pre class="crayon-plain-tag"># &lt;span class=&quot;hljs-class&quot;&gt;TLS&lt;/span&gt; parameters  
  &lt;span class=&quot;hljs-symbol&quot; style=&quot;color: #3387cc;&quot;&gt;#smtpd_tls_cert_file&lt;/span&gt;=/etc/ssl/certs/ssl-cert-snakeoil.pem  
  &lt;span class=&quot;hljs-symbol&quot; style=&quot;color: #3387cc;&quot;&gt;#smtpd_tls_key_file&lt;/span&gt;=/etc/ssl/private/ssl-cert-snakeoil.key  &lt;span class=&quot;hljs-symbol&quot; style=&quot;color: #3387cc;&quot;&gt;#smtpd_use_tls&lt;/span&gt;=yes  
  &lt;span class=&quot;hljs-symbol&quot; style=&quot;color: #3387cc;&quot;&gt;#smtpd_tls_session_cache_database&lt;/span&gt; = &lt;span class=&quot;hljs-method&quot;&gt;btree:&lt;/span&gt;&lt;span class=&quot;hljs-char&quot;&gt;${&lt;/span&gt;data_directory}/smtpd_scache  
  &lt;span class=&quot;hljs-symbol&quot; style=&quot;color: #3387cc;&quot;&gt;#smtp_tls_session_cache_database&lt;/span&gt; = &lt;span class=&quot;hljs-method&quot;&gt;btree:&lt;/span&gt;&lt;span class=&quot;hljs-char&quot;&gt;${&lt;/span&gt;data_directory}/smtp_scache</pre>
</li>
<li>复制如下内容，并将其插入到上述注释代码之后：<br />
<pre class="crayon-plain-tag">&lt;span class=&quot;hljs-constant&quot;&gt;smtpd_tls_cert_file&lt;/span&gt;=/etc/dovecot/dovecot.pem  
&lt;span class=&quot;hljs-constant&quot;&gt;smtpd_tls_key_file&lt;/span&gt;=/etc/dovecot/private/dovecot.pem  
&lt;span class=&quot;hljs-constant&quot;&gt;smtpd_use_tls&lt;/span&gt;=yes  
&lt;span class=&quot;hljs-constant&quot;&gt;smtpd_tls_auth_only&lt;/span&gt; = yes  

&lt;span class=&quot;hljs-comment&quot; style=&quot;font-style: italic; color: #aeaeae;&quot;&gt;#Enabling SMTP for authenticated users, and handing off authentication to Dovecot  &lt;/span&gt;
&lt;span class=&quot;hljs-constant&quot;&gt;smtpd_sasl_type&lt;/span&gt; = dovecot  
&lt;span class=&quot;hljs-constant&quot;&gt;smtpd_sasl_path&lt;/span&gt; = private/auth  
&lt;span class=&quot;hljs-constant&quot;&gt;smtpd_sasl_auth_enable&lt;/span&gt; = yes  
&lt;span class=&quot;hljs-constant&quot;&gt;smtpd_recipient_restrictions&lt;/span&gt; =  permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination</pre></p>
<blockquote><p><strong>请注意：</strong><br />
上述几个参数的含义，请参照<a style="color: #ff8373;" href="http://www.postfix.org/documentation.html" rel="nofollow">Postfix配置文档</a></p></blockquote>
</li>
<li>按照如下方式修改<code style="color: #40aa53;">mydestination</code>一行的值：<br />
<pre class="crayon-plain-tag">&lt;span class=&quot;hljs-attribute&quot;&gt;mydestination &lt;/span&gt;=&lt;span class=&quot;hljs-string&quot; style=&quot;color: #65b042;&quot;&gt; localhost
&lt;/span&gt;</pre></p>
<blockquote><p><strong>请注意：</strong><br />
将<code style="color: #40aa53;">mydestination</code>的值修改为localhost，以便Postfix能够通过MySQL表中相关数据决定需要接受/发送邮件的域名，这样更具有通用性</p></blockquote>
</li>
<li>在文档种加入以下内容，以便告诉Postfix不要使用LDA「Local Delivery Agent」转而使用Dovecot的LMTP完成本地邮件投递：<br />
<pre class="crayon-plain-tag">#Handing off local delivery &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;to&lt;/span&gt; Dovecot's LMTP, &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;and&lt;/span&gt; telling it where &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;to&lt;/span&gt; store mail  
virtual_transport = lmtp:unix:&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;private&lt;/span&gt;/dovecot-lmtp</pre>
</li>
<li>在文档中加入以下内容，以便告诉Postfix去MySQL数据库种寻找域名、用户帐号密码及邮件别名等信息：<br />
<pre class="crayon-plain-tag">&lt;span class=&quot;hljs-id&quot;&gt;#Virtual&lt;/span&gt; domains, users, and aliases  
virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-mailbox-domains&lt;span class=&quot;hljs-class&quot;&gt;.cf&lt;/span&gt;  
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-mailbox-maps&lt;span class=&quot;hljs-class&quot;&gt;.cf&lt;/span&gt;  
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps&lt;span class=&quot;hljs-class&quot;&gt;.cf&lt;/span&gt;</pre>
</li>
<li>最终，修改完成以后的<code style="color: #40aa53;">/etc/postfix/main.cf</code>文件大致应该如下：<br />
<pre class="crayon-plain-tag">&lt;span class=&quot;hljs-comment&quot; style=&quot;font-style: italic; color: #aeaeae;&quot;&gt;# See /usr/share/postfix/main.cf.dist for a commented, more complete version    &lt;/span&gt;

&lt;span class=&quot;hljs-comment&quot; style=&quot;font-style: italic; color: #aeaeae;&quot;&gt;# Debian specific:  Specifying a file name will cause the first  &lt;/span&gt;
&lt;span class=&quot;hljs-comment&quot; style=&quot;font-style: italic; color: #aeaeae;&quot;&gt;# line of that file to be used as the name.  The Debian default  &lt;/span&gt;
&lt;span class=&quot;hljs-comment&quot; style=&quot;font-style: italic; color: #aeaeae;&quot;&gt;# is /etc/mailname.  &lt;/span&gt;
&lt;span class=&quot;hljs-comment&quot; style=&quot;font-style: italic; color: #aeaeae;&quot;&gt;#myorigin = /etc/mailname  &lt;/span&gt;

&lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;smtpd_banner =&lt;/span&gt; $myhostname ESMTP $mail_name (Ubuntu)  
&lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;biff =&lt;/span&gt; no  

&lt;span class=&quot;hljs-comment&quot; style=&quot;font-style: italic; color: #aeaeae;&quot;&gt;# appending .domain is the MUA's job.  &lt;/span&gt;
&lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;append_dot_mydomain =&lt;/span&gt; no  

&lt;span class=&quot;hljs-comment&quot; style=&quot;font-style: italic; color: #aeaeae;&quot;&gt;# Uncomment the next line to generate &quot;delayed mail&quot; warnings  &lt;/span&gt;
&lt;span class=&quot;hljs-comment&quot; style=&quot;font-style: italic; color: #aeaeae;&quot;&gt;#delay_warning_time = 4h  &lt;/span&gt;

&lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;readme_directory =&lt;/span&gt; no  

&lt;span class=&quot;hljs-comment&quot; style=&quot;font-style: italic; color: #aeaeae;&quot;&gt;# TLS parameters    &lt;/span&gt;
&lt;span class=&quot;hljs-comment&quot; style=&quot;font-style: italic; color: #aeaeae;&quot;&gt;#smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem &lt;/span&gt;
&lt;span class=&quot;hljs-comment&quot; style=&quot;font-style: italic; color: #aeaeae;&quot;&gt;#smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key  &lt;/span&gt;
&lt;span class=&quot;hljs-comment&quot; style=&quot;font-style: italic; color: #aeaeae;&quot;&gt;#smtpd_use_tls=yes  &lt;/span&gt;
&lt;span class=&quot;hljs-comment&quot; style=&quot;font-style: italic; color: #aeaeae;&quot;&gt;#smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache  &lt;/span&gt;
&lt;span class=&quot;hljs-comment&quot; style=&quot;font-style: italic; color: #aeaeae;&quot;&gt;#smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache  &lt;/span&gt;

&lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;smtpd_tls_cert_file=&lt;/span&gt;/etc/dovecot/dovecot.pem  
&lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;smtpd_tls_key_file=&lt;/span&gt;/etc/dovecot/private/dovecot.pem  
&lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;smtpd_use_tls=&lt;/span&gt;yes  
&lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;smtpd_tls_auth_only =&lt;/span&gt; yes  

&lt;span class=&quot;hljs-comment&quot; style=&quot;font-style: italic; color: #aeaeae;&quot;&gt;#Enabling SMTP for authenticated users, and handing off authentication to Dovecot  &lt;/span&gt;
&lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;smtpd_sasl_type =&lt;/span&gt; dovecot  
&lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;smtpd_sasl_path =&lt;/span&gt; private/auth  
&lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;smtpd_sasl_auth_enable =&lt;/span&gt; yes  
&lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;smtpd_recipient_restrictions =&lt;/span&gt;  
    permit_sasl_authenticated,  
    permit_mynetworks,  
    reject_unauth_destination  

&lt;span class=&quot;hljs-comment&quot; style=&quot;font-style: italic; color: #aeaeae;&quot;&gt;# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for    &lt;/span&gt;
&lt;span class=&quot;hljs-comment&quot; style=&quot;font-style: italic; color: #aeaeae;&quot;&gt;# information on enabling SSL in the smtp client.      &lt;/span&gt;
&lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;myhostname =&lt;/span&gt; host.mydomain.com  
&lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;alias_maps =&lt;/span&gt; hash:/etc/aliases  
&lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;alias_database =&lt;/span&gt; hash:/etc/aliases  
&lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;myorigin =&lt;/span&gt; /etc/mailname  
&lt;span class=&quot;hljs-comment&quot; style=&quot;font-style: italic; color: #aeaeae;&quot;&gt;#mydestination = example.com, hostname.mydomain.com,localhost.mydomain.com, localhost  &lt;/span&gt;
&lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;mydestination =&lt;/span&gt; localhost  
&lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;relayhost =&lt;/span&gt;  
        &lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;mynetworks =&lt;/span&gt; &lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;127.0&lt;/span&gt;.&lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;0.0&lt;/span&gt;/&lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;8&lt;/span&gt; [::ffff:&lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;127.0&lt;/span&gt;.&lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;0.0&lt;/span&gt;]/&lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;104&lt;/span&gt; [::&lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;1&lt;/span&gt;]/&lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;128&lt;/span&gt;    
&lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;mailbox_size_limit =&lt;/span&gt; &lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;0&lt;/span&gt;  
&lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;recipient_delimiter =&lt;/span&gt; +  
&lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;inet_interfaces =&lt;/span&gt; all  

&lt;span class=&quot;hljs-comment&quot; style=&quot;font-style: italic; color: #aeaeae;&quot;&gt;#Handing off local delivery to Dovecot's LMTP, and telling it where to store mail  &lt;/span&gt;
&lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;virtual_transport =&lt;/span&gt; lmtp:unix:private/dovecot-lmtp  

&lt;span class=&quot;hljs-comment&quot; style=&quot;font-style: italic; color: #aeaeae;&quot;&gt;#Virtual domains, users, and aliases  &lt;/span&gt;
&lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;virtual_mailbox_domains =&lt;/span&gt; mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf  
&lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;virtual_mailbox_maps =&lt;/span&gt; mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf  
&lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;virtual_alias_maps =&lt;/span&gt; mysql:/etc/postfix/mysql-virtual-alias-maps.cf</pre>
</li>
<li>按下<code style="color: #40aa53;">ESC</code>键并输入如下内容以保存并退出<br />
<pre class="crayon-plain-tag">&lt;span class=&quot;hljs-function_or_atom&quot;&gt;wq&lt;/span&gt;&lt;span class=&quot;hljs-exclamation_mark&quot;&gt;!&lt;/span&gt;</pre>
</li>
<li><strong>新建<code style="color: #40aa53;">/etc/postfix/mysql-virtual-mailbox-domains.cf</code>文件并输入如下内容：</strong><br />
<pre class="crayon-plain-tag">&lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;user =&lt;/span&gt; mailserver   
&lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;password =&lt;/span&gt; mailserver123  
&lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;hosts =&lt;/span&gt; &lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;127.0&lt;/span&gt;.&lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;0.1&lt;/span&gt;  
&lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;dbname =&lt;/span&gt; mailserver  
&lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;query =&lt;/span&gt; SELECT &lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;1&lt;/span&gt; FROM virtual_domains WHERE &lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;name=&lt;/span&gt;'%s'</pre>
</li>
<li>重启Postfix服务<br />
<pre class="crayon-plain-tag">&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;service&lt;/span&gt; postfix &lt;span class=&quot;hljs-literal&quot;&gt;restart&lt;/span&gt;</pre>
</li>
<li>测试上述内容是否正确，如果上述内容配置正确，则如下命令执行后返回结果应该为<code style="color: #40aa53;">1</code>：<br />
<pre class="crayon-plain-tag">postmap -&lt;span class=&quot;hljs-tag&quot; style=&quot;color: #89bdff;&quot;&gt;q&lt;/span&gt; mydomain&lt;span class=&quot;hljs-class&quot;&gt;.com&lt;/span&gt; mysql:/etc/postfix/mysql-virtual-mailbox-domains&lt;span class=&quot;hljs-class&quot;&gt;.cf&lt;/span&gt;</pre>
</li>
<li><strong>新建<code style="color: #40aa53;">/etc/postfix/mysql-virtual-mailbox-maps.cf</code>文件并输入如下内容：</strong><br />
<pre class="crayon-plain-tag">&lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;user =&lt;/span&gt; mailserver    
&lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;password =&lt;/span&gt; mailserver123  
&lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;hosts =&lt;/span&gt; &lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;127.0&lt;/span&gt;.&lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;0.1&lt;/span&gt;  
&lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;dbname =&lt;/span&gt; mailserver  
&lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;query =&lt;/span&gt; SELECT &lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;1&lt;/span&gt; FROM virtual_users WHERE &lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;email=&lt;/span&gt;'%s'</pre>
</li>
<li>重启Postfix服务<br />
<pre class="crayon-plain-tag">&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;service&lt;/span&gt; postfix &lt;span class=&quot;hljs-literal&quot;&gt;restart&lt;/span&gt;</pre>
</li>
<li>测试上述配置是否正确，如果上述内容配置正确，则如下命令执行后返回结果应该为<code style="color: #40aa53;">1</code>：<br />
<pre class="crayon-plain-tag">postmap -&lt;span class=&quot;hljs-tag&quot; style=&quot;color: #89bdff;&quot;&gt;q&lt;/span&gt; lisi@mydomain&lt;span class=&quot;hljs-class&quot;&gt;.com&lt;/span&gt; mysql:/etc/postfix/mysql-virtual-mailbox-maps&lt;span class=&quot;hljs-class&quot;&gt;.cf&lt;/span&gt;</pre>
</li>
<li><strong>新建<code style="color: #40aa53;">/etc/postfix/mysql-virtual-alias-maps.cf</code>文件并输入如下内容：</strong><br />
<pre class="crayon-plain-tag">&lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;user =&lt;/span&gt; mailserver    
&lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;password =&lt;/span&gt; mailserver123  
&lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;hosts =&lt;/span&gt; &lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;127.0&lt;/span&gt;.&lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;0.1&lt;/span&gt;  
&lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;dbname =&lt;/span&gt; mailserver  
&lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;query =&lt;/span&gt; SELECT destination FROM virtual_aliases WHERE &lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;source=&lt;/span&gt;'%s'</pre>
</li>
<li>重启Postfix服务<br />
<pre class="crayon-plain-tag">&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;service&lt;/span&gt; postfix &lt;span class=&quot;hljs-literal&quot;&gt;restart&lt;/span&gt;</pre>
</li>
<li>测试上述配置是否正确，如果上述配置正确，则如下命令执行后返回结果应该是之前添加的别名帐号：<br />
<pre class="crayon-plain-tag">postmap -&lt;span class=&quot;hljs-tag&quot; style=&quot;color: #89bdff;&quot;&gt;q&lt;/span&gt; all@mydomain&lt;span class=&quot;hljs-class&quot;&gt;.com&lt;/span&gt; mysql:/etc/postfix/mysql-virtual-alias-maps&lt;span class=&quot;hljs-class&quot;&gt;.cf&lt;/span&gt;</pre>
</li>
<li>使用vi编辑器打开<code style="color: #40aa53;">/etc/postfix/master.cf</code>文件「<strong>请注意修改之前先备份</strong>」，找到<code style="color: #40aa53;">submission</code>和<code style="color: #40aa53;">smtps</code>所在的两行，并将其注释去掉。这样做的目的是允许Postfix通过587和465端口发送邮件</li>
<li>重启Postfix服务<br />
<pre class="crayon-plain-tag">&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;service&lt;/span&gt; postfix &lt;span class=&quot;hljs-literal&quot;&gt;restart&lt;/span&gt;</pre>
</li>
</ol>
<p>搞定，Postfix服务器应该配置完成了。<strong>相信到这里的时候，已经吓走了90%以上的朋友，剩下的10%朋友们，你们是好样的。</strong></p>
<p><span id="OSC_h2_18"></span></p>
<h2>Dovecot安装及配置</h2>
<p>Dovecot在本例中充当IMAP、POP服务器的角色，同时它也将负责用户登录时用户身份的验证「Dovecot会将真正的验证工作交给MySQL处理」。因为使用SSL，Dovecot将会使用993「IMAP协议」及995「POP协议」与外界交流，若服务器有iptable之类的玩意儿，请开放相关端口。</p>
<p>这部分的内容配置起来相对简单，但是需要配置的文件繁多。大体上，我们需要配置如下的信息：</p>
<ol>
<li>开启Dovecot的IMAP、POP3、LMTP协议</li>
<li>告知Dovecot本地邮件的投档路径</li>
<li>连接Dovecot和MySQL数据库以验证用户身份</li>
<li>配置SSL加密相关信息</li>
</ol>
<p><span id="OSC_h3_19"></span></p>
<h3>Dovecot的安装</h3>
<p>通过如下命令安装Dovecot最新版：</p><pre class="crayon-plain-tag">apt-&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;get&lt;/span&gt; install dovecot-core dovecot-imapd dovecot-pop3d dovecot-lmtpd dovecot-mysql</pre><p><span id="OSC_h3_20"></span></p>
<h3>Dovecot的配置</h3>
<p>需要修改的配置文件有：</p>
<ul>
<li><code style="color: #40aa53;">/etc/dovecot/dovecot.conf</code> Dovecot的主配置文件</li>
<li><code style="color: #40aa53;">/etc/dovecot/conf.d/10-mail.conf</code> Dovecot将要操作的磁盘路径相关配置信息</li>
<li><code style="color: #40aa53;">/etc/dovecot/conf.d/10-auth.conf</code> 用户验证相关配置信息</li>
<li><code style="color: #40aa53;">/etc/dovecot/conf.d/auth-sql.conf.ext</code> SQL-Type验证相关配置信息</li>
<li><code style="color: #40aa53;">/etc/dovecot/dovecot-sql.conf.ext</code> Dovecot与数据库连接相关配置信息</li>
<li><code style="color: #40aa53;">/etc/dovecot/conf.d/10-master.conf</code> Dovecot本地socket相关配置信息</li>
<li><code style="color: #40aa53;">/etc/dovecot/conf.d/10-ssl.conf</code> 关于SSL的相关配置信息</li>
</ul>
<blockquote><p><strong>请注意：</strong><br />
在修改上述文件之前，请一定先做好备份以方便恢复</p></blockquote>
<p><span id="OSC_h3_21"></span></p>
<h3>修改<code style="color: #40aa53;">/etc/dovecot/dovecot.conf</code>文件</h3>
<p>使用vi编辑器打开<code style="color: #40aa53;">/etc/dovecot/dovecot.conf</code>文件并在文件种加入如下内容：</p><pre class="crayon-plain-tag">!include conf.d/&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;*&lt;/span&gt;.conf

&lt;span class=&quot;hljs-comment&quot; style=&quot;font-style: italic; color: #aeaeae;&quot;&gt;# Enable installed  &lt;/span&gt;
protocols!include_try /usr/share/dovecot/protocols.d/&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;*&lt;/span&gt;.protocol  
protocols = imap pop3 lmtp</pre><p>如果以上内容已经存在，只需要把该行的<code style="color: #40aa53;">#</code>号去掉即可<br />
上述内容大致的意思是：<strong>告诉Dovecot启用所有<code style="color: #40aa53;">.conf</code>文件；并开启Dovecot的imap、pop3、lmtp等相关协议使之正常工作</strong></p>
<p><span id="OSC_h3_22"></span></p>
<h3>修改<code style="color: #40aa53;">/etc/dovecot/conf.d/10-mail.conf</code>文件</h3>
<p>打开文件并找到<code style="color: #40aa53;">mail_location</code>相关信息，将其指定到本地磁盘的某个路径，这个路径将来会存放收到的邮件，如下所示：</p><pre class="crayon-plain-tag">mail_location = &lt;span class=&quot;hljs-string&quot; style=&quot;color: #65b042;&quot;&gt;maildir:&lt;/span&gt;&lt;span class=&quot;hljs-regexp&quot; style=&quot;color: #e9c062;&quot;&gt;/var/&lt;/span&gt;mail&lt;span class=&quot;hljs-regexp&quot; style=&quot;color: #e9c062;&quot;&gt;/vhosts/&lt;/span&gt;%d/%n</pre><p>同时，找到文件中<code style="color: #40aa53;">mail_privileged_group</code>相关信息并将起修改为：</p><pre class="crayon-plain-tag">&lt;span class=&quot;hljs-attribute&quot;&gt;mail_privileged_group &lt;/span&gt;=&lt;span class=&quot;hljs-string&quot; style=&quot;color: #65b042;&quot;&gt; mail
&lt;/span&gt;</pre><p>保存文件并退出</p>
<p>在命令行种输入如下内容以查看<code style="color: #40aa53;">/var/mail</code>路径的权限：</p><pre class="crayon-plain-tag">&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;ls&lt;/span&gt; -ld /&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;var&lt;/span&gt;/mail</pre><p>显示的内容大致应该是：</p><pre class="crayon-plain-tag">drwxrwsr-x &lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;2&lt;/span&gt; root mail &lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;4096&lt;/span&gt; May  &lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;11&lt;/span&gt; &lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;15&lt;/span&gt;:&lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;08&lt;/span&gt; /&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;var&lt;/span&gt;/mail</pre><p>创建<code style="color: #40aa53;">/var/mail/vhosts/</code>文件夹给每个需要启用的域名：</p><pre class="crayon-plain-tag">mkdir -&lt;span class=&quot;hljs-tag&quot; style=&quot;color: #89bdff;&quot;&gt;p&lt;/span&gt; /var/mail/vhosts/mydomain&lt;span class=&quot;hljs-class&quot;&gt;.com&lt;/span&gt;</pre><p>输入如下命令以新建<code style="color: #40aa53;">vmail</code>用户组及用户并赋权限</p><pre class="crayon-plain-tag">groupadd -&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;g&lt;/span&gt; 5000 vmail  
useradd -&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;g&lt;/span&gt; vmail -&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;u&lt;/span&gt; 5000 vmail -&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;d&lt;/span&gt; /&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;var&lt;/span&gt;/mail</pre><p>接下来修改一下<code style="color: #40aa53;">/var/mail/</code>目录的权限，使<code style="color: #40aa53;">vmail</code>能够访问：</p><pre class="crayon-plain-tag">chown -R &lt;span class=&quot;hljs-string&quot; style=&quot;color: #65b042;&quot;&gt;vmail:&lt;/span&gt;vmail &lt;span class=&quot;hljs-regexp&quot; style=&quot;color: #e9c062;&quot;&gt;/var/&lt;/span&gt;mail</pre><p><span id="OSC_h3_23"></span></p>
<h3>修改<code style="color: #40aa53;">/etc/dovecot/conf.d/10-auth.conf</code>文件</h3>
<p>找到文件中<code style="color: #40aa53;">disable_plaintext_auth</code>并取消注释</p><pre class="crayon-plain-tag">&lt;span class=&quot;hljs-setting&quot;&gt;disable_plaintext_auth = &lt;span class=&quot;hljs-value&quot;&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;yes&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;</pre><p>找到文件中<code style="color: #40aa53;">auth_mechanisms</code>并将其修改为如下值：</p><pre class="crayon-plain-tag">&lt;span class=&quot;hljs-attribute&quot;&gt;auth_mechanisms &lt;/span&gt;=&lt;span class=&quot;hljs-string&quot; style=&quot;color: #65b042;&quot;&gt; plain login
&lt;/span&gt;</pre><p>默认情况下，Dovecot是允许Ubuntu系统用户登录使用的，我们需要将其禁用。找到文件种如下内容并将其注释：</p><pre class="crayon-plain-tag">&lt;span class=&quot;hljs-shebang&quot; style=&quot;color: #89bdff;&quot;&gt;#!include auth-system.conf.ext&lt;/span&gt;</pre><p>开启Dovecot的MySQL支持，取消<code style="color: #40aa53;">!include auth-sql.conf.ext</code>的注释符号：</p><pre class="crayon-plain-tag">&lt;span class=&quot;hljs-shebang&quot; style=&quot;color: #89bdff;&quot;&gt;#!include auth-system.conf.ext  &lt;/span&gt;
!include auth-sql.conf.ext  
&lt;span class=&quot;hljs-shebang&quot; style=&quot;color: #89bdff;&quot;&gt;#!include auth-ldap.conf.ext  &lt;/span&gt;
&lt;span class=&quot;hljs-shebang&quot; style=&quot;color: #89bdff;&quot;&gt;#!include auth-passwdfile.conf.ext  &lt;/span&gt;
&lt;span class=&quot;hljs-shebang&quot; style=&quot;color: #89bdff;&quot;&gt;#!include auth-checkpassword.conf.ext  &lt;/span&gt;
&lt;span class=&quot;hljs-shebang&quot; style=&quot;color: #89bdff;&quot;&gt;#!include auth-vpopmail.conf.ext  &lt;/span&gt;
&lt;span class=&quot;hljs-shebang&quot; style=&quot;color: #89bdff;&quot;&gt;#!include auth-static.conf.ext&lt;/span&gt;</pre><p><span id="OSC_h3_24"></span></p>
<h3>修改<code style="color: #40aa53;">/etc/dovecot/conf.d/auth-sql.conf.ext</code>文件</h3>
<p>在文件中加入如下内容：</p><pre class="crayon-plain-tag">passdb {  
    &lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;driver =&lt;/span&gt; sql  
    &lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;args =&lt;/span&gt; /etc/dovecot/dovecot-sql.conf.ext  
}  

userdb {  
    &lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;driver =&lt;/span&gt; static  
    &lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;args =&lt;/span&gt; &lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;uid=&lt;/span&gt;vmail &lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;gid=&lt;/span&gt;vmail &lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;home=&lt;/span&gt;/var/mail/vhosts/%d/%n  
}</pre><p><span id="OSC_h3_25"></span></p>
<h3>修改<code style="color: #40aa53;">/etc/dovecot/dovecot-sql.conf.ext</code>文件</h3>
<p>取消文件中<code style="color: #40aa53;">driver</code>行的注释，并将其修改为如下：</p><pre class="crayon-plain-tag">&lt;span class=&quot;hljs-attribute&quot;&gt;driver &lt;/span&gt;=&lt;span class=&quot;hljs-string&quot; style=&quot;color: #65b042;&quot;&gt; mysql
&lt;/span&gt;</pre><p>取消文件中<code style="color: #40aa53;">connect</code>行的注释，并将其修改为如下：</p><pre class="crayon-plain-tag">&lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;connect =&lt;/span&gt; &lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;host=&lt;/span&gt;&lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;127.0&lt;/span&gt;.&lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;0.1&lt;/span&gt; &lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;dbname=&lt;/span&gt;mailserver &lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;user=&lt;/span&gt;mailserver &lt;span class=&quot;hljs-variable&quot; style=&quot;color: #3e87e3;&quot;&gt;password=&lt;/span&gt;mailserver123</pre><p>取消文件中<code style="color: #40aa53;">default_pass_scheme</code>行的注释，并将其修改为如下：</p><pre class="crayon-plain-tag">&lt;span class=&quot;hljs-attribute&quot;&gt;default_pass_scheme &lt;/span&gt;=&lt;span class=&quot;hljs-string&quot; style=&quot;color: #65b042;&quot;&gt; SHA512-CRYPT
&lt;/span&gt;</pre><p>取消文件中<code style="color: #40aa53;">password_query</code>行的注释，并将起修改为如下：</p><pre class="crayon-plain-tag">password_query = &lt;span class=&quot;hljs-operator&quot;&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;SELECT&lt;/span&gt; email &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;user&lt;/span&gt;, &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;password&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;FROM&lt;/span&gt; virtual_users &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;WHERE&lt;/span&gt; email=&lt;span class=&quot;hljs-string&quot; style=&quot;color: #65b042;&quot;&gt;'%u'&lt;/span&gt;;&lt;/span&gt;</pre><p>保存退出</p>
<p>在命令行种输入如下内容以修改目录权限：</p><pre class="crayon-plain-tag">chown -R &lt;span class=&quot;hljs-string&quot; style=&quot;color: #65b042;&quot;&gt;vmail:&lt;/span&gt;dovecot &lt;span class=&quot;hljs-regexp&quot; style=&quot;color: #e9c062;&quot;&gt;/etc/&lt;/span&gt;dovecot

chmod -R o-rwx &lt;span class=&quot;hljs-regexp&quot; style=&quot;color: #e9c062;&quot;&gt;/etc/&lt;/span&gt;dovecot</pre><p><span id="OSC_h3_26"></span></p>
<h3>修改<code style="color: #40aa53;">/etc/dovecot/conf.d/10-master.conf</code>文件</h3>
<p>打开文件做如下修改「通过将端口设置为0，以禁用非SSL加密的IMAP和POP3协议」：</p><pre class="crayon-plain-tag">service imap-login {  
    inet_listener imap {  
        port = &lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;0&lt;/span&gt;   
    }  
    &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;...&lt;/span&gt;  
}  

service pop3-login {  
    inet_listener pop3 {  
        port = &lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;0&lt;/span&gt;  
    }  
    &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;...&lt;/span&gt;  
}</pre><p>找到文件中的<code style="color: #40aa53;">service lmtp</code>并将其修改如下：</p><pre class="crayon-plain-tag">&lt;span class=&quot;hljs-title&quot; style=&quot;color: #e28964;&quot;&gt;service&lt;/span&gt; lmtp {  
        &lt;span class=&quot;hljs-title&quot; style=&quot;color: #e28964;&quot;&gt;unix_listener&lt;/span&gt; /var/spool/postfix/private/dovecot-lmtp {  
        &lt;span class=&quot;hljs-title&quot; style=&quot;color: #e28964;&quot;&gt;mode&lt;/span&gt; = &lt;span class=&quot;hljs-number&quot; style=&quot;color: #3387cc;&quot;&gt;0600&lt;/span&gt;  
        user = postfix  
        group = postfix  
  }  

  &lt;span class=&quot;hljs-comment&quot; style=&quot;font-style: italic; color: #aeaeae;&quot;&gt;# Create inet listener only if you can't use the above UNIX socket  &lt;/span&gt;
  &lt;span class=&quot;hljs-comment&quot; style=&quot;font-style: italic; color: #aeaeae;&quot;&gt;#inet_listener lmtp {  &lt;/span&gt;
        &lt;span class=&quot;hljs-comment&quot; style=&quot;font-style: italic; color: #aeaeae;&quot;&gt;#Avoid making LMTP visible for the entire internet  &lt;/span&gt;
        &lt;span class=&quot;hljs-comment&quot; style=&quot;font-style: italic; color: #aeaeae;&quot;&gt;#address =  &lt;/span&gt;
        &lt;span class=&quot;hljs-comment&quot; style=&quot;font-style: italic; color: #aeaeae;&quot;&gt;#port =  &lt;/span&gt;
        &lt;span class=&quot;hljs-comment&quot; style=&quot;font-style: italic; color: #aeaeae;&quot;&gt;#}  &lt;/span&gt;
 }</pre><p>找到文件中<code style="color: #40aa53;">service auth</code>并将其内容修改如下：</p><pre class="crayon-plain-tag">service auth {  
    &lt;span class=&quot;hljs-comment&quot; style=&quot;font-style: italic; color: #aeaeae;&quot;&gt;# auth_socket_path points to this userdb socket by default. It's typically  &lt;/span&gt;
    &lt;span class=&quot;hljs-comment&quot; style=&quot;font-style: italic; color: #aeaeae;&quot;&gt;# used by dovecot-lda, doveadm, possibly imap process, etc. Its default  &lt;/span&gt;
    &lt;span class=&quot;hljs-comment&quot; style=&quot;font-style: italic; color: #aeaeae;&quot;&gt;# permissions make it readable only by root, but you may need to relax these  &lt;/span&gt;
    &lt;span class=&quot;hljs-comment&quot; style=&quot;font-style: italic; color: #aeaeae;&quot;&gt;# permissions. Users that have access to this socket are able to get a list  &lt;/span&gt;
    &lt;span class=&quot;hljs-comment&quot; style=&quot;font-style: italic; color: #aeaeae;&quot;&gt;# of all usernames and get results of everyone's userdb lookups.  &lt;/span&gt;

    unix_listener /var/spool/postfix/private/auth {  
            mode = 0666  
            &lt;span class=&quot;hljs-built_in&quot;&gt;user&lt;/span&gt; = postfix  
            group = postfix  
    }  

    unix_listener auth-userdb {  
            mode = 0600  
            &lt;span class=&quot;hljs-built_in&quot;&gt;user&lt;/span&gt; = vmail  
            &lt;span class=&quot;hljs-comment&quot; style=&quot;font-style: italic; color: #aeaeae;&quot;&gt;#group =  &lt;/span&gt;
    }  

    &lt;span class=&quot;hljs-comment&quot; style=&quot;font-style: italic; color: #aeaeae;&quot;&gt;# Postfix smtp-auth  &lt;/span&gt;
    &lt;span class=&quot;hljs-comment&quot; style=&quot;font-style: italic; color: #aeaeae;&quot;&gt;#unix_listener /var/spool/postfix/private/auth {  &lt;/span&gt;
    &lt;span class=&quot;hljs-comment&quot; style=&quot;font-style: italic; color: #aeaeae;&quot;&gt;#       mode = 0666  &lt;/span&gt;
    &lt;span class=&quot;hljs-comment&quot; style=&quot;font-style: italic; color: #aeaeae;&quot;&gt;#}  &lt;/span&gt;

    &lt;span class=&quot;hljs-comment&quot; style=&quot;font-style: italic; color: #aeaeae;&quot;&gt;# Auth process is run as this user.  &lt;/span&gt;
    &lt;span class=&quot;hljs-built_in&quot;&gt;user&lt;/span&gt; = dovecot  
}</pre><p>找到文件中<code style="color: #40aa53;">service auth-worker</code>内容并修改如下：</p><pre class="crayon-plain-tag">service auth-worker {  
    &lt;span class=&quot;hljs-comment&quot; style=&quot;font-style: italic; color: #aeaeae;&quot;&gt;# Auth worker process is run as root by default, so that it can access  &lt;/span&gt;
    &lt;span class=&quot;hljs-comment&quot; style=&quot;font-style: italic; color: #aeaeae;&quot;&gt;# /etc/shadow. If this isn't necessary, the user should be changed to  &lt;/span&gt;
    &lt;span class=&quot;hljs-comment&quot; style=&quot;font-style: italic; color: #aeaeae;&quot;&gt;# $default_internal_user.  &lt;/span&gt;

    &lt;span class=&quot;hljs-built_in&quot;&gt;user&lt;/span&gt; = vmail  
}</pre><p><span id="OSC_h3_27"></span></p>
<h3>修改<code style="color: #40aa53;">/etc/dovecot/conf.d/10-ssl.conf</code>文件</h3>
<p>找到文件中<code style="color: #40aa53;">ssl_cert</code>并修改内容如下「请确保dovecot的pem文件已经存在，如果大家使用了自己的SSL文件，请将如下内容修改为相应的路径」：</p><pre class="crayon-plain-tag">ssl_cert = &amp;lt;/etc/dovecot/dovecot&lt;span class=&quot;hljs-class&quot;&gt;.pem&lt;/span&gt;  
ssl_key = &amp;lt;/etc/dovecot/private/dovecot&lt;span class=&quot;hljs-class&quot;&gt;.pem&lt;/span&gt;</pre><p>强制用户使用SSL加密：</p><pre class="crayon-plain-tag">&lt;span class=&quot;hljs-attribute&quot;&gt;ssl &lt;/span&gt;=&lt;span class=&quot;hljs-string&quot; style=&quot;color: #65b042;&quot;&gt; required
&lt;/span&gt;</pre><p>重新启动Dovecot服务：</p><pre class="crayon-plain-tag">&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: #e28964;&quot;&gt;service&lt;/span&gt; dovecot &lt;span class=&quot;hljs-literal&quot;&gt;restart&lt;/span&gt;</pre><p><span id="OSC_h2_28"></span></p>
<h2>测试邮件服务器是否正常</h2>
<p>设置一个帐号，可以向MySQL对应的表中插入数据，接下来使用邮件客户端来测试一下。推荐使用<code style="color: #40aa53;">Thunderbird</code>邮件客户端或者<code style="color: #40aa53;">Foxmail</code>客户端等。请注意以下内容：</p>
<ul>
<li>邮箱的全称「包括后面的@mydomain.com」将作为用户名</li>
<li>邮箱密码是MySQL数据库种对应邮箱的密码</li>
<li>服务器相关接口是否全部开放？993、995、25等</li>
<li>邮件收发的所有协议，包括IMAP、POP3、SMTP全部都需要开启SSL加密</li>
</ul>
<p>配置好客户端之后即可连接获取、发送邮件。</p>
</div>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=1325</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>为什么要设置“Ctrl+Alt+Del 登录”的方式</title>
		<link>https://www.softwareace.cn/?p=1305</link>
		<comments>https://www.softwareace.cn/?p=1305#comments</comments>
		<pubDate>Tue, 21 Apr 2015 03:37:22 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[系统]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=1305</guid>
		<description><![CDATA[“Ctrl+Alt+Del 登录”又称为安全登录。因为当你在登录时有些病毒或木马什么的会用一个假冒的窗口骗你输 [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>“Ctrl+Alt+Del 登录”又称为安全登录。因为当你在登录时有些病毒或木马什么的会用一个假冒的窗口骗你输入用户名和密码。窃取了你的登录密码之后可以对你的机器作进一步破坏。</p>
<p>安全登录的作用就是防止这种密码窃取。（因为 Ctrl+Alt+Del 组合键只有操作系统本身才能识别，我们由此来保证用这个组合键打开的窗口为真正的系统登录窗口。）</p>
<div class="kb_nowrapper" translate="false">
<div class="kb_nowrapper"></div>
<div class="kb_nowrapper"></div>
<p><img class="graphic" title="ekbtips" src="https://az623152.vo.msecnd.net/library/images/support/kbgraphics/public/zh-cn/eeekb/ekbtips.png" alt="ekbtips" /></div>
<h3 id="tocHeadRef" style="font-weight: lighter;"><span id="MT2"><a id="section2" style="color: #323232;"></a></span>怎么设置？</h3>
<ol>
<li>开始 -&gt; 在<strong class="uiterm">开始搜索</strong>里打上 <span class="userInput" style="font-weight: bold;">netplwiz</span> -&gt; 回车。
<div class="kb_nowrapper" translate="false">
<div class="kb_nowrapper"></div>
<div class="kb_nowrapper"></div>
<p><img class="graphic" title="打开对话框" src="https://az623152.vo.msecnd.net/library/images/support/kbgraphics/public/zh-cn/968707/01.png" alt="打开对话框" /></div>
<div class="kb_nowrapper" translate="false">
<div class="kb_nowrapper"></div>
<div class="kb_nowrapper"></div>
<p><img class="graphic" title="UAC" src="https://az623152.vo.msecnd.net/library/images/support/kbgraphics/public/en-us/securityshield.jpg" alt="UAC" /></div>
<p>如果你看到一个<strong class="uiterm">Windows 需要您的许可才能继续</strong>的消息，别奇怪，点一下<strong class="uiterm">继续</strong>确认就行。（Vista 的新的安全特性，一切都是为了你好，别嫌麻烦。）</li>
<li>点开<strong class="uiterm">高级</strong>选项卡，把<strong class="uiterm">要求用户按 Ctrl + Alt + Delete </strong>勾上，按<strong class="uiterm">确定</strong>。
<div class="kb_nowrapper" translate="false">
<div class="kb_nowrapper"></div>
<div class="kb_nowrapper"></div>
<p><img class="graphic" title="高级选项" src="https://az623152.vo.msecnd.net/library/images/support/kbgraphics/public/zh-cn/968707/02.png" alt="高级选项" /></div>
</li>
<li>每次登录前会出现这个界面，按 Ctrl + Alt + Delete 然后就能正常登录了。
<div class="kb_nowrapper" translate="false">
<div class="kb_nowrapper"></div>
<div class="kb_nowrapper"></div>
<p><img class="graphic" title="登录前界面" src="https://az623152.vo.msecnd.net/library/images/support/kbgraphics/public/zh-cn/968707/03.png" alt="登录前界面" /></div>
</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=1305</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>制作真正可以用Ｕ盘启动的mac air的启动盘（图解）</title>
		<link>https://www.softwareace.cn/?p=773</link>
		<comments>https://www.softwareace.cn/?p=773#comments</comments>
		<pubDate>Thu, 03 Apr 2014 07:19:09 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[系统]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=773</guid>
		<description><![CDATA[今天写这个图解说明，一是因为我最近给朋友的air电脑安装windows系统，中间遇到了一些问题，求解无门，所以 [&#8230;]]]></description>
				<content:encoded><![CDATA[<p align="center">今天写这个图解说明，一是因为我最近给朋友的air电脑安装windows系统，中间遇到了一些问题，求解无门，所以我一直在网上找到一篇能从头到尾，完整说明如果制作的教程，结果没有，至少我是认为网上有些文章不完全，或者说的不透彻。最后我经过多次试验终于找到了解决的方法.</p>
<p> <wbr /> <wbr /> <wbr /> 我本来是不知道苹果电脑是可以用Ｕ盘制作Pe系统来安装windows的，之间我刚好有两台air，都是朋友让我安装windows系统的，一台是一年前购买的第一代的air，装的苹果豹系统；而另一台是刚从美国带回来的，安装了苹果公司最新的Lion系统。当时我按网上的教程制作了一个windows7的启动盘，然后先对Lion系统的air电脑进行安装，开机按住Option（alt）键，顺利进入windows7的安装向导，成功完成安装；当我拿着这个Ｕ盘去安装豹系统的air电脑时，却发现开机时按住option(alt),电脑根本不能识别这个Ｕ盘。这说明新版的lion对Ｕ盘的支持度已经提高，明显优于豹系统，这种情况下，我又按另外的教程先进入豹系统，通过camp程序进行安装，但是camp总是提示，分区有问题，必须先将分区结构处理好才行，我弄了半天也没搞定，最糟糕的是重启后连豹系统也丢失了，整个电脑处于瘫痪状态，这时没办法，我手头也没有苹果的安装盘，只有拿给专卖店处理了。</p>
<p>到了专卖店，我让店员帮我重装，他们说要80元的安装费，因为我朋友这台air已经过了保修期了，最后我软磨硬泡才让他们答应免费安装，这时店员拿出了两个Ｕ盘，一个Ｕ盘里是Win PE系统，另一个是windows的原版安装盘，他们先用Pe的Ｕ盘启动入系统看一下分区情况，另一个Ｕ盘则进入windows安装系统进行分区后退出，再用PE的Ｕ盘进行ghost，将winXP,安装到了系统里，这样整个过程很快结束，我这时才知道真的可以制作一个启动mac电脑的PE系统。因为当时装好后，也可以用了，我也就没深究，可是没多少时间，我朋友告诉我说上次装的win XP SP3系统在苹果电脑里使用外接音箱会有问题，让我重新安装winSP2 ,或者win7，这时我遇到难题了，他的电脑没有苹果系统了，只能u盘安装，我而手头制作的Pe系统都不能被识别，无法启动，于是我就去那家专卖店，希望他们能告诉我是如何制启动U盘的，或者帮我制作一个，可是店员的回答让我很无奈，他们说这个是他们公司的工程师制作的，他们也不会，这摆明是不想告诉我，让他们帮我重装又要80块，倒不是我不舍得这80块，而是我要一劳永逸的解决这个问题，如果这次不解决，下次还要一个80元，这就没有休止了，所以我不甘心，因为我始终认为，这种东西的技术含量并不高，自己从网上应该可以找到答案，就凭本地的这些卖电脑的商家来分析，他们根本不具备掌握什么所谓的高端技术，都是些土包子，还搞起来神密兮兮的，装B呀，何况PE系统本身就是共享的，又不是他们开发的，问题就出在启动分区方面，于是我又去网上学习了几天，这时遇到一个电脑市场的熟人，他说他们公司可以帮我制作，于是我很高兴，当时我手头已经有２个８Ｇ的金士顿U盘和１个16Ｇ的金士顿U盘了，可是我为了尽快拿到这个启动Ｕ盘，我让对方直接从他们公司拿一个全新的帮我制作，然后制作完后，让他们联系我，我去取，结果没过多少时间，对方电话过来让我去取了，为了能保证这个Ｕ盘没问题，我特地带了苹果电脑过去，结果一试还是不行，我问对方为什么启不起来呀，他却说：我的电脑都可以启动的呀，我们这里不会作苹果的启动盘的，我一看他的电脑是PC机，心里暗骂，pc的启动盘，老子还用得着你来制作，快死开去。</p>
<p><wbr /> <wbr /> <wbr /> 看来没办法了，死马当活马医了，我又去网上找攻略，之前我看网上说用量产的老毛桃PE系统可以制作启动苹果的u盘，所以我决定试一下，结果成功了，我非常高兴，现在我就把这个过程，写下来，让大伙都可以把苹果电脑玩得转。，我而且网上许多文章或个人也明确说这是不可能的，我知所以后来能认定可以，是</p>
<p>我之前也试过很多Pe制作系统，但直接用PE制作系统制作的启动盘是启动不到苹果电脑的，后来又试过fbinst多个版，也不行。又下载了iATKOS_v7_变色龙多启动系统，但这个我还没试，看起来也挺复杂，还下载了远景论坛里的kalyway_10.5.2_dvd_Intel_amd，大小3.66G,,这个也很大，也没试过，之后我直接试了量产工具，成功了。</p>
<p>完整制作过程如下：</p>
<p>１、准备的硬件：U盘，4G或8G都可以</p>
<p>下面以我的是8G的金士顿U盘为例</p>
<p><a href="http://photo.blog.sina.com.cn/showpic.html#blogid=50860b8501017x4q&amp;url=http://s8.sinaimg.cn/orignal/89c742b2g77865f894587" target="_blank"><img title="[转载]制作真正可以用Ｕ盘启动的mac &lt;wbr&gt;air的启动盘（图解）" alt="[转载]制作真正可以用Ｕ盘启动的mac &lt;wbr&gt;air的启动盘（图解）" src="http://s8.sinaimg.cn/middle/89c742b2g77865f894587&amp;690" width="300" height="157" name="image_operate_71561314377543706" /></a></p>
<p><wbr /></p>
<p>2、准备的软件：</p>
<p>A、GetInfo，这个软件是看你的U盘信息的，这个很重要，只有根据这个信息才可以去找到适合你量产的软件</p>
<p>B、群联Phsion 量产工具Mpall v3.20.00版(注意量产工具一定要根据自己U盘型号去下载，我这款是金士顿的)</p>
<p>C、老毛桃的PE系统，支持光盘启动的</p>
<p><wbr /></p>
<p>(这里说明一下，为什么量产的工具会成功，我个人认为，主要是产量工具一个很重要的功能，就是把你的<span style="font-family: Calibri;">U</span>盘分成２个区，<span style="font-family: Calibri;">boot</span>区是模拟成了<span style="font-family: Calibri;">cd-rom,</span>而正是这个功能，使得<span style="font-family: Calibri;">mac</span>电脑识别了<span style="font-family: Calibri;">U</span>盘，并启动了<span style="font-family: Calibri;">Pe</span>系统)</p>
<p><wbr /></p>
<p>步骤如下：</p>
<p>1、首先打开getInfo，注意打开这个文件前先检查一下你的系统是不是windows　xp因为目前这些程序都是在xp系统下开发的，所以最好在xp系统下运行，当然win7下也可以运行，但可能不稳定，我当时是在win7下运行，其次一定要把电脑里其他的usb硬件全部取出来，不可以插在电脑里。以上两点非常重要，一定要照作，否则打开getinfo文件后，你看到的一些数据都将是错误的，会影响到你寻找相应的量产软件。</p>
<p><a href="http://photo.blog.sina.com.cn/showpic.html#blogid=50860b8501017x4q&amp;url=http://s10.sinaimg.cn/orignal/89c742b2gab3fd1a260a9" target="_blank"><img title="[转载]制作真正可以用Ｕ盘启动的mac &lt;wbr&gt;air的启动盘（图解）" alt="[转载]制作真正可以用Ｕ盘启动的mac &lt;wbr&gt;air的启动盘（图解）" src="http://s10.sinaimg.cn/middle/89c742b2gab3fd1a260a9&amp;690" width="370" height="88" name="image_operate_48511314190481066" /></a></p>
<p>打开getinfo文件后，出现弹出窗口，如下</p>
<p><a href="http://photo.blog.sina.com.cn/showpic.html#blogid=50860b8501017x4q&amp;url=http://s10.sinaimg.cn/orignal/89c742b2gab6ada9eeb59" target="_blank"><img title="[转载]制作真正可以用Ｕ盘启动的mac &lt;wbr&gt;air的启动盘（图解）" alt="[转载]制作真正可以用Ｕ盘启动的mac &lt;wbr&gt;air的启动盘（图解）" src="http://s10.sinaimg.cn/middle/89c742b2gab6ada9eeb59&amp;690" name="image_operate_31701314375567252" /></a><br />
因为getinfo的版本较多，所以界面会有所不同，我的版本是3.7.1.2，具体看你下载哪版，但总体结构还是差不多的，打开后请在左上角“驱动器”旁边输入你的U盘的盘符，我的U盘当前是N盘，所以输入“n”然后点“读取”，之后就会出现下面的数据，然后为了以后量产失败方便恢复，参数读取后，请务必点右上角的“保存到文件”，因为这些参数非常重要,主要关注的几个数据是VID、PID、主控版本</p>
<p><a href="http://photo.blog.sina.com.cn/showpic.html#blogid=50860b8501017x4q&amp;url=http://s10.sinaimg.cn/orignal/89c742b2gab6aeac88bf9" target="_blank"><img title="[转载]制作真正可以用Ｕ盘启动的mac &lt;wbr&gt;air的启动盘（图解）" alt="[转载]制作真正可以用Ｕ盘启动的mac &lt;wbr&gt;air的启动盘（图解）" src="http://s10.sinaimg.cn/middle/89c742b2gab6aeac88bf9&amp;690" name="image_operate_36081314375679823" /></a></p>
<p>保存为后缀为enc文件后，不要关闭这个窗口，之后进入量产工具的文件夹，即“群联Phsion 量产工具Mpall v3.20.00版(含Flash支持列表）”文件夹，会看到以下文件</p>
<p><a href="http://photo.blog.sina.com.cn/showpic.html#blogid=50860b8501017x4q&amp;url=http://s5.sinaimg.cn/orignal/89c742b2gab6af209eca4" target="_blank"><img title="[转载]制作真正可以用Ｕ盘启动的mac &lt;wbr&gt;air的启动盘（图解）" alt="[转载]制作真正可以用Ｕ盘启动的mac &lt;wbr&gt;air的启动盘（图解）" src="http://s5.sinaimg.cn/middle/89c742b2gab6af209eca4&amp;690" name="image_operate_45641314375800243" /></a></p>
<p>其中<span style="font-family: Calibri;">MPALL_F1_7F00_DL07_v320_00.exe</span>和<span style="font-family: Calibri;">MPALL_F2_v320_00.exe</span>都是量产工具了，选其一即可，现在我们就打开<span style="font-family: Calibri;">MPALL_F1_7F00_DL07_v320_00.exe</span>文件，出现如下突出窗口</p>
<p><wbr /><a href="http://photo.blog.sina.com.cn/showpic.html#blogid=50860b8501017x4q&amp;url=http://s1.sinaimg.cn/orignal/89c742b2gab6af80aabe0" target="_blank"><img title="[转载]制作真正可以用Ｕ盘启动的mac &lt;wbr&gt;air的启动盘（图解）" alt="[转载]制作真正可以用Ｕ盘启动的mac &lt;wbr&gt;air的启动盘（图解）" src="http://s1.sinaimg.cn/middle/89c742b2gab6af80aabe0&amp;690" name="image_operate_82891314376005238" /></a></p>
<p>出现的都是英文，可以点右上部的繁体中文，就可以显示中文了，（居然没有简体中文），然后点setting,按图示的选择“advance setting”和“new setting”然后点ok</p>
<p><a href="http://photo.blog.sina.com.cn/showpic.html#blogid=50860b8501017x4q&amp;url=http://s2.sinaimg.cn/orignal/89c742b2gab6afebb0fa1" target="_blank"><img title="[转载]制作真正可以用Ｕ盘启动的mac &lt;wbr&gt;air的启动盘（图解）" alt="[转载]制作真正可以用Ｕ盘启动的mac &lt;wbr&gt;air的启动盘（图解）" src="http://s2.sinaimg.cn/middle/89c742b2gab6afebb0fa1&amp;690" name="image_operate_49231314375939221" /></a><br />
<a href="http://photo.blog.sina.com.cn/showpic.html#blogid=50860b8501017x4q&amp;url=http://s13.sinaimg.cn/orignal/89c742b2gab6b00dd0a6c" target="_blank"><img title="[转载]制作真正可以用Ｕ盘启动的mac &lt;wbr&gt;air的启动盘（图解）" alt="[转载]制作真正可以用Ｕ盘启动的mac &lt;wbr&gt;air的启动盘（图解）" src="http://s13.sinaimg.cn/middle/89c742b2gab6b00dd0a6c&amp;690" name="image_operate_37491314376010981" /></a><br />
又全部是英文，这时可以点右边的简体中文，终于有简体了，可以看清楚了</p>
<p><a href="http://photo.blog.sina.com.cn/showpic.html#blogid=50860b8501017x4q&amp;url=http://s1.sinaimg.cn/orignal/89c742b2gab6b04c396a0" target="_blank"><img title="[转载]制作真正可以用Ｕ盘启动的mac &lt;wbr&gt;air的启动盘（图解）" alt="[转载]制作真正可以用Ｕ盘启动的mac &lt;wbr&gt;air的启动盘（图解）" src="http://s1.sinaimg.cn/middle/89c742b2gab6b04c396a0&amp;690" name="image_operate_55311314376118436" /></a></p>
<p>先是第一个IC_fw,</p>
<p>主控选项，可以选择的，这时你要切换到getinfo，在这里有显示你的U盘的主控版本，<a href="http://photo.blog.sina.com.cn/showpic.html#blogid=50860b8501017x4q&amp;url=http://s15.sinaimg.cn/orignal/89c742b2gab6b074575be" target="_blank"><img title="[转载]制作真正可以用Ｕ盘启动的mac &lt;wbr&gt;air的启动盘（图解）" alt="[转载]制作真正可以用Ｕ盘启动的mac &lt;wbr&gt;air的启动盘（图解）" src="http://s15.sinaimg.cn/middle/89c742b2gab6b074575be&amp;690" name="image_operate_73711314376093279" /></a></p>
<p>我这个是<span style="font-family: Calibri;">2251-60 / 90</span>，下拉选择中有<span style="font-family: Calibri;">2251-60</span>和<span style="font-family: Calibri;">2251-90</span>的选择，我就选<span style="font-family: Calibri;">2252-60</span>。</p>
<p>然后选FC1－FC2 0Xff ，这个数据也可以从getinfo中得到，我这个是01</p>
<p>所以这个页面我最终的显示如下，</p>
<p>填好后的图示如下</p>
<p><a href="http://photo.blog.sina.com.cn/showpic.html#blogid=50860b8501017x4q&amp;url=http://s9.sinaimg.cn/orignal/89c742b2gab6b0d0c51a8" target="_blank"><img title="[转载]制作真正可以用Ｕ盘启动的mac &lt;wbr&gt;air的启动盘（图解）" alt="[转载]制作真正可以用Ｕ盘启动的mac &lt;wbr&gt;air的启动盘（图解）" src="http://s9.sinaimg.cn/middle/89c742b2gab6b0d0c51a8&amp;690" name="image_operate_68981314376205300" /></a></p>
<p>切记，造成不要把烧入固件的勾打起来</p>
<p>之后页面的数据都可以从getinfo中取得，我不一一说明，只显示最终图示</p>
<p><a href="http://photo.blog.sina.com.cn/showpic.html#blogid=50860b8501017x4q&amp;url=http://s15.sinaimg.cn/orignal/89c742b2gab6b109f6c6e" target="_blank"><img title="[转载]制作真正可以用Ｕ盘启动的mac &lt;wbr&gt;air的启动盘（图解）" alt="[转载]制作真正可以用Ｕ盘启动的mac &lt;wbr&gt;air的启动盘（图解）" src="http://s15.sinaimg.cn/middle/89c742b2gab6b109f6c6e&amp;690" name="image_operate_77261314376245328" /></a></p>
<p><wbr /><a href="http://photo.blog.sina.com.cn/showpic.html#blogid=50860b8501017x4q&amp;url=http://s2.sinaimg.cn/orignal/89c742b2gab6b131d7b21" target="_blank"><img title="[转载]制作真正可以用Ｕ盘启动的mac &lt;wbr&gt;air的启动盘（图解）" alt="[转载]制作真正可以用Ｕ盘启动的mac &lt;wbr&gt;air的启动盘（图解）" src="http://s2.sinaimg.cn/middle/89c742b2gab6b131d7b21&amp;690" name="image_operate_18341314376256058" /></a><br />
此页面非常重要，在此说明一下</p>
<p>1、 <wbr /> 分区选2个</p>
<p><b>2、</b> 分区1请选cd-rom</p>
<p><b>3、</b> Cd镜像就是你的PE打包文件所在的文件夹，格式只能是bin和iso,这个很重要，一定要选对，我的是用老毛桃的可以cd-rom启动的“[.能用优盘启动的WinPE].BootCD.ISO”</p>
<p><b>4、</b> 分区2请用默认的上“卸除式磁碟”</p>
<p><b>5、</b> 安全区标识，你可以改成自己喜欢的名字，这个可改可不改</p>
<p>其他地方都不要动了，这样进入下一个页面</p>
<p><a href="http://photo.blog.sina.com.cn/showpic.html#blogid=50860b8501017x4q&amp;url=http://s13.sinaimg.cn/orignal/89c742b2gab6b155a248c" target="_blank"><img title="[转载]制作真正可以用Ｕ盘启动的mac &lt;wbr&gt;air的启动盘（图解）" alt="[转载]制作真正可以用Ｕ盘启动的mac &lt;wbr&gt;air的启动盘（图解）" src="http://s13.sinaimg.cn/middle/89c742b2gab6b155a248c&amp;690" name="image_operate_3001314377470637" /></a></p>
<p>这个页面请不要用自动侦测，请看我用了自动侦测后，显示的<span style="font-family: Calibri;">vid</span>和<span style="font-family: Calibri;">pid</span>的数据与<span style="font-family: Calibri;">getinfo</span>中的<span style="font-family: Calibri;">vid</span>和<span style="font-family: Calibri;">pid</span>是不同的，所以要把自动侦测的勾去掉，请看下面这个正确的图示</p>
<p><a href="http://photo.blog.sina.com.cn/showpic.html#blogid=50860b8501017x4q&amp;url=http://s1.sinaimg.cn/orignal/89c742b2gab6b177d6ba0" target="_blank"><img title="[转载]制作真正可以用Ｕ盘启动的mac &lt;wbr&gt;air的启动盘（图解）" alt="[转载]制作真正可以用Ｕ盘启动的mac &lt;wbr&gt;air的启动盘（图解）" src="http://s1.sinaimg.cn/middle/89c742b2gab6b177d6ba0&amp;690" name="image_operate_60871314376378642" /></a></p>
<p>上图为正解，填入的数据千万不要自动侦测，一定要按照getinfo程序中显示的数据填入。</p>
<p>好了到此就把设置准备好了，先按“保存”，然后将该设置按“存贮为”导出成一个ini文件备份。</p>
<p>现在关闭这个窗口，回到前面的<span style="font-family: Calibri;">mpall</span>窗口</p>
<p><wbr /></p>
<p><a href="http://photo.blog.sina.com.cn/showpic.html#blogid=50860b8501017x4q&amp;url=http://s8.sinaimg.cn/orignal/89c742b2gab6b1b01f6c7" target="_blank"><img title="[转载]制作真正可以用Ｕ盘启动的mac &lt;wbr&gt;air的启动盘（图解）" alt="[转载]制作真正可以用Ｕ盘启动的mac &lt;wbr&gt;air的启动盘（图解）" src="http://s8.sinaimg.cn/middle/89c742b2gab6b1b01f6c7&amp;690" name="image_operate_72151314376715088" /></a><br />
先点“updat”点完这个钮后，“start”钮会亮起来，然后再点“start”,之后等等进程条走完，显示“finsh。。。。。。。。。。。。。。。。”后面的英文不记得了，这样一个可以启动苹果电脑的PE系统就安装好了，拿着他安装吧。</p>
<p>请看我用制作的PE系统U盘进行安装的图片吧，很给力吧</p>
<p><a href="http://photo.blog.sina.com.cn/showpic.html#blogid=50860b8501017x4q&amp;url=http://s8.sinaimg.cn/orignal/89c742b2gab6b2f271547" target="_blank"><img title="[转载]制作真正可以用Ｕ盘启动的mac &lt;wbr&gt;air的启动盘（图解）" alt="[转载]制作真正可以用Ｕ盘启动的mac &lt;wbr&gt;air的启动盘（图解）" src="http://s8.sinaimg.cn/middle/89c742b2gab6b2f271547&amp;690" name="image_operate_25451314377246615" /></a></p>
<p>各位请看，我的金士顿U盘就插在右边，显示屏上显示了我们U盘第一个cd-rom分区，而且我这台电脑里连mac系统也已经不存在了，只有分区后的windows区和u盘显示，说明完全不需要mac系统也可以安装，更不需要在mac里安装那个 rEFIt软件，一切ok</p>
<p><a href="http://photo.blog.sina.com.cn/showpic.html#blogid=50860b8501017x4q&amp;url=http://s7.sinaimg.cn/orignal/89c742b2gab6b4f134a56" target="_blank"><img title="[转载]制作真正可以用Ｕ盘启动的mac &lt;wbr&gt;air的启动盘（图解）" alt="[转载]制作真正可以用Ｕ盘启动的mac &lt;wbr&gt;air的启动盘（图解）" src="http://s7.sinaimg.cn/middle/89c742b2gab6b4f134a56&amp;690" name="image_operate_23291314377410379" /></a><br />
已经进行ghost了<br />
<a href="http://photo.blog.sina.com.cn/showpic.html#blogid=50860b8501017x4q&amp;url=http://s3.sinaimg.cn/orignal/89c742b2gab6b58c1c3f2" target="_blank"><img title="[转载]制作真正可以用Ｕ盘启动的mac &lt;wbr&gt;air的启动盘（图解）" alt="[转载]制作真正可以用Ｕ盘启动的mac &lt;wbr&gt;air的启动盘（图解）" src="http://s3.sinaimg.cn/middle/89c742b2gab6b58c1c3f2&amp;690" name="image_operate_22481314377452361" /></a></p>
<p><a href="http://photo.blog.sina.com.cn/showpic.html#blogid=50860b8501017x4q&amp;url=http://s12.sinaimg.cn/orignal/89c742b2gab6b5b24573b" target="_blank"><img title="[转载]制作真正可以用Ｕ盘启动的mac &lt;wbr&gt;air的启动盘（图解）" alt="[转载]制作真正可以用Ｕ盘启动的mac &lt;wbr&gt;air的启动盘（图解）" src="http://s12.sinaimg.cn/middle/89c742b2gab6b5b24573b&amp;690" name="image_operate_62971314668371078" /></a></p>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=773</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mac 下格式化U盘出错</title>
		<link>https://www.softwareace.cn/?p=772</link>
		<comments>https://www.softwareace.cn/?p=772#comments</comments>
		<pubDate>Thu, 03 Apr 2014 05:47:40 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[系统]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=772</guid>
		<description><![CDATA[U盘在Windows下格式划为 exFAT，即可]]></description>
				<content:encoded><![CDATA[<p>U盘在Windows下格式划为 exFAT，即可</p>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=772</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OS X 10.9的BootCamp助理改Info.plist后闪退的解决方法</title>
		<link>https://www.softwareace.cn/?p=771</link>
		<comments>https://www.softwareace.cn/?p=771#comments</comments>
		<pubDate>Thu, 03 Apr 2014 05:27:29 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[系统]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=771</guid>
		<description><![CDATA[[crayon-69feb06cc6d71202079243/] &#160;]]></description>
				<content:encoded><![CDATA[<p></p><pre class="crayon-plain-tag">sudo codesign -fs - /Applications/Utilities/Boot\ Camp\ Assistant.app</pre><p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=771</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>解决bootcamp显示“启动磁盘不能被分区或恢复成单个分区</title>
		<link>https://www.softwareace.cn/?p=770</link>
		<comments>https://www.softwareace.cn/?p=770#comments</comments>
		<pubDate>Thu, 03 Apr 2014 02:49:55 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[系统]]></category>
		<category><![CDATA[mac]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=770</guid>
		<description><![CDATA[造成这个原因是因为你多分区了，而bootcamp不能管理多个分区，解决方法很简单哦！ 打开终端：输入下面的代码 [&#8230;]]]></description>
				<content:encoded><![CDATA[<h1><span><a href="http://photo.blog.sina.com.cn/showpic.html#blogid=491eadbb0100r417&amp;url=http://s6.sinaimg.cn/orignal/491eadbbga2d4ce1699f5" target="_blank"><img title="解决bootcamp显示“启动磁盘不能被分区或恢复成单个分区。”" alt="解决bootcamp显示“启动磁盘不能被分区或恢复成单个分区。”" src="http://s6.sinaimg.cn/middle/491eadbbga2d4ce1699f5&amp;690" width="578" height="283" name="image_operate_22691304934788988" /></a></p>
<p></span></h1>
<h1><span>造成这个原因是因为你多分区了，而bootcamp不能管理多个分区，解决方法很简单哦！</span></h1>
<p>打开终端：输入下面的代码<br />
<span style="font-family: arial;"><span style="font-size: large;"><span style="font-size: small;">sudo diskutil list</span></span></span><br />
提示输入密码</p>
<p><span style="font-family: arial;"><span style="font-size: large;"><span style="font-size: small;">然后运行命令<br />
</span></span></span><span style="font-family: arial;"><span style="font-size: large;"><span style="font-size: small;">diskutil eraseVolume JHFS+ XXX <span>disk0s3</span></span></span></span></p>
<p>会列出你当前苹果系统的分区情况<br />
其中xxx　可以随便取，比如我取book</p>
<div><a href="http://photo.blog.sina.com.cn/showpic.html#blogid=491eadbb0100r417&amp;url=http://s1.sinaimg.cn/orignal/491eadbbga2d517333ff0" target="_blank"><img title="解决bootcamp显示“启动磁盘不能被分区或恢复成单个分区。”" alt="解决bootcamp显示“启动磁盘不能被分区或恢复成单个分区。”" src="http://s1.sinaimg.cn/middle/491eadbbga2d517333ff0&amp;690" width="690" height="450" name="image_operate_86411304936017961" /></a></p>
<p><a href="http://photo.blog.sina.com.cn/showpic.html#blogid=491eadbb0100r417&amp;url=http://s11.sinaimg.cn/orignal/491eadbbga2d5176dc9fa" target="_blank"><img title="解决bootcamp显示“启动磁盘不能被分区或恢复成单个分区。”" alt="解决bootcamp显示“启动磁盘不能被分区或恢复成单个分区。”" src="http://s11.sinaimg.cn/middle/491eadbbga2d5176dc9fa&amp;690" width="690" height="555" /></a></p>
<p><a href="http://photo.blog.sina.com.cn/showpic.html#blogid=491eadbb0100r417&amp;url=http://s16.sinaimg.cn/orignal/491eadbbga2d517a74b9f" target="_blank"><img title="解决bootcamp显示“启动磁盘不能被分区或恢复成单个分区。”" alt="解决bootcamp显示“启动磁盘不能被分区或恢复成单个分区。”" src="http://s16.sinaimg.cn/middle/491eadbbga2d517a74b9f&amp;690" /></a></p>
<p><span style="font-family: arial;"><span style="font-size: large;"><span style="font-size: small;">找到想删掉的 分区，看他对应的<span>IDENTIFIER</span>是多少（最后一列），千万别搞错，<br />
我的机器上想删掉的分区对应的是 disk0s3</span></span></span></p>
<p><span style="font-family: arial;"><span style="font-size: large;"><span style="font-size: small;">diskutil eraseVolume JHFS+ book <span>disk0s3</span></span></span></span>　运行命令后，<br />
会抹掉你不想要的分区，打开磁盘工具合并即可<br />
顺便修复下磁盘权限。<br />
下面是我抹掉不想要的分区后的截图，<br />
<a href="http://photo.blog.sina.com.cn/showpic.html#blogid=491eadbb0100r417&amp;url=http://s8.sinaimg.cn/orignal/491eadbbga1b9338d0647" target="_blank"><img title="解决bootcamp显示“启动磁盘不能被分区或恢复成单个分区。”" alt="解决bootcamp显示“启动磁盘不能被分区或恢复成单个分区。”" src="http://s8.sinaimg.cn/middle/491eadbbga1b9338d0647&amp;690" width="561" height="70" name="image_operate_62191303716775808" /></a></p>
<p>这下可以用bootcamp装windows 啦！<br />
<a href="http://photo.blog.sina.com.cn/showpic.html#blogid=491eadbb0100r417&amp;url=http://s10.sinaimg.cn/orignal/491eadbbga1b93dbd14a9" target="_blank"><img title="解决bootcamp显示“启动磁盘不能被分区或恢复成单个分区。”" alt="解决bootcamp显示“启动磁盘不能被分区或恢复成单个分区。”" src="http://s10.sinaimg.cn/middle/491eadbbga1b93dbd14a9&amp;690" name="image_operate_58221303716887561" /></a></p>
</div>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=770</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
