網頁

2013年8月18日 星期日

Squid 3.1 --- Install and start with basic configuration

As we know, Squid is a public proxy server in open source environment. If use it, we can easy to cache and filter web content for reusing it for the same request in the future. For realizing its function, I will build a lab for testing it. At first, we have to know how to install this package.

Squid InstallationBy doing yum install squid command, we can quickly and easily install the squid package and its dependencies from the yum repositories.ScreenHunter_17ScreenHunter_18So does that the Squid package will be installed nowScreenHunter_28
Squid ConfigurationAfter installing Squid package, there is recommended minimum configuration that exists in the /etc/squid/squid.conf file and it can work finely without changing anything. Of course,we can correct some parameter in this default setting for conforming with the actual environment.(# 1)
After changing the configuration, we can do the command /usr/sbin/squid –f /etc/squid/squid.conf –k parse to verify whether the configuration syntax is wrong or incorrect. (# 2)ScreenHunter_20When the prerequisite is ready, we will begin to start squid daemon. For starting it in the first time, we need to do the command /usr/sbin/squid –z to create the swap directories.ScreenHunter_21and uncomment the cache_dir directories in the /etc/squid/squid.conf file (# 3)ScreenHunter_23next to start squid daemon by executing the command service squid start. So do that the Cache directories will be created in the /var/spool/squid path.ScreenHunter_24For starting Squid daemon automatically when system boots, we need to type the command chkconfig –levels 235 squid on if we need it.ScreenHunter_22
Squid function verification
After start squid daemon, we can do something to verify whether its function is normal now.
<In Server>
To confirm whether the default listening port 3128 is opened by executing the command netstat –tnl | grep 3128 if we don’t change the http_port in squid configuration.ScreenHunter_30<In Client>
In the moment, we can try to ping & telnet this squid proxy to realize whether network channel is normal between Squid Server and Client machine. ScreenHunter_25If it is normal, we need to change proxy setting in any Browsers as IE or Firefox. That is proxy server sets the squid hostname or IP and port sets squid port number as 3128.ScreenHunter_24So do that we can normally explore Internet now.ScreenHunter_26
Reference
(# 1).  Squid configuration directives
(# 2). Although I ever set hostname in the file /etc/sysconfig/network, it still has warning message “hostname rDNS test failed; Could not determine this machine public hostname” by executing the command /usr/sbin/squid –f /etc/squid/squid.conf –k parse ScreenHunter_01This problem is resolved until I add a record IP mapping FQDN into /etc/hostsScreenHunter_02or add a record visible_hostname 10.10.101.254 into the file /etc/squid/squid.confScreenHunter_03(# 3) When we execute the command /usr/sbin/squid –NCd1, the warning message tell us that cache_mem is larger than total disk cache space now.ScreenHunter_26So we change cache space from 100MB to 1024MB because cache_mem define 256 MB manually.
ScreenHunter_28

沒有留言:

張貼留言

Since 2010 Design by Davidwa
©Copyright Davidwa Inc. All rights reserved.