網路安裝相關磁片:
安裝類型選 FTP 的時候的設定:
FTP 站台名稱:163.19.1.81 (或 apt.nc.hcc.edu.tw)
Fedora Core 1 所在目錄:/pub/fedora/linux/core/1/i386/os
或
FTP 站台名稱:140.110.17.49 (或 opensource.nchc.org.tw)
Fedora Core 1 所在目錄:/distributions/Fedora/1/i386/os
註:
1. 這裡是以 新竹縣網路中心 和 國家高速網路中心 的 FTP 站台為範例, 路徑一定要對,否則就會出現錯誤訊息
2. 若知道別的 FTP 站台的話,當然也可以設別的 FTP 站
安裝過程注意事項:
PuTTY: Microsoft Windows 下好用的 ssh 連線工具
官方網站:http://www.chiark.greenend.org.uk/~sgtatham/putty/
下載:http://the.earth.li/~sgtatham/putty/latest/x86/putty.exe
字型修改 (PuTTY 預設字型是 Courier New,是西歐字集,中文顯示會出問題,我們必須要更換到有 CHINESE_BIG5 字集的字型才可以正常顯示中文)
vi /etc/sysconfig/i18n
LANG="zh_TW.Big5 "
SUPPORTED="zh_TW.UTF-8:zh_TW:zh"
SYSFONT="latarcyrheb-sun16"
註:
1.vi (or vim )是 Unix-like 作業系統下最通用、強悍的文字編輯器,儘管入門困難,建議一定要花時間將其基本操作學會
2.在整體大環境尚未無法完全配合 unicode 的狀況下,大五碼(big5)還是有著較好的相容性
修改 IP 、FQDN (安裝過程設定正確的話,是不用作任何修改的,有需要才修改)
查看 IP:ifconfig
修改 IP:netconfig(或修改此檔:/etc/sysconfig/network-scripts/ifcfg-eth0 )
FQDN 設定:
vi /etc/hosts
vi /etc/sysconfig/network
DNS 設定:
vi /etc/resolv.conf(for 新竹縣)
nameserver 163.19.1.1
nameserver 163.19.3.1
關閉網卡:ifdown eth0
啟動網卡:ifup eth0
vi /etc/hosts.deny
ALL:ALL
vi /etc/hosts.allow
ALL:163.19.59.0/255.255.255. 0:allow
sshd:ALL:allow
vsftpd:ALL:allow
sendmail:ALL:allow
imapd:ALL:allow
ipop3d:ALL:allow
執行 ntsysv 指令,只留下以下服務
acpid
anacron
crond
irqbalance
microcode_ctl
network
random
saslauthd
sendmail
sshd
syslog
yum
安裝 Fedora Core 1、freshrpms 的 GPG KEY :
rpm --import /usr/share/doc/fedora-release-1/RPM-GPG-KEY
rpm --import ftp://apt.nc.hcc.edu.tw/pub/freshrpms/RPM-GPG-KEY
註:
裝了 Fedora Core 1、freshrpms 的 GPG key 之後,在安裝他們維護的 rpm 的時候才不會出現警告訊息,若不在乎這些訊息,沒有安裝也是沒有關係的
rpm -ivh ftp://apt.nc.hcc.edu.tw/pub/apt/fedora/linux/1/i386/RPMS.extra/apt-0.5.15cnc3-0.1.hcc .i386.rpm
apt-get update;apt-get -y dist-upgrade;apt-get clean;reboot
註:
另外一種更新方法 -- yum
yum -y update
使用 yum 更新的話,要有耐心,第一次會花很久的時間,yum 的其他用法請善用 man
apt-get install httpd mod_ssl
cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.bak
vi /etc/httpd/conf/httpd.conf
(vi 的搜尋:/ 、再次搜尋:n )(vi 行數顯示::set nu 、到第?行:數字 +G )
348行 UserDir disable --> # UserDir disable
384行 DirectoryIndex index.html index.html.var --> DirectoryIndex index.html index.htm index.php index.html.var
763行 AddDefaultCharset UTF-8 --> AddDefaultCharset null (vi 刪除功能:x)
/etc/rc.d/init.d/httpd start
chkconfig httpd on
lynx 介紹
apt-get install lynx
lynx tw.yahoo.com
lynx 中文設定:按 o 進入設定畫面
Display character set : [Taipei (Big5)] )
Assumed document character set(!): [big5]
測試:lynx Your_IP
順利的話可以看到 Fedora Core test page
apt-get install vsftpd
cp /etc/vsftpd/vsftpd.conf /etc/vsftpd/vsftpd.conf.bak
vi /etc/vsftpd/vsftpd.conf
12行 anonymous_enable=YES --> anonymous_enable=NO
#在檔案最後面加上
chroot_local_user=YES
/etc/rc.d/init.d/vsftpd start
chkconfig vsftpd on
新增一個使用者來測試(這裡是新增 u20 這個帳號來測試)
adduser u20
passwd u20
cd /home/u20
touch ftptest.txt
測試:lftp -u u20 Your_IP (或 lftp u20@Your_IP )
如何讓 root 可以使用 ftp(如何上傳網頁到 /var/www/html)
將 /etc/vsftpd.ftpusers、vsftpd.user_list 這兩個檔案內的 root 刪掉,即可用 root 帳號登入 ftp server 了
因為在 /etc/vsftpd/vsftpd.conf 內我們有設定 chroot_local_user=YES 參數,這個參數的設定在限制使用者只能在自己的家目錄活動,為了讓 root 可以上傳網頁到 /var/www/html ,所以我們用 mount -bind 的方式將 /var/www/html 資料夾連結到 /root/web,這樣我們就可以用 root 上傳網頁了
註:在 ftp 下,ln -s(symbolic link)是無法作用的(因為 chroot 的關係),所以才用 mount -b 的方式
作法:
mkdir /root/web
mount --bind /var/www/html /root/web
開機就自動將 /var/www/html 掛載到 /root/web:
vi /etc/rc.local
mount --bind /var/www/html /root/web
以後只要將網頁上傳到 /root/web 就可以了
Microsoft Windows 下好用的 ftp 自由軟體:FileZilla
官方網站:http://filezilla.sourceforge.net/ (下載 )
注意: FileZilla 的傳輸過程預設是沒有加密的,使用 root 來操作有安全性的風險,所以操作的時候記得在
「伺服器型態 」的地方勾選「設定SFTP使用SHH2 」,為傳輸過程加密
apt-get install sendmail sendmail-cf m4 cyrus-sasl
cp /etc/mail/sendmail.mc /etc/mail/sendmail.mc.bak
vi /etc/mail/sendmail.mc
42行 dnl TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
43行 dnl define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
//刪掉前面的 dnl,注意:前面不能留有空格(vi 刪掉字:x)
84行 DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1 , Name=MTA')dnl -->
DAEMON_OPTIONS(`Port=smtp,Addr=0.0.0.0 , Name=MTA')dnl
cp /etc/mail/sendmail.cf /etc/mail/sendmail.cf.bak
m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
vi /etc/mail/access
加入以下兩行(請依自己學校狀況修改)
sqes.hcc.edu.tw RELAY
163.19.59 RELAY
makemap hash /etc/mail/access < /etc/mail/access
/etc/rc.d/init.d/saslauthd restart
/etc/rc.d/init.d/sendmail restart
chkconfig saslauthd on
chkconfig sendmail on
測試:telnet localhost 25(離開:Ctrl+]、quit)
apt-get install imap
/etc/rc.d/init.d/xinetd start
chkconfig imap on
chkconfig ipop3 on
chkconfig xinetd on
POP3 測試:telnet localhost 110(離開:Ctrl+],quit)
IMAP 測試:telnet localhost 143
參考資料:http://openwebmail.org/openwebmail/download/redhat/rpm/packages/fc1/00HOWTO.TXT
1.安裝必須的套件:
apt-get install perl-Compress-Zlib perl-suidperl
rpm -ivh http://openwebmail.com/openwebmail/download/redhat/rpm/packages/fc1/perl-Text-Iconv-1.2-fc1.i386.rpm
2.安裝 Open Webmail:
rpm -ivh http://openwebmail.com/openwebmail/download/redhat/rpm/release/openwebmail-2.30-1.i386.rpm
3.修改 Open Webmail 設定檔:
vi /var/www/cgi-bin/openwebmail/etc/openwebmail.conf
default_iconset Cool3D.English --> default_iconset Cool3D. Chinese.Traditional
#加進下面三行,強制使用大五碼、取消 ssh 終端機和修改密碼的功能
#Open Webmail 的密碼修改功能無法同步 samba 的密碼,所以將它取消,要修改密碼建議用 WAM 修改
default_language zh_TW.Big5
enable_sshterm no
enable_changepwd no
此設定檔的後面是使用者寄信的預設簽名檔,請自行修改紅字部分
<default_signature>
--
Open WebMail Project (http://openwebmail.org)
</default_signature>
4.修改 dbm 設定檔:
vi /var/www/cgi-bin/openwebmail/etc/dbm.conf
(注意:原本並沒有這個檔案)
新增下面三行
dbm_ext .db
dbmopen_ext .db
dbmopen_haslock yes
5.初始化:
/var/www/cgi-bin/openwebmail/openwebmail-tool.pl --init
#過程有點久,耐心等候
6.測試: http://Your_IP /cgi-bin/openwebmail/openwebmail.pl
參考資料:http://turtle.ee.ncku.edu.tw/~tung/openwebmail/install.html
wget http://turtle.ee.ncku.edu.tw/openwebmail/download/current/openwebmail-current.tar.gz
wget http://turtle.ee.ncku.edu.tw/openwebmail/download/packages/CGI.pm-2.74.tar.gz
wget http://turtle.ee.ncku.edu.tw/openwebmail/download/packages/MIME-Base64-2.20.tar.gz
wget http://turtle.ee.ncku.edu.tw/openwebmail/download/packages/libnet-1.0901.tar.gz
wget http://turtle.ee.ncku.edu.tw/openwebmail/download/packages/Text-Iconv-1.2.tar.gz
apt-get install perl-suidperl perl-Compress-Zlib gcc
安裝 CGI.pm
tar -zxvf CGI.pm-2.74.tar.gz
cd CGI.pm-2.74
perl Makefile.PL
make
make test
make install
安裝 MIME-Base64
cd ..
tar zxvf MIME-Base64-2.20.tar.gz
cd MIME-Base64-2.20
perl Makefile.PL
make
make test
make install
安裝 libnet
cd ..
tar -zxvf libnet-1.0901.tar.gz
cd libnet-1.0901
perl Makefile.PL
(Do you want to modify/update your configuration (y|n) ? [no] ,過程中有問這個問題請回答 no )
make
make test
make install
安裝 Text-Iconv
cd ..
tar -zxvf Text-Iconv-1.2.tar.gz
cd Text-Iconv-1.2
perl Makefile.PL
make
make test
make install
安裝 Open WebMail
1.
cd ..
cp openwebmail-current.tgz /var/www
cd /var/www
tar zxvfBp openwebmail-current.tgz
#安裝說明檔:data/openwebmail/doc/readme.txt
mv data/openwebmail html/
rmdir data
2.
cp /var/www/cgi-bin/openwebmail/auth/auth_unix.pl /var/www/cgi-bin/openwebmail/auth/auth_unix.pl.bak
vi /var/www/cgi-bin/openwebmail/auth/auth_unix.pl
24行 my $passwdfile_encrypted = $conf{'passwdfile_encrypted'} || '/etc/master.passwd' ; -->修改成
my $passwdfile_encrypted = "/etc/shadow" ;
25行 my $passwdmkdb = $conf{'passwdmkdb'} || '/usr/sbin/pwd_mkdb' ; --> 修改成
my $passwdmkdb = "none" ;
3.
cp /var/www/cgi-bin/openwebmail/etc/openwebmail.conf /var/www/cgi-bin/openwebmail/etc/openwebmail.conf.bak
vi /var/www/cgi-bin/openwebmail/etc/openwebmail.conf
mailspooldir /var/mail --> mailspooldir /var/spool/mail
ow_cgidir /usr/local/www/cgi-bin/openwebmail --> ow_cgidir /var/www/cgi-bin/openwebmail
ow_htmldir /usr/local/www/data/openwebmail --> ow_cgidir to '/var/www/html/openwebmail '
在後面新增
spellcheck /usr/bin/ispell
default_iconset Cool3D.Chinese.Traditional
enable_sshterm no
enable_changepwd no
此設定檔的最後面是使用者寄信的預設簽名檔,請自行修改紅字部分
<default_signature>
--
Open WebMail Project (http://openwebmail.org)
</default_signature>
4.
cp /var/www/cgi-bin/openwebmail/etc/dbm.conf.default /var/www/cgi-bin/openwebmail/etc/dbm.conf
vi /var/www/cgi-bin/openwebmail/etc/dbm.conf
dbmopen_ext none --> dbmopen_ext .db
dbmopen_haslock no --> dbmopen_haslock yes
5.
vi /etc/logrotate.d/syslog 在最後加上
/var/log/openwebmail.log {
postrotate
/usr/bin/killall -HUP syslogd
endscript
}
6.
/var/www/cgi-bin/openwebmail/openwebmail-tool.pl --init
#過程有點久,耐心等候
測試:https ://Your_IP /cgi-bin/openwebmail/openwebmail.pl
vi /etc/httpd/conf/httpd.conf 在此設定檔最後面加上
ScriptAlias /webmail "/var/www/cgi-bin/openwebmail/openwebmail.pl"
/etc/rc.d/init.d/httpd restart
測試:https ://Your_IP /webmail/
註:
cd /var/www/cgi-bin/openwebmail/etc
openwebmail.conf.default - 內定的設定檔, 包含所有 Open WebMail 可以修改的選項
openwebmail.conf.help - openwebmail.conf.default 所有選項的說明檔
openwebmail.conf - 主要的設定檔, 管理者要設定的選項, 應該都寫在這個檔案裡頭
apt-get install squid
cp /etc/squid/squid.conf /etc/squid/squid.conf.bak
vi /etc/squid/squid.conf
修改 678 行,將 # 取消,100 改為 500(請視使用人數加大 cache 資料夾)
# cache_dir ufs /var/spool/squid 100 16 256
成為
cache_dir ufs /var/spool/squid 500 16 256
1711 行的地方加入下面這一行,限制允許連線範圍,紅色部分請依自己學校狀況修改
acl school src 163.19.59.0/255.255.255.0
1757、1758 行中間加入紅色這一行
http_access allow localhost
http_access allow school
http_access deny all
/etc/rc.d/init.d/squid start
chkconfig squid on
測試:為 lynx 掛上 proxy
vi /etc/lynx.cfg,1581 行的地方新增下面這一行,紅色部分請依自己學校狀況修改
http_proxy:http://Your_IP :3128/
lynx tw.yahoo.com
apt-get install dhcp
參考設定檔:/usr/share/doc/dhcp-3.0pl2/dhcpd.conf.sample
cp /usr/share/doc/dhcp-3.0pl2/dhcpd.conf.sample /etc/dhcpd.conf
vi /etc/dhcpd.conf
修改如下,紅色部分請依自己學校狀況修改
ddns-update-style interim;
subnet 163.19.59.0 netmask 255.255.255.0 {
option routers 163.19.59.254 ;
option subnet-mask 255.255.255.0 ;
option domain-name "sqes.hcc.edu.tw ";
option domain-name-servers 163.19.1.1 ;
range dynamic-bootp 163.19.59.100 163.19.59.200 ;
}
line-height: 100%; margin-top: 0pt; margin-bottom