墨魚現形記--Squid安裝實錄

吳志凌

第一次啟動前最後的準備

首先要記得我們在前述的設定中設定squid以nobody身分執行,所以要先將存取cache的目錄(本例中是使用預設的/usr/local/squid/cache)以及儲存紀錄檔的目錄(/usr/local/squid/logs)擁有者設定成nobody,讓nobody可以存取本目錄(chown  nobody  /cache; chown nobody /usr/local/squid/logs),然後執行 /usr/local/squid/bin/squid z來讓squid先建立cache儲存目錄的結構:

gate9:[root][3:45pm][Wed][Sep.27.00][/usr/local/squid]

[513]% bin/squid  -z

2000/09/27 15:46:03| Creating Swap Directories

gate9:[root][3:46pm][Wed][Sep.27.00][/usr/local/squid]

[514]%

若是沒有任何的問題發生,我們就可以正式執行squid起來了:

/usr/local/squid/bin/squid  -sY 或 /usr/local/squid/bin/RunCache &

然後你可以看看在儲存紀錄檔之目錄(/usr/local/squid/logs)下的cache.log內容(使用tail f /usr/loca/squid/logs/cache.log,按Ctrl-C中斷),看看執行上是否正常或是有其他的問題:

2000/09/27 15:54:11| Starting Squid Cache version 2.3.STABLE4 for i386-pc-solaris2.8...

2000/09/27 15:54:11| Process ID 15071

2000/09/27 15:54:11| With 1024 file descriptors available

2000/09/27 15:54:11| Performing DNS Tests...

2000/09/27 15:54:11| Successful DNS name lookup tests...

2000/09/27 15:54:11| DNS Socket created on FD 5

2000/09/27 15:54:11| Adding nameserver 163.13.1.60 from /etc/resolv.conf

2000/09/27 15:54:11| Adding nameserver 163.13.240.16 from /etc/resolv.conf

2000/09/27 15:54:11| Unlinkd pipe opened on FD 10

2000/09/27 15:54:11| Swap maxSize 10240 KB, estimated 787 objects

2000/09/27 15:54:11| Target number of buckets: 15

2000/09/27 15:54:11| Using 8192 Store buckets

2000/09/27 15:54:11| Max Mem  size: 8192 KB

2000/09/27 15:54:11| Max Swap size: 10240 KB

2000/09/27 15:54:11| Store logging disabled

2000/09/27 15:54:11| Rebuilding storage in /usr/local/squid/cache (DIRTY)

2000/09/27 15:54:11| Set Current Directory to /usr/local/squid/cache

2000/09/27 15:54:11| Loaded Icons.

2000/09/27 15:54:11| Accepting HTTP connections at 0.0.0.0, port 3128, FD 9.

2000/09/27 15:54:11| Accepting ICP messages at 0.0.0.0, port 3130, FD 11.

2000/09/27 15:54:11| WCCP Disabled.

2000/09/27 15:54:11| Ready to serve requests.

你可以查看是否真有squid的Daemon程式執行起來﹔

Solaris:  ps  ef  |  grep squid

Linux或FreeBSD:  ps  auxwww  |  grep squid

gate9:[root][3:59pm][Wed][Sep.27.00][/usr/local/squid]

[604]% ps -ef | grep squid

    root 15305     1  0 15:59:23 ?        0:00 bin/squid -sY

    nobody 15306 15305  0 15:59:23 ?        0:00 (squid) -sY

    root 15349 14755  0 16:03:43 pts/5    0:00 grep squid