(3)安裝DHCP服務器 1、源程序下載地址是:ftp://ftp.isc.org/isc/dhcp/dhcp-3.0.tar.gz ,我們的版本是:dhcpd-3.0
2、復制到:/usr/local/scr后解壓:tar zxvf dhcp-3.0.tar.gz
3、cd /usr/local/src/dhcp-3.0.tar.gz
4、./configure
5、make(如果不是第一次編譯,先make clean)
6、make install
7、cp ./server/dhcpd.conf /etc
8、編輯這個文件,看起來類似下面這樣:(要更改的地方用粗體標出)
# dhcpd.conf # # Sample configuration file for ISC dhcpd # # option definitions common to all supported networks... option domain-name "rd.xxx.com"; option domain-name-servers compaq.rd.xxx.com; default-lease-time 86400; max-lease-time 172800; ddns-update-style ad-hoc; # If this DHCP server is the official DHCP server for the local # network, the authoritative directive should be uncommented. #authoritative; # Use this to send dhcp log messages to a different log file (you also # have to hack syslog.conf to complete the redirection). log-facility local7; # No service will be given on this subnet, but declaring it helps the # DHCP server to understand the network topology. # This is a very basic subnet declaration. subnet 21.9.22.0 netmask 255.255.255.224 { range 21.9.22.2 21.9.22.6; option routers 21.9.22.1; } # This declaration allows BOOTP clients to get dynamic addresses, # which we don't really recommend. #subnet 10.254.239.32 netmask 255.255.255.224 { # range dynamic-bootp 10.254.239.40 10.254.239.60; # option broadcast-address 10.254.239.31; # option routers rtr-239-32-1.example.org; #} # A slightly different configuration for an internal subnet. #subnet 10.5.5.0 netmask 255.255.255.224 { # range 10.5.5.26 10.5.5.30; # option domain-name-servers ns1.internal.example.org; # option domain-name "internal.example.org"; # option routers 10.5.5.1; # option broadcast-address 10.5.5.31; # default-lease-time 600; # max-lease-time 7200; #} # Hosts which require special configuration options can be listed in # host statements. If no address is specified, the address will be # allocated dynamically (if possible), but the host-specific information # will still come from the host declaration. #host passacaglia { # hardware ethernet 0:0:c0:5d:bd:95; # filename "vmunix.passacaglia"; # server-name "toccata.fugue.com"; #} # Fixed ip addresses can also be specified for hosts. These addresses # should not also be listed as being available for dynamic assignment. # Hosts for which fixed IP addresses have been specified can boot using # BOOTP or DHCP. Hosts for which no fixed address is specified can only # be booted with DHCP, unless there is an address range on the subnet # to which a BOOTP client is connected which has the dynamic-bootp flag # set. #host fantasia { # hardware ethernet 08:00:07:26:c0:a5; # fixed-address fantasia.fugue.com; #} # You can declare a class of clients and then do address allocation # based on that. The example below shows a case where all clients # in a certain class get addresses on the 10.17.224/24 subnet, and all # other clients get addresses on the 10.0.29/24 subnet. #class "foo" { # match if substring (option vendor-class-identifier, 0, 4) = "SUNW"; #} #shared-network 224-29 { # subnet 10.17.224.0 netmask 255.255.255.0 { # option routers rtr-224.example.org; # } # subnet 10.0.29.0 netmask 255.255.255.0 { # option routers rtr-29.example.org; # } # pool { # allow members of "foo"; # range 10.17.224.10 10.17.224.250; # } # pool { # deny members of "foo"; # range 10.0.29.10 10.0.29.230; # }
|
上面這個文件中后面都是注釋,是原來系統給你的配置做的例子,可以不要。當然除非你用到它們,并且清楚它們的含義。
9、建立空文件:touch /var/state/dhcp/dhcpd.leases空文件
10、檢查內核編譯選項:Networking options-----Packet socket: mmapped IO和Socket Filtering選項是否被選中(不知道怎么看?看看前面的文章,用make menuconfig呀),如果沒有就需要重新編譯內核了。
11、route add -host 255.255.255.255 dev eth0
12、roote add -host localhost dev eth0
13、在/etc/rc.d/rc.local最后增加一行route add -host 255.255.255.255 dev eth0
14、reboot系統
15、用dhcpd命令啟動DHCP,用其他的機器試試看能不能自動配置網絡了。
(4) 安裝apache+MySQL+php+gd+png+zlib+jpeg+freetype+sslmod
這么一大堆東西為什么要一塊說呢?因為他們中間是有緊密聯系的,尤其是那個PHP,用到其他所有的模塊。要想PHP功能全,只能一步步來了。
1、首先安裝MYSQL:從http://www.mysql.com/downloads/index.html下載自己覺得合適的版本。這里用3.23.42版本。
2、進入目錄/usr/local/src(這個以后就不用說了吧?)解壓縮:tar zxvf mysql-3.23.42.tar.gz
3、cd mysql-3.23.42/
4、configure --PRefix=/usr/local/mysql
5、make
6、make install
7、useradd mysql ; groupadd mysql ; su mysql ;(建立命名為mysql的用戶和組,并切換為mysql身份)
8、scripts/mysql_install_db (建立數據庫結構)
9、cd /usr/local/mysql/bin
10、./safe_mysqld & (啟動了)
11、./mysqladmin -u root passWord "new-password"(你的新密碼,記住MYSQL的密碼核系統密碼是獨立的,缺省是沒有密碼)
12、用mysql程序試試看。
下面的步驟都很程式化,我盡量簡潔地寫出。
13、下載相關的軟件包:地址表格如下
軟件 版本 地址jpegsrc.v6b.tar.gz 6b ftp://ftp.uu.net/graphics/jpegzlib.tar.gz 1.1.3 ftp://ftp.uu.net/graphics/png/srcfreetype-2.0.8.tar.gz 2.0.8 http://www.freetype.orglibpng-1.0.10.tar.gz 1.0.10 ftp://ftp.uu.net/graphics/png/srcgd-1.8.4.tar.gz 1.8.4 http://www.boutell.com/gdapache_1.3.23.tar.gz 1.3.23 http://www.apache.orgphp-4.1.1.tar.gz 4.1.1 http://www.php.netnumber4.tar.gz 4 http://www.php.net/extrarsaref20.tar.Z 2.0 ftp://ftp.ai.mit.edu/pub/debergopenssl-engine-0.9.6c.tar.gz 0.9.6c http://www.openssl.org/sourcemod_ssl-2.8.6-1.3.23.tar.gz 2.8.6 http://www.modssl.org
|
下齊了就放在/usr/local/src目錄下,除了number4.tar.gz和rsaref20.tar.Z以外,其他一律用tar zxvf XXXX.tar.gz解壓縮。(過癮吧?)
特殊的,rsaref20.tar.Z 需要先建立一個rsaref-2.0目錄,然后把rsaref20.tar.Z復制到改目錄下用tar zxvf rsaref30.tar.Z釋放壓縮。Number4.tar.gz需要復制到php-4.1.1目錄內,然后用tar zxvf number4.tar.gz解壓縮。
下面的描述我想簡單一點,只寫出進入目錄后執行的命令。那些目錄都是釋放的時候自己建立的,如果你這些操作都在/usr/local/src下面執行,所有的目錄就都在這里面。最好按照順序執行。再羅嗦一句:如果不是第一次編譯,一般情況請執行一次make clean后再編譯。
14、[jpeg-6b]:生成JPEG圖像的函數庫。
./configure make make test make install
|
15、[zlib-1.1.3]:壓縮算法庫,是PNG和JPEG需要的
16、[freetype-2.0.8]:字體庫,在圖像上使用字體的時候需要用到,
./configure --prefix=/usr/local make make install
|
17、[libpng-1.0.10]:生成PNG圖像的函數庫
cp scripts/makefile.linux makefile make test pngtest pngnow.png (如果都通過測試了,請繼續。否則,看看錯誤提示,改正錯誤) make install
|
18、[gd-1.8.4]:GD庫,用來動態生成圖像用,這里主要是配合PHP生成圖像。
編輯Makefile 文件:
把下列行取消注釋符號(#):
CFLAGS=-O -DHAVE_LIBXPM -DHAVE_LIBPNG -DHAVE_LIBJPEG -DHAVE_LIBFREETYPE -DHAVE_LIBTTF LIBS=-lgd -lpng -lz -ljpeg -lfreetype -lm -lttf 注釋下列行(增加#): CFLAGS=-O -DHAVE_LIBPNG -DHAVE_LIBJPEG LIBS=-lgd -lpng -lz -lm 修改下列行: INCLUDEDIRS=-I. -I/usr/local/include/freetype2 -I/usr/include/X11 -I/usr/X11R6/include/X11 -I/usr/local/include -I/usr/include/freetype
|
保存后執行:
19、[apache_1.3.23]:步驟一 ./configure --prefix=/usr/local/apache
20、[php-4.1.1]:
如果不是第一次安裝,請刪除:config.cache文件,然后執行先執行make clean
接下來配置環境,輸入一個比較長的命令:
./configure --with-apache=/usr/local/src/apache_1.3.23 --with-config-file-path=/local/apache/conf --with-enable-versioning --with-mysql=/usr/local/mysql --with-ftp --with-gd=/usr/local/src/gd-1.8.4 --with-enabled-bcmath=yes --with-disable-debug --enable-memory-limit=yes --enable-track-vars --with-zlib --with-jpeg-dir=/usr/local/src/jpeg-6b --with-png-dir=/usr/local/src/libpng-1.0.10 --with-freetype-dir=/usr//local/src/freetype-2.0.8
|
當然你也可以實現準備一個含有上述命令的sh文件,這樣改起來方便些。我就是這樣做的。
21、[rsaref-2.0]:RSA加密模塊
前面說過,這個目錄的釋放是特殊的,先見目錄后釋放,希望你是這樣做的。
cp -rp install/unix local cd local make mv rsaref.a librsaref.a
|
22、[openssl-engine-0.9.6c]:openssl引擎
./config -prefix=/usr/local/ssl -L`pwd`/../rsaref-2.0/local/ rsaref –fPIC make make test make install
|
23、[mod_ssl-2.8.6-1.3.23]
./configure --with-apache=../apache_1.3.23
|
24、[apache_1.3.23]步驟二
./configure --prefix=/usr/local/apache --enable-shared=ssl --enable-module=ssl --activate-module=src/modules/php4/libphp4.a make make certificate TYPE=custom(回答一些問題) make install
|
25、收尾工作:
編輯/usr/local/apache/conf/httpd.conf文件,增加一行:
AddType application/x-httpd-php .php
|
26、用命令/usr/local/apache/bin/apachectl configtest檢查一下配置文件的正確性。
27、用/usr/lcoal/apache/bin/apachectl start啟動apache服務器
28、在/usr/local/apache/htdocs建立一個test.php文件包含下列內容:
29、在別的機器上用瀏覽器看一下這個機器:http://xxx.xxx.xxx.xxx/test.php會出現php的配置總匯,看看前面編譯的模塊都在不在。
30、檢驗ssl很麻煩,需要用apachectl startssl啟動apache然后還要生成一大堆證書。這里就不討論了。
31、把/usr/local/apache/bin/apachectl文件復制到/etc/rc.d/init.d中,然后在/etc/rc.d/rd3.d中建立個符號連接指向/etc/rc.d/init.d中的上述文件:
ln -s ../init.d/apachectl S70apachectl
|
這樣系統啟動的時候就可以自動啟動apache和她的哪一大堆模塊了。
呼~~~~(喘口氣)到這里,就基本上完成了一個功能很全的WEB服務器系統了。
(5)安裝 ftp 服務器
(6)安裝 pop3服務器
有的郵件服務器自己帶pop3功能(比如Qmail、Xmail),如果你用這幾種郵件服務器軟件,當然就不用安裝pop3了。目前,常用的郵件服務器里面不帶pop3的好象只有sendmail和postfix等少數幾種。這幾種郵件服務器軟件使用的都是系統用戶,而我們安裝的pop3也只是對系統用戶的郵件進行彈出操作的。這里我們使用的版本和下載地址是:
qpopper4.0.3.tar.gz http://www.eudora.com/qpopper_general/
|
同樣的,把文件下載到/usr/local/src中,按照下列步驟安裝:
tar zxvf qpopper4.0.3.tar.gz cd qpopper4.0.3 ./configure make make install
|
完成后,qpopper安裝在/usr/local/sbin中(如果你愿意把它放在其他地方,可以在前面用./configure –prefix=/your_path指定),文件名叫作popper。通常情況下,popper是作為一個inetd(超級網絡服務進程)的子進程加載的。這樣需要編輯文件/etc/inetd.conf并做下面改動: ...
# POP3 mail server #pop-3 stream tcp nowait root /usr/sbin/tcpd ipop3d pop-3 stream tcp nowait root /usr/local/sbin/popper qpopper –s ...
|
增加黑體的這一行,注釋掉原來的(上面這一行),注意,如果你的安裝路經不同,記著改過來呀。然后,用下面的命令得到inetd的進程號:
得到結果類似:
什么?哪個是進程號?就是最前面那個數字。然后用下面的命令重新啟動inetd:
用下面的命令看看pop3是不是啟動了。
如果結果是這樣,就恭喜了。
tcp 0 0 0.0.0.0:110 0.0.0.0:* LISTEN
|
這里還要補充一點,少數情況下,pop3進程需要獨立的監聽端口,也就是不作為inetd的子進程裝載,上面過程需要做如下改動:
./configure的時候加上--enable-standalone參數。
編輯/etc/inetd.conf不增加黑體一行,但需要注釋掉原來的pop-3一行(如果有的話)。
啟動的時候,直接運行/usr/local/sbin/popper xxx.xxx.xxx.xxx:110即可。后面的參數是本地需要幾監聽的IP地址和端口。注意,沒有特殊需要,端口必須是110。最后要說的是:其實最簡單的辦法就是用你使用的Linux發行包帶的pop3軟件,安裝的時候直接選上即可。