这个是参考cu上的贴来配置的过程,我看资料那么详细,我今天就好好测试一下。发现配置邮件服务器,是最全面的,不但你要配置lamp,还要bind,ssl,等于把我最近编译安装的软件,全部整合在一起了。如果测试通过,这个就当我学习linux21天的总结了。
一:试验环境介绍
软件:vmware workstation6.02
vm:创建一个redhat as5 vm,8g硬盘,删除软驱和声卡
主机名(hostname):centos
ip:192.168.1.168
dns:192.168.1.1(配置完后,需要修改,指向192.168.1.168,修改/etc/resolv.conf),
邮件服务器的名字为mail.test.com
dns server:ns1.test.com
dns ip:192.168.1.168
ip:192.168.1.168
www.test.com 192.168.1.168
mail.test.com 192.168.1.168
系统采用centos5.1,采用最小化安装,所有的选项采用系统默认。
二:安装软件前准备
1:关闭无用的服务和selinux,需要重新启动才能生效
2:配置ssh,允许root登陆
3:配置yum,快速更新
4:把所有的软件上传到/usr/src目录下
5:通过yum安装gcc, gcc-c++
6:卸载sendmail (yum y remove sendmail)
7:重新启动机器,给系统做快照,后面每完成一项工作都给系统做一个快照
三:安装bind
安装bind
tar zxvf bind-9.4.2.tar.gz
cd bind-9.4.2
./configure --prefix=/usr/local/named && make && make install
groupadd bind
useradd -g bind -d /usr/local/named -s /sbin/nologin bind
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
配置
1:编辑/usr/local/named/etc 目录下的named.conf 文件
vi named.conf
添加下面内容(
#################
options {
directory "/usr/local/named/var"; //域名文件存放的绝对路径
pid-file "named.pid"; //如果bind启动,自动会在/usr/local/named/var目录生成一个named.pid文件,打开文件就是named进程的ID
};
zone "." IN {
type hint; //根域名服务器
file "named.root"; //存放在//usr/local/named/var目录,文件名为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 { //建立test.com域
type master;
file "test.zone"; //test.com域映射IP地址可在此文件编写
allow-update { none; };
};
zone "1.168.192.in-addr.arpa" in { //反向解析
type master;
file "test.local"; //存放反向解析的文件
allow-update { none; };
};
########################
2:在/usr/local/named/var目录下,需要创建5个文件
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.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.local
#############
$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.
##############
启动脚本
vi /etc/rc.d/init.d/named
#!/bin/bash
# named a network name service.
# chkconfig: 345 35 75
# deion: 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
启动测试
/usr/local/named/sbin/named -g
你可以看到启动的过程,如果你的配置文件有错误,所以你可以根据这个排错
启动服务测试一下
/usr/local/named/sbin/named -c /usr/local/named/etc/named.conf -u bind &
四:安装ncurses-5.6
这个软件如果不安装,安装mysql的时候会报错,我把解压,编译,安装一行代码来安装。
tar zxvf ncurses-5.6.tar.gz && cd ncurses-5.6 && ./configure --prefix=/usr --with-shared --without-debug && make && make install && cd ..
五:安装mysql
tar -zxvf mysql-5.0.51a.tar.gz && cd mysql-5.0.51a && ./configure --with-mysqld-user=mysql --prefix=/usr/local/mysql5 --with-charset=gbk --with-extra-charset=all --without-isam --exec-prefix=/usr/local/mysql5 && make && make install
groupadd mysql
useradd -g mysql mysql
/usr/src/mysql-5.0.51a/s/mysql_install_db
cp /usr/local/mysql5/share/mysql/my-medium.cnf /usr/local/mysql5/var/my.cnf
cp /usr/local/mysql5/share/mysql/mysql.server /etc/init.d/mysqld
chkconfig --add mysqld
chkconfig --level 2345 mysqld on
chown mysql:mysql -R /usr/local/mysql5/
service mysqld start
ln -s /usr/local/mysql5/bin/mysql /sbin/mysql
ln -s /usr/local/mysql5/bin/mysqladmin /sbin/mysqladmin
配置库文件搜索路径
echo "/usr/local/mysql5/lib/mysql" >> /etc/ld.so.conf
ldconfig -v
添加/usr/local/mysql/bin到环境变量PATH中
export PATH=$PATH:/usr/local/mysql5/bin
测试
netstat -nplt | grep mysql
ps aux|grep mysql
六:安装ZLIB2
如果不安装,等下编译安装openssl 就会报错,所以提前编译安装
tar zxvf zlib-1.2.3.tar.gz && cd zlib-1.2.3 && ./configure && make && make install && cd ..
七:安装openssl
tar zxvf openssl-0.9.8g.tar.gz && cd openssl-0.9.8g && ./config shared zlib && make && make test && make install
mv /usr/bin/openssl /usr/bin/openssl.OFF
mv /usr/include/openssl /usr/include/openssl.OFF
rm /usr/lib/libssl.so
ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl
ln -s /usr/local/ssl/include/openssl /usr/include/openssl
ln -sv /usr/local/ssl/lib/libssl.so.0.9.8 /usr/lib/libssl.so
配置库文件搜索路径
echo "/usr/local/ssl/lib" >> /etc/ld.so.conf
ldconfig -v
检测安装结果
openssl version
八:安装安装sasl-2.1.22
tar zxvf cyrus-sasl-2.1.22.tar.gz && cd cyrus-sasl-2.1.22 && ./configure --prefix=/usr/local/sasl2 --disable-gssapi --disable-anon --disable-sample --disable-digest --enable-plain --enable-login --enable-sql --with-mysql=/usr/local/mysql5 -with-mysql-includes=/usr/local/mysql5/include/mysql --with-mysql-libs=/usr/local/mysql5/lib/mysql --with-authdaemond=/usr/local/courier-authlib/var/spool/authdaemon/socket && cp mac/libdes/public/des.h ./ && make && make install
关闭原有的sasl,并创建链接(这个地方我和原文有不同)postfix 2.3以后的版本会分别在/usr/local/lib和/usr/local/include中搜索sasl库文件及头文件,故还须将其链接至此目录中:
mv /usr/lib/sasl2 /usr/lib/sasl2.save
mv /usr/lib/libsasl2.so.2 /usr/lib/libsasl2.so.2.save
mv /usr/lib/libsasl2.so.2.0.22 /usr/lib/libsasl2.so.2.0.22.save
ln -sv /usr/local/sasl2/lib/* /usr/lib
ln -sv /usr/local/sasl2/lib/* /usr/local/lib
ln -sv /usr/local/sasl2/include/sasl/* /usr/local/include
创建运行时需要的目录并调试启动
mkdir -pv /var/state/saslauthd
/usr/local/sasl2/sbin/saslauthd -a shadow pam -d
启动并测试
/usr/local/sasl2/sbin/saslauthd -a shadow pam
配置库文件搜索路径
echo "/usr/local/sasl2/lib" >> /etc/ld.so.conf
echo "/usr/local/sasl2/lib/sasl2" >> /etc/ld.so.conf
ldconfig -v
开机自动启动
echo "/usr/local/sasl2/sbin/saslauthd -a shadow pam">>/etc/rc.local
九:安装BerkeleyDB
tar zxvf db-4.5.20.tar.gz
cd db-4.5.20/build_unix
../dist/configure --prefix=/usr/local/BerkeleyDB
make && make install
ln -sv /usr/local/BerkeleyDB/include /usr/include/db4
ln -sv /usr/local/BerkeleyDB/include/db.h /usr/include/db.h
ln -sv /usr/local/BerkeleyDB/include/db_cxx.h /usr/include/db_cxx.h
echo "/usr/local/BerkeleyDB/lib" >> /etc/ld.so.conf
ldconfig
十:安装httpd-2.2.8
tar zxvf httpd-2.2.8.tar.gz
cd httpd-2.2.8
./configure --prefix=/usr/local/apache2 --enable-so --enable-ssl --with-ssl=/usr/local/ssl --enable-track-vars --enable-rewrite --with-zlib --enable-mods-shared=most --enable-suexec --with-suexec-caller=daemon && make && make install
编辑httpd.conf
vi /usr/local/apache2/conf/httpd.conf
DirectoryIndex index.html 改为
DirectoryIndex index.html index.htm default.htm default.html index.php index.php3 index.jsp
#ServerName www.example.com:80 改为
ServerName www.example.com:80
加上下面两行
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps
apache 开机启动
ln -s /usr/local/apache2/bin/apachectl /etc/init.d/httpd
vi /etc/init.d/httpd
在第三行添加以下内容
#chkconfig:345 85 15
#deion: Start and stops the Apache HTTP Server.
chmod +x /etc/rc.d/init.d/httpd
chkconfig --add httpd
十一:安装GD
1:安装PNG
##########libpng###########
tar zxvf libpng-1.2.26.tar.gz && cd libpng-1.2.26 && cp s/makefile.linux ./makefile && ./configure --prefix=/usr/local/libpng && make && make install
2:安装freetype
##########freetype#########
tar zxvf freetype-2.3.5.tar.gz && cd freetype-2.3.5 && ./configure && make && make install
3:安装JPEG6
#########jpeg###############
tar zxvf jpegsrc.v6b.tar.gz && cd jpeg-6b && mkdir -pv /usr/local/jpeg/{,bin,lib,include,man/man1,man1} && ./configure --prefix=/usr/local/jpeg --enable-shared --enable- static && make && make install
4:安装GD
########GD###########
tar zxvf gd-2.0.35.tar.gz && cd gd-2.0.35 && ./configure --with-png --with-freetype --with-jpeg=/usr/local/jpeg/
make && make install
十二:安装php
安装LIBXML2
#####libxml2 #####
tar zxvf libxml2-2.6.31.tar.gz && cd libxml2-2.6.31 && ./configure --prefix=/usr/local/libxml2 && make && make install && cp xml2-config /usr/bin && cd ..
安装libmcrypt-2.5.7.tar.gz
#####libmcrypt-2.5.7 #####
tar zxvf libmcrypt-2.5.7.tar.gz && cd libmcrypt-2.5.7 && ./configure && make && make install && cd ..
安装PHP5.2.5
#########php-5.2.5##########
tar zxvf php-5.2.5.tar.gz && cd php-5.2.5 && ./configure --prefix=/usr/local/php5 --with-mysql=/usr/local/mysql5 --with-apxs2=/usr/local/apache2/bin/apxs --with-jpeg-dir=/usr/local/jpeg --with-freetype-dir=/usr/local/include/freetype2 --with-zlib --with-png-dir=usr/local/libpng12 --with-libxml-dir=/usr/local/libxml2 --with-gd --enable-ftp --enable-sockets -enable-mbstring=all- --with-mcrypt --with-mysqli=/usr/local/mysql5/bin/mysql_config && make && make install && cp php.ini-dist /usr/local/php5/lib/php.ini && cd
自由广告区 |
分类导航 |
邮件新闻资讯: IT业界 | 邮件服务器 | 邮件趣闻 | 移动电邮 电子邮箱 | 反垃圾邮件|邮件客户端|网络安全 行业数据 | 邮件人物 | 网站公告 | 行业法规 网络技术: 邮件原理 | 网络协议 | 网络管理 | 传输介质 线路接入 | 路由接口 | 邮件存储 | 华为3Com CISCO技术 | 网络与服务器硬件 操作系统: Windows 9X | Linux&Uinx | Windows NT Windows Vista | FreeBSD | 其它操作系统 邮件服务器: 程序与开发 | Exchange | Qmail | Postfix Sendmail | MDaemon | Domino | Foxmail KerioMail | JavaMail | Winwebmail |James Merak&VisNetic | CMailServer | WinMail 金笛邮件系统 | 其它 | 反垃圾邮件: 综述| 客户端反垃圾邮件|服务器端反垃圾邮件 邮件客户端软件: Outlook | Foxmail | DreamMail| KooMail The bat | 雷鸟 | Eudora |Becky! |Pegasus IncrediMail |其它 电子邮箱: 个人邮箱 | 企业邮箱 |Gmail 移动电子邮件:服务器 | 客户端 | 技术前沿 邮件网络安全: 软件漏洞 | 安全知识 | 病毒公告 |防火墙 攻防技术 | 病毒查杀| ISA | 数字签名 邮件营销: Email营销 | 网络营销 | 营销技巧 |营销案例 邮件人才:招聘 | 职场 | 培训 | 指南 | 职场 解决方案: 邮件系统|反垃圾邮件 |安全 |移动电邮 |招标 产品评测: 邮件系统 |反垃圾邮件 |邮箱 |安全 |客户端 |