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.So does that the Squid package will be installed now
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)When 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.and uncomment the cache_dir directories in the /etc/squid/squid.conf file (# 3)next 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.For starting Squid daemon automatically when system boots, we need to type the command chkconfig –levels 235 squid on if we need it.
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.<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. If 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.So do that we can normally explore Internet now.
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 This problem is resolved until I add a record IP mapping FQDN into /etc/hostsor add a record visible_hostname 10.10.101.254 into the file /etc/squid/squid.conf(# 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.So we change cache space from 100MB to 1024MB because cache_mem define 256 MB manually.
沒有留言:
張貼留言