Debian架站筆記

01.安裝後後首先得先調整locales
dpkg-reconfigure locales
增加zh_TW.UTF-8並且設其為預設

02.手動調整網路環境
nano /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
address 60.249.214.xxx
netmask 255.255.255.0
network 60.249.214.0
broadcast 60.249.214.255
gateway 60.249.214.254
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 168.95.192.1
dns-search xxx.com.tw

nano /etc/resolv.conf
search linux
nameserver 60.249.214.xxx

nano /etc/hosts
cat /etc/hosts
127.0.0.1 localhost.localdomain localhost
60.249.214.178 linux.xxx.com.tw linux
60.249.214.178 xxx.com.tw linux

設定hostname
echo linux.xxx.com.tw > /etc/hostname
/bin/hostname -F /etc/hostname

重新開機
sync
reboot
ps.linux代表主機名稱

03.安裝套件
apt-get install apache2 mysql-server mysql-client php4 phpmyadmin libapache2-mod-php4 php4-gd icewm x-window-system-core vncserver vnc-java ttf-arphic-uming firestarter xterm bind postfix postfix-tls sasl2-bin libsasl2-modules dovecot

04.apache2之額外設定
/etc/apache2/conf.d/virtual.conf

Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all



DocumentRoot /var/www/xxx.com.tw
ServerName www.xxx.com.tw



order deny,allow
deny from all
allow from 127.7.7.1 60.249.214.xxx
AllowOverride All



DocumentRoot /var/www/phpmyadmin
ServerName mysql.xxx.com.tw


05.設定postfix
nano /etc/postfix/main.cf
# See /usr/share/postfix/main.cf.dist for a commented, more complete version

smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

myhostname = linux.xxx.com.tw
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = xxx.com.tw, linux.xxx.com.tw, localhost.xxx.com.tw, localhost
relayhost =
mynetworks = 127.0.0.0/8
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
smtpd_sasl_local_domain =
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_security_options = noanonymous
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, check_relay_domains, reject_unauth_destination
smtpd_client_restrictions = permit_sasl_authenticated

nano /etc/default/saslauthd
# This needs to be uncommented before saslauthd will be run automatically
START=yes

# You must specify the authentication mechanisms you wish to use.
# This defaults to "pam" for PAM support, but may also include
# "shadow" or "sasldb", like this:
# MECHANISMS="pam shadow"

MECHANISMS="pam"

設定 PostFix 使用 Saslauthd
addgroup postfix sasl
mkdir -p /etc/postfix/sasl

nano /etc/postfix/sasl/smtpd.conf
pwcheck_method: saslauthd
mech_list: plain login

nano /etc/dovecot/dovecot.conf
......
protocols = pop3 imap
......

nano /etc/postfix/master.cf
......
# ==========================================================================
# service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (yes) (never) (100)
# ==========================================================================
smtp inet n - n - - smtpd -v
......

06.設定bind


reobbt services

nano /etc/bind/named.conf.local
//
// Add local zone definitions here.
zone "domainname.com.tw" {
type master;
file "/etc/bind/xxx.com.tw.hosts";
};

zone "214.249.60.in-addr.arpa" in {
type master;
file "/etc/bind/db.60.249.214";

nano /etc/bind/xxx.com.tw.hosts
$ttl 38400
domainname.com.tw. IN SOA linux.xxx.com.tw. webmaster.xxx.com.tw (
1162800440
10800
3600
604800
38400 )
xxx.com.tw. IN NS linux.xxx.com.tw.
xxx.com.tw. IN MX 10 linux.xxx.com.tw.
linux.xxx.tw. IN A 60.249.214.xxx
www.xxx.com.tw. IN A 60.249.214.xxx
xxx.com.tw. IN A 60.249.214.xxx
mysql IN CNAME linux.xxx.com.tw.

nano /etc/bind/db.60.249.214
@ IN SOA linux.xxx.com.tw webmaster.xxx.com.tw. (
2002111300 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS debian.test.com.

120 PTR linux.xxx.com.tw.

參考資料
http://www.howtoforge.com/perfect_setup_debian_sarge
http://wiki.debian.org.tw/index.php/Postfix-SASL
http://www.lslnet.com/linux/docs/linux-3897.htm

留言

熱門文章