本地及远程rsync同步

    xiaoxiao2022-06-24  274

    本地及远程rsync同步 问题

    本案例要求通过rsync命令工具来完成本地、远程同步操作,了解增量同步的效果、相关命令选项的用途。

    需要完成的配置任务如下:

    测试rsync上传、下载同步的基本用法测试rsync的命令选项-a、-v、--delete、-n的用途使用rsync从SSH服务器下载 /boot/ 目录使用rsync将本地的/etc/ 目录到上传到SSH服务器 方案

    rsync的备份方式是增量备份,只传输本地与目标相比更改多的文档,从而减少了备份时间,也避免保留多次完全备份而占用巨量存储空间。

    rsync支持在本地的目录之间执行同步,用法如下(源目录跟/符号表示被同步的是目录下的文档而不是整个目录):

    rsync  [选项...]  本地目录1  本地目录2rsync  [选项...]  本地目录1/  本地目录2

    rsync也支持在本地与远程主机之间执行同步,以SSH服务器为例,用法如下(上行同步时,认证的用户必须对目标目录有写入权限):

    下行:rsync  [选项...]  user@host:源目录  本地目录上行:rsync  [选项...]  本地目录  user@host:目标目录

    rsync常用的命令选项:

    -a:归档模式,相当于递归、保留权限等多个选项的组合-v:显示同步过程详细信息-z:传输过程中启用压缩-A:保留文件的ACL属性信息-n:测试同步过程,不做实际修改--delete:删除目标文件夹内多余的文档

    使用两台RHEL6虚拟机,其中一台为rsync同步提供源目录(192.168.4.5),另外一台作为rsync同步操作的发起端(192.168.4.205),如图-1所示。

    图-1

    步骤

    实现此案例需要按照如下步骤进行。

    步骤一:基本同步操作

    1)准备测试目录及文件

    创建两个测试目录/opt/dir1、/opt/dir2,并在/opt/dir1目录下建立测试文件1.txt、测试子目录2.dir:

    [root@pc205 ~]# mkdir  /opt/dir1  /opt/dir2

    [root@pc205 ~]# ifconfig eth0 > /opt/dir1/1.txt

    [root@pc205 ~]# mkdir /opt/dir1/2.dir

     

    [root@pc205 ~]# ls -l /opt/dir1/  /opt/dir2/ //确认结果

    /opt/dir1/:

    总用量 8

    -rw-r--r--. 1 root root  497 4月  26 16:48 1.txt

    drwxr-xr-x. 2 root root 4096 4月  26 16:51 2.dir

     

    /opt/dir2/:

    总用量 0

    2)验证-a归档选项、源目录后是否跟/的作用

    未添加-a选项时,当被同步的文档包含目录时,无法向下递归:

    [root@pc205 ~]# rsync /opt/dir1  /opt/dir2    

    skipping directory dir1   //目录被跳过

     

    [root@pc205 ~]# ls -l /opt/dir1/  /opt/dir2/

    /opt/dir1/:

    总用量 8

    -rw-r--r--. 1 root root  497 4月  26 16:48 1.txt

    drwxr-xr-x. 2 root root 4096 4月  26 16:51 2.dir

     

    /opt/dir2/:   //未同步任何文档

    总用量 0

    添加-a选项,再次执行上述同步,被同步的是整个/opt/dir1目录(末尾无/):

    [root@pc205 ~]# rsync -a /opt/dir1  /opt/dir2  

    [root@pc205 ~]# ls -l /opt/dir1/  /opt/dir2/

    /opt/dir1/:

    总用量 8

    -rw-r--r--. 1 root root  497 4月  26 16:48 1.txt

    drwxr-xr-x. 2 root root 4096 4月  26 16:51 2.dir

     

    /opt/dir2/:

    总用量 4

    drwxr-xr-x. 3 root root 4096 4月  26 16:51 dir1   //作为整体被同步过来

    修改上述操作,将源目录携程/opt/dir1/,只同步此目录下的文档:

    [root@pc205 ~]# rsync -a /opt/dir1/  /opt/dir2

    [root@pc205 ~]# ls -l /opt/dir1/  /opt/dir2/  

    /opt/dir1/:

    总用量 8

    -rw-r--r--. 1 root root  497 4月  26 16:48 1.txt

    drwxr-xr-x. 2 root root 4096 4月  26 16:51 2.dir

     

    /opt/dir2/:

    总用量 12

    -rw-r--r--. 1 root root  497 4月  26 16:48 1.txt   //分别独立被同步过来

    drwxr-xr-x. 2 root root 4096 4月  26 16:51 2.dir  //同上

    drwxr-xr-x. 3 root root 4096 4月  26 16:51 dir1

    3)验证--delete选项的作用

    在/opt/dir2/目录下添加测试文件3.txt,将测试子目录2.dir改名为3.dir,现在与/opt/dir1/目录的内容是不一致的:

    [root@pc205 ~]# cat /proc/cpuinfo > /opt/dir2/3.txt

    [root@pc205 ~]# mv /opt/dir2/2.dir  /opt/dir2/4.dir

    [root@pc205 ~]# ls -l /opt/dir1/  /opt/dir2/       

    /opt/dir1/:

    总用量 8

    -rw-r--r--. 1 root root  497 4月  26 16:48 1.txt

    drwxr-xr-x. 2 root root 4096 4月  26 16:51 2.dir

     

    /opt/dir2/:

    总用量 16

    -rw-r--r--. 1 root root  497 4月  26 16:48 1.txt

    -rw-r--r--. 1 root root  721 4月  26 17:06 3.txt   //增加的测试文件

    drwxr-xr-x. 2 root root 4096 4月  26 16:51 4.dir   //改名后的目录

    drwxr-xr-x. 3 root root 4096 4月  26 16:51 dir1

    未添加--delete选项时,rsync同步操作是单向的,只是把源目录的文档增量更新到目标目录,而目标目标残留的其他文档不会做任何处理:

    [root@pc205 ~]# rsync -a /opt/dir1/  /opt/dir2

    [root@pc205 ~]# ls -l /opt/dir1/  /opt/dir2/  

    /opt/dir1/:

    总用量 8

    -rw-r--r--. 1 root root  497 4月  26 16:48 1.txt

    drwxr-xr-x. 2 root root 4096 4月  26 16:51 2.dir

     

    /opt/dir2/:

    总用量 20

    -rw-r--r--. 1 root root  497 4月  26 16:48 1.txt

    drwxr-xr-x. 2 root root 4096 4月  26 16:51 2.dir   //新同步来的子目录

    -rw-r--r--. 1 root root  721 4月  26 17:06 3.txt

    drwxr-xr-x. 2 root root 4096 4月  26 16:51 4.dir

    drwxr-xr-x. 3 root root 4096 4月  26 16:51 dir1

    若要保持两边一致,即删除“目标目录下有而源目录下没有”的文档,可以添加--delete选项。修改前一条操作如下,可以看到两个目录的内容完全相同(多余文档被删除):

    [root@pc205 ~]# rsync -a --delete /opt/dir1/  /opt/dir2

    [root@pc205 ~]# ls -l /opt/dir1/  /opt/dir2/           

    /opt/dir1/:

    总用量 8

    -rw-r--r--. 1 root root  497 4月  26 16:48 1.txt

    drwxr-xr-x. 2 root root 4096 4月  26 16:51 2.dir

     

    /opt/dir2/:

    总用量 8

    -rw-r--r--. 1 root root  497 4月  26 16:48 1.txt

    drwxr-xr-x. 2 root root 4096 4月  26 16:51 2.dir

    [root@pc205 ~]#

    4)验证-v选项的作用

    未添加-v选项时,rsync同步操作是静默执行的,除非报错否则无屏幕输出:

    [root@pc205 ~]# rsync -a --delete /opt/dir1/  /opt/dir2

    而添加-v选项后,可以观察rsync同步操作的过程信息,方便了解细节:

    [root@pc205 ~]# rsync -a -v --delete /opt/dir1/  /opt/dir2

    sending incremental file list

     

    sent 70 bytes  received 13 bytes  166.00 bytes/sec

    total size is 497  speedup is 5.99

    5)验证-n选项的作用

    选项-n主要用来模拟同步过程,而并不会真正的执行,此选项通常与-v一起使用。比如说,可以先清空/opt/dir2/目录,然后rsync结合-nv选项来了解一下指定的同步会执行哪些操作:

    [root@pc205 ~]# rsync -a -nv --delete /opt/dir1/  /opt/dir2    

    sending incremental file list

    ./

    1.txt   //会同步1.txt文件

    2.dir/   //会同步2.dir子目录

     

    sent 79 bytes  received 22 bytes  202.00 bytes/sec

    total size is 497  speedup is 4.92 (DRY RUN)

     

    [root@pc205 ~]# ls -l /opt/dir1/  /opt/dir2/    

    /opt/dir1/:

    总用量 8

    -rw-r--r--. 1 root root  497 4月  26 16:48 1.txt

    drwxr-xr-x. 2 root root 4096 4月  26 16:51 2.dir

     

    /opt/dir2/:   //实际上并未执行

    总用量 0

    把上述同步操作中的-n选项去掉,才会真正地执行同步操作:

    [root@pc205 ~]# rsync -a -v --delete /opt/dir1/  /opt/dir2

    sending incremental file list

    ./

    1.txt

    2.dir/

     

    sent 616 bytes  received 38 bytes  1308.00 bytes/sec

    total size is 497  speedup is 0.76

     

    [root@pc205 ~]# ls -l /opt/dir1/  /opt/dir2/  

    /opt/dir1/:

    总用量 8

    -rw-r--r--. 1 root root  497 4月  26 16:48 1.txt

    drwxr-xr-x. 2 root root 4096 4月  26 16:51 2.dir

     

    /opt/dir2/:   //已经执行同步

    总用量 8

    -rw-r--r--. 1 root root  497 4月  26 16:48 1.txt

    drwxr-xr-x. 2 root root 4096 4月  26 16:51 2.dir

    步骤二:rsync+SSH同步

    1)将远程主机上的 /boot/目录下载备份到本地(选项-z表示压缩)

    [root@pc205 ~]# rsync  -az --delete root@192.168.4.5:/boot  /fromssh  

    root@192.168.4.5's password:   //验证对方口令

     

    [root@pc205 ~]# ls /fromssh/      //确认同步结果

    boot

    2)将本地的/etc/selinux目录上传备份到远程主机

    [root@pc205 ~]# du -sh /etc/selinux/   //确认待同步的目录

    19M     /etc/selinux/

     

    [root@pc205 ~]# rsync  -az  /etc/selinux  root@192.168.4.5:/opt/

    root@192.168.4.5's password:   //验证对方口令

    然后切换到远程主机192.168.4.5上确认同步结果:

    [root@svr5 ~]# du -sh /opt/selinux/   //确认同步结果

    19M     /opt/selinux/

    rsync+rsync同步 问题

    采用rsync+SSH的远程同步时,使用起来是最简单的,但是目标用户也被允许SSH登录到远程主机的Shell环境。在某些情况下,企业会希望只提供需要认证的同步目录资源,但并不希望提供远程登录,这时候就可以采用rsync+rsync同步。

    沿用练习一,需要完成的配置任务如下:

    在rsync源端将/usr/src 目录发布为同步资源:共享名为tools,仅允许用户 ruser 以密码 pwd123 访问

    在rsync操作端测试 rsync+rsync下行同步

    方案

    使用两台RHEL6虚拟机,其中一台为rsync同步提供源目录(192.168.4.5),另外一台作为rsync同步操作的发起端(192.168.4.205),如图-2所示。

    图-2

    rsync工具也可以作为服务器使用,独立执行rsync  --daemon即可;或者,也是推荐的做法,可以作为临时服务交给xinetd超级服务器来管理。rsync服务端提供同步目录资源时,配置和提供方式类似于Samba共享。

    使用rsync与rsync服务端之间同步时,用法如下:

    下行:rsync  [选项...]  user@host::共享名  本地目录上行:rsync  [选项...]  本地目录  user@host::共享名 步骤

    实现此案例需要按照如下步骤进行。

    步骤一: 配置rsync服务端,发布tools同步资源

    1)建立同步账号文件

    [root@svr5 ~]# vim  /etc/rsyncd_users.db

    ruser:pwd123   //用户名:密码,每行一个用户

    othername:123456

     

    [root@svr5 ~]# chmod  600  /etc/rsyncd_users.db   //严格权限,否则同步会失败

    2)建立 /etc/rsyncd.conf 共享设置

    [root@svr5 ~]# vim  /etc/rsyncd.conf

    [tools]   //定义共享名

        path = /usr/src   //被共享的目录位置

        comment = Rsync Share Test   //同步资源说明

        read only = yes   //只读

        dont compress = *.gz *.bz2 *.tgz *.zip   //同步时不再压缩的文档类型

        auth users = ruser   //允许谁访问

        secrets file = /etc/rsyncd_users.db   //指定账号文件的路径

    在上述配置文件中,若不添加最后两行认证配置,则默认以匿名方式提供。

    3)启用 rsync --daemon 服务端

    [root@svr5 ~]# du -sh /usr/src/   //确认待发布的同步目录

    163M    /usr/src/

     

    [root@svr5 ~]# yum  -y  install  xinetd

    [root@svr5 ~]# chkconfig  rsync  on   //打开rsync服务开关

    [root@svr5 ~]# chkconfig  xinetd  on

    [root@svr5 ~]# service  xinetd  restart   //通过xinetd启动

    步骤二: rsync + rsync下行同步测试

    1)查看及列表同步资源

    查看远程主机提供了哪些同步资源:

    [root@pc205 ~]# rsync 192.168.4.5::

    tools           Rsync Share Test //共享名、共享说明

    列出指定同步资源下的文档:

    [root@pc205 ~]# rsync  ruser@192.168.4.6::tools   //浏览共享

    Password:   //验证ruser用户的口令

    drwxr-xr-x        4096 2009/10/01 22:58:39 debug

    drwxr-xr-x        4096 2009/10/01 22:58:39 kernels

    .. ..

    2)rsync下行同步

    [root@pc205 ~]# rsync -avz  ruser@192.168.4.6::tools/  /root/mysrc/

    //下行同步,删除多余文件

    Password:   //验证密码pwd123

    .. ..

    sent 271848 bytes  received 37119880 bytes  598267.65 bytes/sec

    total size is 130075707  speedup is 3.48

     

    [root@pc205 ~]# du -sh /root/mysrc/   //确认同步结果

    163M    /root/mysrc/

    网站实时镜像 问题

    公司的网站服务器有两个镜像站点,分别放在北京和上海的IDC机房。现在要求利用rsync同步机制实现“服务器A-->服务器B”的实时镜像同步。

    需要完成的配置任务如下:

    双方的目录均为 /var/www/html/

    以 svr5 为同步发起方,配置 inotify+rsync 同步操作

    以 pc205 为同步目标,基于SSH方式进行验证

    方案

    使用两台RHEL6虚拟机,其中一台作为服务器A(192.168.4.5),另外一台作为服务器B(192.168.4.205),两台主机都安装httpd网站软件,如图-3所示。

     

    图-3

    安装并启用inotify-tools工具,就可以在同步发起端实现对指定目录的监控,一旦出现更改、增加文件等操作,立即触发相应的命令操作(本例中即上行同步)。根据监控结果触发同步操作,其中用到了一部分Shell控制语句,最好建立专用脚本来实现,本例中只需理解脚本的用途即可。

    步骤

    实现此案例需要按照如下步骤进行。

    步骤一:准备网页环境

    1)在svr5上,启用httpd网站服务、部署测试网页

    [root@svr5 ~]# yum -y install httpd

    .. ..

    [root@svr5 ~]# service httpd restart

    停止 httpd:                                               [确定]

    正在启动 httpd:                                           [确定]

    [root@svr5 ~]# chkconfig httpd on

     

    [root@svr5 ~]# echo "Welcome to Tarena" > /var/www/html/index.html

    [root@svr5 ~]# elinks -dump http://192.168.4.5   //访问测试网页

       Welcome to Tarena

    2)在pc205上,启用httpd网站服务,先不用部署网页

    [root@pc205 ~]# yum -y install httpd

    .. ..

    [root@pc205 ~]# service httpd restart

    停止 httpd:                                               [确定]

    正在启动 httpd:                                           [确定]

    [root@pc205 ~]# chkconfig httpd on

     

    [root@pc205 ~]# ls /var/www/html/*   //网页目录为空

    ls: 无法访问/var/www/html/*: 没有那个文件或目录

    步骤二:配置、启用实时同步脚本

    1)在svr5上,安装inotify-tools工具包

    [root@svr5 ~]# tar  xf  inotify-tools-3.13.tar.gz

    [root@svr5 ~]# cd  inotify-tools-3.13

    [root@svr5 inotify-tools-3.13]# ./configure

    .. ..

    [root@svr5 ~]# make  &&  make  install

    2)创建并部署SSH公钥,实现免密码验证

    [root@svr5 ~]# ssh-keygen   //创建密钥对

    Generating public/private rsa key pair.

    Enter file in which to save the key (/root/.ssh/id_rsa):   //回车

    Enter passphrase (empty for no passphrase):   //回车

    Enter same passphrase again:   //回车

    Your identification has been saved in /root/.ssh/id_rsa.

    Your public key has been saved in /root/.ssh/id_rsa.pub.

    .. ..

     

    [root@svr5 ~]# ssh-copy-id -i ~/.ssh/id_rsa.pub root@192.168.4.205

       //上传公钥

    root@192.168.4.205's password:   //验证对方密码

    Now try logging into the machine, with "ssh 'root@192.168.4.205'", and check in:

     

      .ssh/authorized_keys

     

    to make sure we haven't added extra keys that you weren't expecting.

     

    [root@svr5 ~]# ssh root@192.168.4.205   //验证免密码登录

    Last login: Thu Dec 24 00:53:00 2015 from 192.168.4.5

    [root@pc205 ~]# exit //返回客户机

    logout

    Connection to 192.168.4.205 closed.

    3)建立inotify实时同步脚本文件

    为了方便脚本的移植使用,在脚本中定义了两个变量:TARGET_DIR用来指定监控的目标文件夹,而RSYNC_CMD用来指定需要触发的同步操作。注意给脚本添加x执行权限,实际使用时根据需要变更这两个变量的值即可

    [root@svr5 ~]# vim  /root/isync.sh   //新建脚本

    #!/bin/bash

    TARGET_DIR="/var/www/html"    #//指定监控目录

    RSYNC_CMD="rsync  -az  --delete  /var/www/html/  192.168.4.205:/var/www/html/"

         #//指定同步操作

    inotifywait  -mrq  -e  modify,move,create,delete,attrib  /opt | while read  -n5  X

    do

        $RSYNC_CMD

    done  &

    [root@svr5 ~]# chmod  +x  /root/isync.sh   //添加执行权限

    4)启动实时同步脚本程序

    此脚本一旦运行后,会一直在后台运行;如果有必要,可以将此脚本添加为开机自启动任务。

    [root@svr5 ~]# /root/isync.sh   //执行脚本

    [root@svr5 ~]#

    步骤三:测试实时同步效果

    1)在svr5上向/var/www/html/目录下添加一个文件

    [root@svr5 ~]# touch /var/www/html/a.html

    [root@svr5 ~]# ls -lh /var/www/html/*.html

    -rw-r--r--. 1 root root  0 12月 17 09:02 /var/www/html/a.html

    -rw-r--r--. 1 root root 18 12月 17 08:37 /var/www/html/index.html

    2)在pc205上观察/var/www/html目录下的变化

    [root@pc205 ~]# ls -lh /var/www/html/*.html

    -rw-r--r--. 1 root root  0 12月 17 09:02 /var/www/html/a.html

    -rw-r--r--. 1 root root 18 12月 17 08:37 /var/www/html/index.html

    [root@pc205 ~]#

    3)在svr5上删除刚添加的文件a.html

    [root@svr5 ~]# rm -rf /var/www/html/a.html

    [root@svr5 ~]# ls -lh /var/www/html/*.html

    -rw-r--r--. 1 root root 18 12月 17 08:37 /var/www/html/index.html

    4)在pc205上再次观察/var/www/html目录下的变化

    [root@pc205 ~]# ls -lh /var/www/html/*.html

    -rw-r--r--. 1 root root 18 12月 17 08:37 /var/www/html/index.html

    [root@pc205 ~]#

    EMOS部署及管理 问题

    XX公司使用了好几年的263企业邮箱,当时的费用比较昂贵(100用户版,2万/年),而且在邮件数量、附件大小等方便存在限制;随着公司规模不断扩大,员工数已迅速突破至300多人,未分配企业邮箱的员工只能使用网易、新浪等免费邮箱,导致企业内部的业务沟通存在一定延迟。

    鉴于上述情况,公司急需建立统一的、低成本的邮件系统平台。而且因为员工的计算机水平不一,除了支持邮件客户端软件以外,还希望能通过Web方式登录收发邮件。

    方案

    项目设计的出发点:

    实施成本方面:放弃263企业邮箱,改为自主搭建邮件服务器;购置1台PC服务器,部署到公司机房。多邮件域的支持:公司已有域名tedu.cn、163.com,在建立自己的邮件服务器以后,需要向域名服务商申请添加 MX 记录。独立邮件服务器构建:考虑到基于postfix、支持虚拟账号、易用的Web邮箱及管理平台等需求,决定选用由extmail.org 社区推出的EMOS邮件平台。

    项目案例的环境:

    邮件服务器(EMOS):mail.tedu.cn,192.168.4.100/24域名解析服务器(bind):svr5.tedu.cn,192.168.4.5/24测试客户机:192.168.4.205/24管理邮件域:@tedu.cn、@163.com、……

    练习时可使用三台虚拟机,其中一台RHEL6虚拟机作为DNS服务器(192.168.4.5),另外一台RHEL6虚拟机作为测试用的客户机(192.168.4.205);还有一台虚拟机作为邮件服务器(192.168.4.100),直接安装集成的EMOS操作系统,如图-4所示。

    图-4

    步骤

    实现此案例需要按照如下步骤进行。

    步骤一:准备可用的DNS服务器(RHEL 6.5)

    1)安装bind、bind-chroot,配置调整

    [root@svr5 ~]# yum  -y  install  bind  bind-chroot

    [root@svr5 ~]# mv  /etc/named.conf  /etc/named.conf.origin

    [root@svr5 ~]# vim  /etc/named.conf

    options {

            directory "/var/named";

    };

    zone "tedu.cn" {

            type master;

            file "tedu.cn.zone";

    };

    zone "163.com" {

            type master;

            file "163.com.zone";

    };

    2)为邮件域tedu.cn及相关站点提供解析服务

    [root@svr5 ~]# vim  /var/named/tedu.cn.zone

    $TTL 1D

    @  IN  SOA  @  admin.tedu.cn.  (

        1

        1D

        1H

        1W

        3H  )

    @ NS   svr5.tedu.cn.

       MX  5  mail.tedu.cn.

      A   192.168.4.100

    svr5 A   192.168.4.5

    mail A   192.168.4.100

    *   A   192.168.4.100

    3)为邮件域163.com及相关站点提供解析服务

    [root@svr5 ~]# vim  /var/named/163.com.zone

    $TTL 1D

    @  IN  SOA  @  admin.tedu.cn.  (

        1

        1D

        1H

        1W

        3H  )

    @ NS   svr5.tedu.cn.

       MX  5  mail.163.com.

      A   192.168.4.100

    mail A   192.168.4.100

    *   A   192.168.4.100

    4)启动named服务

    [root@svr5 ~]# service named restart

    Stopping named:                       [  OK  ]

    Starting named:                [  OK  ]

    [root@svr5 ~]# chkconfig named on

    5)配置客户端,确保域名解析正常

    [root@pc205 ~]# vim  /etc/resolv.conf   //调整各客户机DNS设置

    nameserver  192.168.4.5

     

    [root@pc205 ~]# host  -t mx  tedu.cn   //确认tedu.cn的MX解析可用

    tedu.cn mail is handled by 5 mail.tedu.cn.

    [root@pc205 ~]# host  mail.tedu.cn

    mail.tedu.cn has address 192.168.4.100

     

    [root@pc205 ~]# host  -t mx  163.com   //确认163.comMX解析可用

    163.com mail is handled by 5 mail.163.com.

    [root@pc205 ~]# host  mail.163.com

    mail.163.com has address 192.168.4.100

    步骤二:部署EMOS邮件服务器

    1)新建一台RHEL6 x64虚拟机,通过EMOS_1.6_x86_64.iso安装系统

    EMOS实际上是基于64位的RHEL6衍生版Scientific Linux再重新编译定制的衍独立操作系统,其中继承了以Postfix为主的邮件服务软件。通过ISO镜像在虚拟机上安装EMOS系统时,基本过程与RHEL6的安装非常类似,只不过更加简单了,如图-5所示。

    图-5

    注意:当前版本的EMOS在安装中不支持设置网卡,需安装完成后手动调整。

    2)启动EMOS服务器,完成首次初始化

    根据提示设好主机名(mail.tedu.cn)、邮件域(tedu.cn);另外,为了方便起见,所有密码均根据提示修改为1234567。其他的初始化过程保持默认即可,最终确认所做的设置,如图-6所示,选择Yes完成初始化。

    -6

    然后重启EMOS服务器,以root用户登入,确认主机名(mail.tedu.cn),修改IP地址(192.168.4.100/24);关闭SELinux机制,关闭iptables防火墙服务。完成这些工作以后,EMOS邮件平台就基本准备就绪了。

    步骤三:EMOS界面调整

    1)将ExtMail界面的默认语言改为中文

    [root@mail ~]# vim /var/www/extsuite/extmail/webmail.cf

    .. ..

    SYS_USER_LANG = zh_CN   //改为中文界面

    2)将ExtMan界面的默认语言改为中文,禁用验证码

    [root@mail ~]# vim /var/www/extsuite/extman/webman.cf

    .. ..

    SYS_LANG = zh_CN //改为中文界面

    SYS_CAPTCHA_ON = 0   //禁用登录验证码

    步骤四:管理EMOS邮件系统(ExtMan)

    1)登录ExtMan邮件系统管理平台

    从浏览器访问:http://mail.tedu.cn/extman/,即可看到ExtMan邮件系统管理平台,如图-7所示,正确指定管理员账号root@tedu.cn、密码1234567即可登入。

    图-7

    2)邮件系统管理操作测试

    添加邮件域 163.com,允许自由注册,如图-8所示。

    图-8

    为邮件域tedu.cn新增邮箱用户wooo、neee;为邮件域163.com新增邮箱用户nick、hunter,如图-9所示。

    -9

    步骤五:使用EMOS邮件系统(ExtMail)

    1)登录ExtMail网页邮箱系统

    从浏览器访问:http://mail.tedu.cn/,即可看到ExtMail邮件收发平台的登录界面,如图-10所示,使用默认的邮箱用户postmaster@tedu.cn、密码extmail即可成功登录。

    图-10

    2)网页邮箱系统使用测试

    以用户wooo@tedu.cn登录,查看邮箱界面;然后向用户hunter@163.com发一封电子邮件,并抄送给neee@tedu.cn。再分别以邮箱用户hunter@163.com、neee@tedu.cn登录,可以查看收到的电子邮件,如图-11所示。

    图-11

    退出已登录的邮箱用户,重新访问ExtMail邮箱系统的首页,可以选择邮箱域单击“免费注册邮箱”,指定用户名即可申请注册新用户,如图-12所示。

    图-12

     

     


    最新回复(0)