`
hl8189
  • 浏览: 5840 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

Install and configure Email Server

阅读更多
To install and configure Email server, there are two things need to be done.The first things is  to install and configure the DNS servr. The second is to install and configure Email server.
        We usually use the BIND for the DNS server on the Redhat server and use the James and sendmail for the email server.
        Step 1, install the DNS server on Redhat.
           1. Get the bind from the website, www.bind.com.
           2. upload the installation file to the server Redhat and use tar -zxvf *.gz to extract the file.
           3. The file was needed to make install.
                        ./configure --prefix=/usr/local/named  # this tell the system the path to install
                        make  #precompile
                        make install  # make install.
            4.Since now, the installation were finished and the configure can be started.
            5.Add the user and group bind.
                        groupadd bind
                        useradd -g bind -d /usr/local/named -s /sbin/nologin bind
            6.configure the DNS
                        cd /usr/local/named/etc
                        /usr/local/named/sbin/rndc-confgen > rndc.conf
                        cat rndc.conf > rndc.key
                        chmod 777 /usr/local/named/var
                        tail -10 rndc.conf | head -9 | sed s/#\ //g > named.conf
    vi named.conf
添加下面内容(

#################

options {
directory "/usr/local/named/var";         
pid-file "named.pid";            
};

zone "." IN {
        type hint;        
        file "named.root";
};

zone "localhost" IN {
        type master; 
        file "localhost.zone";
        allow-update { none; };
};

zone "0.0.127.in-addr.arpa" IN {
        type master;     
        file "named.local";  
        allow-update { none; };
};

zone "test.com" IN {    
        type master;    
        file "test.com.zone";   
        allow-update { none; };
};


zone "1.168.192.in-addr.arpa" in { 
        type master; 
        file "test.com.rev";             
        allow-update { none; };
};
########################
   cd /usr/local/named/var

1:named.root
dig @a.root-servers.net . ns > named.root

2:localhost.zone
##########
$TTL    86400
$ORIGIN localhost.
@                       1D IN SOA       @ root (
                                        42              ; serial (d. adams)
                                        3H              ; refresh
                                        15M             ; retry
                                        1W              ; expiry
                                        1D )            ; minimum

                        1D IN NS        @
                        1D IN A         127.0.0.1
#############

3:named.local
###############
$TTL    86400
@       IN      SOA     localhost. root.localhost. (
                                      1997022700 ; Serial
                                      28800      ; Refresh
                                      14400      ; Retry
                                      3600000    ; Expire
                                      86400 )    ; Minimum
              IN      NS      localhost.

1       IN      PTR     localhost.
####################


4:test.com.zone
############

$TTL 86400      ; 1 day
@               IN      SOA     ns1.test.com.      root.test.com. (
                                2008050122 ; serial
                                28800      ; refresh (8 hours)
                                7200       ; retry (2 hours)
                                604800     ; expire (1 week)
                                86400      ; minimum (1 day)
                                )
                        NS      ns1.test.com.
                        A       192.168.1.168
                        MX      10 mail.test.com.
www                     A       192.168.1.168
mail        A      192.168.1.168
ns1        A      192.168.1.168

#########################
5:test.com.rev
#############
$TTL 86400
@ IN SOA ns1.test.com. root.test.com.(
                                                              20031001;
                                                              7200;
                                                              3600;
                                                              43200;
                                                             86400);
@           IN           NS             ns1.test.com.
168         IN           PTR          ns1.test.com.
##############
       
        7 create the service

vi /etc/rc.d/init.d/named

#!/bin/bash
# named a network name service.
# chkconfig: 345 35 75
# description: a name server

if [ `id -u` -ne 0 ]
then
echo "ERROR:For bind to port 53,must run as root."
exit 1
fi
case "$1" in
start)
if [ -x /usr/local/named/sbin/named ]; then
/usr/local/named/sbin/named -c /usr/local/named/etc/named.conf -u bind && echo . && echo 'BIND9 server started'
fi
;;
stop)
kill `cat /usr/local/named/var/named.pid` && echo . && echo 'BIND9 server stopped'
;;
restart)
echo .
echo "Restart BIND9 server"
$0 stop
sleep 10
$0 start
;;
reload)
/usr/local/named/sbin/rndc reload
;;
status)
/usr/local/named/sbin/rndc status
;;
*)
echo "$0 start | stop | restart |reload |status"
;;
esac



->chmod 755 /etc/rc.d/init.d/named

->chkconfig --add named

->service named start

        8 test the service

/usr/local/named/sbin/named -g

You can use the script to test the server and it will print the start log.


start the server
/usr/local/named/sbin/named -c /usr/local/named/etc/named.conf -u bind &


view the status of the server

/usr/local/named/sbin/rndc status

start teh server

service named restart

edit /etc/resolv.conf

change the dns server to local pc.

we can nslookup to test the dns server.
        eg: nslookup www.polisy.com.sg



Step 2, Install and configure the james.

        James is very easy to install.
       
        1. After upload the installation file,we can use tar -zxvf .gz to extract the tar file.
       
        eg: tar -zxvf *.gz -C james   #extract the gz file to james.
          
              2. Add the JAVA_HOME to the script $JAMES_HOME/bin/run.sh
                    # add JAVA_HOME
                    JAVA_HOME=/opt/jdk1.6.0_13
                    export JAVA_HOME
               
                3. Will start the james.
                    When start the james ,it will  check if there is another mail server started on the redhat,so we need to close other email server
                        ->service sendmail stop
                        ->sh run.sh
                        If there is no problem, we can see the message below.
                        [root@localhost bin]# sh run.sh
                        Using PHOENIX_HOME:   /opt/james/james-2.3.1
                        Using PHOENIX_TMPDIR: /opt/james/james-2.3.1/temp
                        Using JAVA_HOME:      /opt/jdk1.6.0_13
                        Running Phoenix:

                        Phoenix 4.2

                        James Mail Server 2.3.1
                        Remote Manager Service started plain:4555
                        POP3 Service started plain:110
                        SMTP Service started plain:25
                        NNTP Service started plain:119
                        FetchMail Disabled
               
               4  modify the /SAR-INF/config

                 <postmaster>Postmaster@test.com</postmaster>
                    <servernames autodetect="false" autodetectIP="true">
                 <!-- CONFIRM? -->
                 <servername>test.com</servername>
                 </servernames>

                5. restart the serer  sh run.sh

                6. add user and password
                telnet 127.0.0.1 4555
                  adduser usr pwd

Step 3. create the start and stop server script for DNS and james server.

vi startEmailserver
    
    #! /bin/sh
     service sendmail stop
     service named start
     sh /opt/james/james-2.3.1/bin/run.sh &

vi stop Email server
       
#! /bin/sh
# kill james pid
pidlist=`ps -ef|grep jame | grep -v "grep"|awk '{print $2}'`
#ps -u $USER|grep "java"|grep -v "grep"
echo "email server Id list :$pidlist"
if [ "$pidlist" = "" ]
then
  echo "no email server pid alive"
else
  for pid in ${pidlist}
{
   kill -9 $pid
echo "KILL $pid:"
echo "service stop success"
  }
fi

#stop DNS server

pidlist=`ps -ef|grep named | grep -v "grep"|awk '{print $2}'`
#ps -u $USER|grep "java"|grep -v "grep"
echo "DNS server Id list :$pidlist"
if [ "$pidlist" = "" ]
then
  echo "no DNS server pid alive"
else
  for pid in ${pidlist}
{
   kill -9 $pid
echo "KILL $pid:"
echo "service stop success"
  }
fi
分享到:
评论

相关推荐

    Python Network Programming Cookbook, 2nd Edition - 2017

    MiniEdit, and configure the networks with OpenDaylight, ONOS, Floodlight, Ryu, and POX controllers. Chapter 11, Authentication, Authorization, and Accounting (AAA), introduces how the networks are ...

    Fedora Linux.chm

    Set up a server with file sharing, DNS, DHCP, email, a Web server, and more Work with Fedora's security features including SELinux, PAM, and Access Control Lists (ACLs) Whether you are running the ...

    Clever Internet Suite (SRC) v9.1.0.0

    Clever Internet Suite version 9.1 ... This property allows you to configure the used encryption and signature algorithms. The signature verification is disabled when retrieving the message header. ...

    UE(官方下载)

    Set up and configure multiple FTP accounts TaskMatch Environments How to use TaskMatch Environments in UltraEdit and UEStudio Configure FTP backup Save a local copy of your files when you transfer ...

    zabbix安装部署手册

    * 支持多种告警机制,包括 Email、SMS、WebService 等 二、Zabbix Server 安装 安装 Zabbix Server 需要满足以下条件: * 操作系统:Linux、Unix 或 Windows * 数据库:MySQL、PostgreSQL 或 Oracle * Web 服务器...

    Malware_OSSEC

    2. **Configuration**: Once installed, configure OSSEC to monitor logs from various sources, such as web servers, email servers, and other applications that might be targeted by malware. 3. **Alerting...

    Bochs - The cross platform IA-32 (x86) emulator

    configure option is deprecated and should not be used anymore. - Enable changing part of CPU functionality at runtime through .bochsrc. - Now you could enable/disable any of SSEx/AES/MOVBE/...

    google api php client

    1. If you have delegated domain-wide access to the service account and you want to impersonate a user account, specify the email address of the user account using the method setSubject: ```php $...

    Manning.Git.in.Practice.2014.9.pdf

    - **Setting Up a Git Server**: Set up a server, install Git, and configure the necessary components such as SSH keys for authentication. - **Access Control**: Implement access control using groups and...

    Apache-安装图解.doc

    然后,设置系统信息,包括 Network Domain、Server Name 和 Administrator's Email Address。 在安装类型选择界面中,可以选择 Typical 或 Custom,Typical 是默认安装,Custom 是用户自定义安装。本文选择 Custom...

    linux中安装nginx和keepalived

    yum -y install gcc pcre-devel zlib-devel openssl-devel ``` #### 二、下载与安装 接下来,需要下载Nginx和Keepalived的源码包,并进行编译安装。 **下载Nginx和Keepalived:** ```bash wget ...

    Apache+php+mysql在windows下的安装与配置

    在开始菜单中,点“所有程序”、“Apache HTTP Server 2.0.55”、“Configure Apache Server”、“Edit the Apache httpd conf Configuration file”,点击打开。 2.2 编辑配置文件 在配置文件中,我们可以设置 ...

    Java邮件开发Fundamentals of the JavaMail API

    If you want to access a POP server with JavaMail 1.1.3, download and install a POP3 provider. Sun has one available separate from the JavaMail implementation. After downloading and unbundling pop31_...

    php环境安装教程(图解)

    这里我们还是要配置一下,有什么问题或修改,配置始终是要会的,如图所示,“开始”、“所有程序”、“Apache HTTP Server 2.0.55”、“Configure Apache Server”、“Edit the Apache httpd conf Configuration ...

    Jumpserver详细部署文档网友归隐贡献1

    # ./configure && make && make install ``` **5. 安装 Jumpserver** 创建虚拟环境,并从 GitHub 克隆 Jumpserver 仓库。安装所需 RPM 包和 Python 软件包: ```bash # cd /opt/ # python3 -m venv py3 # source /...

    基于LVS+keepalived群集

    - 使用 `./configure --sysconf=/etc --with-kernel-dir=/usr/src/kernels/2.6.18-8.el5-i686` 进行配置,其中 `--sysconf=/etc` 指定了配置文件的位置,`--with-kernel-dir` 指定了内核的路径; - 编译安装:`...

    ACS是Cisco出的一个 AAA 认证软件,可以对路由器进行用户认证、授权、记账操作。

    选择是否打开Enable Log-in Monitoring按纽,同时选择报警方式,包括No Remedial Action,Reboot,Restart All,Restart RADIUS/TACACS+,还可以选择通过EMAIL进行报警,(同时要配置EMAIL的SMTP Mail Server和Mail ...

    centos7-lvs+keepalive部署

    ./configure --prefix=/usr/local/keepalived make make install ``` 这里使用了较新版本的 Keepalived (1.4.3),并手动编译安装。同时安装了必要的依赖库 `libnl-devel`、`libnl` 和 `libnfnetlink-devel`。 ...

    安装nagios并且邮件报警

    make all && make install && make install-init && make install-config && make install-commandmode && make install-webconf ``` 编译并安装Nagios主程序。其中`--with-command-group=nagcmd`指定了命令执行...

Global site tag (gtag.js) - Google Analytics