{"id":1802,"date":"2012-01-28T18:52:23","date_gmt":"2012-01-28T10:52:23","guid":{"rendered":"https:\/\/webhostinggeeks.com\/howto\/?p=1802"},"modified":"2023-07-20T09:41:25","modified_gmt":"2023-07-20T09:41:25","slug":"how-to-install-and-configure-squid-proxy-server-on-centos-6-2","status":"publish","type":"post","link":"https:\/\/webhostinggeeks.com\/howto\/how-to-install-and-configure-squid-proxy-server-on-centos-6-2\/","title":{"rendered":"How to Install and Configure Squid Proxy Server on CentOS 6.2"},"content":{"rendered":"<p>In web servers, the ability to install and configure a <a href=\"https:\/\/webhostinggeeks.com\/blog\/squid-proxy-server-features-functions-benefits\/\">Squid Proxy Server<\/a> on CentOS 6.2 is an essential skill for any webmaster or website administrator. Squid is a caching <a href=\"https:\/\/webhostinggeeks.com\/best\/proxy-servers\/\">proxy server<\/a> that acts as an intermediary between the user and the web, enhancing performance and reducing bandwidth usage. It can also function as a content accelerator or <a href=\"https:\/\/webhostinggeeks.com\/blog\/what-is-reverse-proxy\/\">reverse proxy<\/a>, serving cached versions of pages to fulfill requests.<\/p>\n<p>This tutorial will guide you through the process of installing and configuring a Squid 3 Proxy Server on CentOS 6.2. <\/p>\n<p>For more in-depth information on various web servers, you can visit our pages on the <a href=\"https:\/\/webhostinggeeks.com\/best\/web-server\/\">best web servers<\/a>, <a href=\"https:\/\/webhostinggeeks.com\/blog\/apache-http-server-explained\/\">Apache<\/a>, <a href=\"https:\/\/webhostinggeeks.com\/blog\/nginx-server-explained\/\">Nginx<\/a>, and <a href=\"https:\/\/webhostinggeeks.com\/blog\/litespeed-web-server-explained\/\">LiteSpeed<\/a>.<\/p>\n<h2>Step 1: Installing Squid Proxy<\/h2>\n<p>The first step in setting up a Squid Proxy Server on CentOS 6.2 is to install the Squid proxy using the yum command. This installation is performed using a local yum repository. To install Squid, you can use the following command:<\/p>\n<pre>\r\n[root@centos62 ~]# yum install squid -y\r\n<\/pre>\n<p>This command will install Squid and all its dependencies. Once the installation is complete, you can proceed to the next step.<\/p>\n<pre>\r\n[root@centos62 ~]# yum install squid -y\r\nLoaded plugins: fastestmirror\r\nLoading mirror speeds from cached hostfile\r\n * base: centos.maulvi.net\r\n * extras: centos.maulvi.net\r\n * updates: centos.maulvi.net\r\nSetting up Install Process\r\nResolving Dependencies\r\n--> Running transaction check\r\n---> Package squid.i686 7:3.1.10-1.el6_2.1 will be installed\r\n--> Processing Dependency: perl(Getopt::Long) for package: 7:squid-3.1.10-1.el6_2.1.i686\r\n--> Processing Dependency: perl(integer) for package: 7:squid-3.1.10-1.el6_2.1.i686\r\n--> Processing Dependency: perl(Pod::Usage) for package: 7:squid-3.1.10-1.el6_2.1.i686\r\n--> Processing Dependency: perl(DBI) for package: 7:squid-3.1.10-1.el6_2.1.i686\r\n--> Processing Dependency: perl(Digest::MD5) for package: 7:squid-3.1.10-1.el6_2.1.i686\r\n--> Processing Dependency: perl(vars) for package: 7:squid-3.1.10-1.el6_2.1.i686\r\n--> Processing Dependency: libltdl.so.7 for package: 7:squid-3.1.10-1.el6_2.1.i686\r\n--> Processing Dependency: perl(strict) for package: 7:squid-3.1.10-1.el6_2.1.i686\r\n--> Processing Dependency: \/usr\/bin\/perl for package: 7:squid-3.1.10-1.el6_2.1.i686\r\n--> Processing Dependency: perl(Getopt::Std) for package: 7:squid-3.1.10-1.el6_2.1.i686\r\n--> Processing Dependency: perl(Net::POP3) for package: 7:squid-3.1.10-1.el6_2.1.i686\r\n--> Running transaction check\r\n---> Package libtool-ltdl.i686 0:2.2.6-15.5.el6 will be installed\r\n---> Package perl.i686 4:5.10.1-119.el6_1.1 will be installed\r\n--> Processing Dependency: perl-libs = 4:5.10.1-119.el6_1.1 for package: 4:perl-5.10.1-119.el6_1.1.i686\r\n--> Processing Dependency: perl-libs for package: 4:perl-5.10.1-119.el6_1.1.i686\r\n--> Processing Dependency: perl(Pod::Simple) for package: 4:perl-5.10.1-119.el6_1.1.i686\r\n--> Processing Dependency: libperl.so for package: 4:perl-5.10.1-119.el6_1.1.i686\r\n--> Processing Dependency: perl(version) for package: 4:perl-5.10.1-119.el6_1.1.i686\r\n--> Processing Dependency: perl(Module::Pluggable) for package: 4:perl-5.10.1-119.el6_1.1.i686\r\n---> Package perl-DBI.i686 0:1.609-4.el6 will be installed\r\n--> Running transaction check\r\n---> Package perl-Module-Pluggable.i686 1:3.90-119.el6_1.1 will be installed\r\n---> Package perl-Pod-Simple.i686 1:3.13-119.el6_1.1 will be installed\r\n--> Processing Dependency: perl(Pod::Escapes) >= 1.04 for package: 1:perl-Pod-Simple-3.13-119.el6_1.1.i686\r\n---> Package perl-libs.i686 4:5.10.1-119.el6_1.1 will be installed\r\n---> Package perl-version.i686 3:0.77-119.el6_1.1 will be installed\r\n--> Running transaction check\r\n---> Package perl-Pod-Escapes.i686 1:1.04-119.el6_1.1 will be installed\r\n--> Finished Dependency Resolution\r\n\r\nDependencies Resolved\r\n\r\n====================================================================================================\r\n Package                     Arch       Version                    Repository                  Size\r\n====================================================================================================\r\nInstalling:\r\n squid                       i686       7:3.1.10-1.el6_2.1         updates                    1.7 M\r\nInstalling for dependencies:\r\n libtool-ltdl                i686       2.2.6-15.5.el6             CentOS6.2-Repository        45 k\r\n perl                        i686       4:5.10.1-119.el6_1.1       CentOS6.2-Repository       9.7 M\r\n perl-DBI                    i686       1.609-4.el6                CentOS6.2-Repository       705 k\r\n perl-Module-Pluggable       i686       1:3.90-119.el6_1.1         CentOS6.2-Repository        37 k\r\n perl-Pod-Escapes            i686       1:1.04-119.el6_1.1         CentOS6.2-Repository        30 k\r\n perl-Pod-Simple             i686       1:3.13-119.el6_1.1         CentOS6.2-Repository       209 k\r\n perl-libs                   i686       4:5.10.1-119.el6_1.1       CentOS6.2-Repository       590 k\r\n perl-version                i686       3:0.77-119.el6_1.1         CentOS6.2-Repository        49 k\r\n\r\nTransaction Summary\r\n====================================================================================================\r\nInstall       9 Package(s)\r\n\r\nTotal download size: 13 M\r\nInstalled size: 38 M\r\nDownloading Packages:\r\n(1\/9): squid-3.1.10-1.el6_2.1.i686.rpm                                       | 1.7 MB     00:14\r\n----------------------------------------------------------------------------------------------------\r\nTotal                                                               881 kB\/s |  13 MB     00:15\r\nwarning: rpmts_HdrFromFdno: Header V4 RSA\/SHA1 Signature, key ID c105b9de: NOKEY\r\nRetrieving key from file:\/\/\/etc\/pki\/rpm-gpg\/RPM-GPG-KEY-CentOS-6\r\nImporting GPG key 0xC105B9DE:\r\n Userid : CentOS-6 Key (CentOS 6 Official Signing Key) <centos-6-key@centos.org>\r\n Package: centos-release-6-2.el6.centos.7.i686 (@anaconda-CentOS-201112130233.i386\/6.2)\r\n From   : \/etc\/pki\/rpm-gpg\/RPM-GPG-KEY-CentOS-6\r\nRunning rpm_check_debug\r\nRunning Transaction Test\r\nTransaction Test Succeeded\r\nRunning Transaction\r\n  Installing : 1:perl-Pod-Escapes-1.04-119.el6_1.1.i686                                         1\/9\r\n  Installing : 3:perl-version-0.77-119.el6_1.1.i686                                             2\/9\r\n  Installing : 4:perl-libs-5.10.1-119.el6_1.1.i686                                              3\/9\r\n  Installing : 1:perl-Pod-Simple-3.13-119.el6_1.1.i686                                          4\/9\r\n  Installing : 1:perl-Module-Pluggable-3.90-119.el6_1.1.i686                                    5\/9\r\n  Installing : 4:perl-5.10.1-119.el6_1.1.i686                                                   6\/9\r\n  Installing : perl-DBI-1.609-4.el6.i686                                                        7\/9\r\n  Installing : libtool-ltdl-2.2.6-15.5.el6.i686                                                 8\/9\r\n  Installing : 7:squid-3.1.10-1.el6_2.1.i686                                                    9\/9\r\n\r\nInstalled:\r\n  squid.i686 7:3.1.10-1.el6_2.1\r\n\r\nDependency Installed:\r\n  libtool-ltdl.i686 0:2.2.6-15.5.el6             perl.i686 4:5.10.1-119.el6_1.1\r\n  perl-DBI.i686 0:1.609-4.el6                    perl-Module-Pluggable.i686 1:3.90-119.el6_1.1\r\n  perl-Pod-Escapes.i686 1:1.04-119.el6_1.1       perl-Pod-Simple.i686 1:3.13-119.el6_1.1\r\n  perl-libs.i686 4:5.10.1-119.el6_1.1            perl-version.i686 3:0.77-119.el6_1.1\r\n\r\nComplete!\r\n<\/pre>\n<h2>Step 2: Configuring Server Hosts File<\/h2>\n<p>The next step is to configure the server hosts file. This can be done using the vi editor. The hosts file should look something like this:<\/p>\n<pre>\r\n[root@centos62 ~]# vi \/etc\/hosts\r\n127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4\r\n::1         localhost localhost.localdomain localhost6 localhost6.localdomain6\r\n192.168.1.44 centos62.webhostinggeeks-dev3.com\r\n<\/pre>\n<h2>Step 3: Configuring Main Squid Configuration File<\/h2>\n<p>After configuring the server hosts file, the next step is to configure the main Squid configuration file. This can also be done using the vi editor. The command to edit the Squid configuration file is:<\/p>\n<pre>\r\n[root@centos62 ~]# vi \/etc\/squid\/squid.conf\r\n<\/pre>\n<h2>Step 4: Adding Internal Network Name<\/h2>\n<p>In the Squid configuration file, you need to add your internal network name into the IP networks list where browsing should be allowed. For example, if your internal network name is webhostinggeeks-dev3.com, you would add the following lines:<\/p>\n<pre>\r\nacl localnet src 10.0.0.0\/8             # RFC1918 possible internal network\r\nacl localnet src 172.16.0.0\/12          # RFC1918 possible internal network\r\nacl localnet src 192.168.0.0\/16.        # RFC1918 possible internal network\r\nacl localnet src fc00::\/7               # RFC 4193 local private network range\r\nacl localnet src fe80::\/10              # RFC 4291 link-local (directly plugged) machines\r\nacl webhostinggeeks-dev3.com src 192.168.1.0\/24    # Your internal network\r\n<\/pre>\n<h2>Step 5: Allowing Browsing for Your Network<\/h2>\n<p>Next, you need to allow browsing for your network in the ACLsection. This can be done by adding the following lines to the Squid configuration file:<\/p>\n<pre>\r\n#http_access allow localnet\r\nhttp_access allow localhost\r\nhttp_access allow webhostinggeeks-dev3.com\r\n<\/pre>\n<h2>Step 6: Configuring Squid Proxy Port<\/h2>\n<p>By default, Squid listens to port 3128. However, you can change this to any available port. To do this, make sure the Squid proxy port line is uncommented and set to your desired port. For example:<\/p>\n<pre>\r\n# Squid normally listens to port 3128\r\nhttp_port 3128\r\n<\/pre>\n<h2>Step 7: Configuring Auto Start at Boot for Squid Service<\/h2>\n<p>To ensure that the Squid service starts automatically at boot, you can use the following command:<\/p>\n<pre>\r\n[root@centos62 ~]# chkconfig squid on\r\n<\/pre>\n<h2>Step 8: Starting Squid Service<\/h2>\n<p>After all the configurations are done, you can start the Squid service using the following command:<\/p>\n<pre>\r\n[root@centos62 ~]# service squid restart\r\n<\/pre>\n<pre>\r\n[root@centos62 ~]# service squid restart\r\nStopping squid: ................                           [  OK  ]\r\nStarting squid: .                                          [  OK  ]\r\n<\/pre>\n<h2>Step 9: Configuring Client Browser<\/h2>\n<p>Finally, you need to configure your client browser to use the Squid proxy server. The specific steps for this will vary depending on the browser you are using.<\/p>\n<p><img decoding=\"async\" data-src=\"https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2012\/01\/proxy-centos6.2.png\" alt=\"proxy-centos6.2\" width=\"384\" height=\"339\" class=\"alignnone size-full wp-image-17128 lazyload\" data-srcset=\"https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2012\/01\/proxy-centos6.2.png 384w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2012\/01\/proxy-centos6.2-300x265.png 300w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2012\/01\/proxy-centos6.2-128x113.png 128w\" data-sizes=\"(max-width: 384px) 100vw, 384px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 384px; --smush-placeholder-aspect-ratio: 384\/339;\" \/><\/p>\n<h2>Commands Mentioned<\/h2>\n<ul>\n<li><span class=\"fw-bold\">yum install squid -y<\/span> \u2013 Installs Squid proxy server<\/li>\n<li><span class=\"fw-bold\">vi \/etc\/hosts<\/span> \u2013 Opens the server hosts file for editing<\/li>\n<li><span class=\"fw-bold\">vi \/etc\/squid\/squid.conf<\/span> \u2013 Opens the Squid configuration file for editing<\/li>\n<li><span class=\"fw-bold\">chkconfig squid on<\/span> \u2013 Configures Squid to start automatically at boot<\/li>\n<li><span class=\"fw-bold\">service squid restart<\/span> \u2013 Starts or restarts the Squid service<\/li>\n<\/ul>\n<h2>Conclusion<\/h2>\n<p>Installing and configuring a Squid Proxy Server on CentOS 6.2 is a multi-step process that involves installing the Squid proxy, configuring the server hosts file, configuring the Squid configuration file, and setting up the client browser.<\/p>\n<p>By following the steps outlined in this tutorial, you can successfully set up a Squid Proxy Server and enhance the performance of your web server.<\/p>\n<p>Whether you&#8217;re using a <a href=\"https:\/\/webhostinggeeks.com\/blog\/what-is-dedicated-server-hosting\/\">dedicated server<\/a>, a <a href=\"https:\/\/webhostinggeeks.com\/blog\/what-is-vps-hosting\/\">VPS server<\/a>, or <a href=\"https:\/\/webhostinggeeks.com\/blog\/what-is-cloud-hosting\/\">cloud hosting<\/a>, understanding how to install and configure a Squid Proxy Server is a valuable skill for any webmaster or website administrator.<\/p>\n<h2>FAQ<\/h2>\n<ol itemscope itemtype=\"https:\/\/schema.org\/FAQPage\">\n<li itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<p class=\"fw-bold\" itemprop=\"name\">What is the role of a Squid Proxy Server?<\/p>\n<p itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n                <span itemprop=\"text\">A Squid Proxy Server primarily acts as a caching proxy server between the user and the web, enhancing performance and reducing bandwidth usage. It can also function as a content accelerator or reverse proxy, serving cached versions of pages to fulfill requests.<\/span>\n            <\/p>\n<\/li>\n<li itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<p class=\"fw-bold\" itemprop=\"name\">How do you install Squid Proxy Server on CentOS 6.2?<\/p>\n<p itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n                <span itemprop=\"text\">You can install Squid Proxy Server on CentOS 6.2 using the yum command. The command is &#8216;yum install squid -y&#8217;.<\/span>\n            <\/p>\n<\/li>\n<li itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<p class=\"fw-bold\" itemprop=\"name\">How do you configure the Squid Proxy Server?<\/p>\n<p itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n                <span itemprop=\"text\">You can configure the Squid Proxy Server by editing the Squid configuration file.You can open this file for editing using the command &#8216;vi \/etc\/squid\/squid.conf&#8217;. In this file, you can add your internal network name to the list of IP networks where browsing should be allowed, allow browsing for your network in the ACL section, and set the Squid proxy port.<\/span>\n            <\/p>\n<\/li>\n<li itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<p class=\"fw-bold\" itemprop=\"name\">How do you start the Squid service?<\/p>\n<p itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n                <span itemprop=\"text\">You can start the Squid service using the command &#8216;service squid restart&#8217;. This command will also restart the Squid service if it is already running.<\/span>\n            <\/p>\n<\/li>\n<li itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<p class=\"fw-bold\" itemprop=\"name\">How do you configure your client browser to use the Squid proxy server?<\/p>\n<p itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n                <span itemprop=\"text\">The specific steps to configure your client browser to use the Squid proxy server will vary depending on the browser you are using. Generally, you will need to go to the browser&#8217;s settings or preferences, find the section for network or proxy settings, and enter the IP address and port of the Squid proxy server.<\/span>\n            <\/p>\n<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>In web servers, the ability to install and configure a Squid Proxy Server on CentOS 6.2 is an essential skill for any webmaster or website administrator. Squid is a caching&#8230;<\/p>\n","protected":false},"author":6,"featured_media":1554,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"wds_primary_category":0,"footnotes":""},"categories":[2055,1057],"tags":[1253,1536,1678,1793],"class_list":["post-1802","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos","category-squid-server","tag-centos-6-2","tag-linux","tag-proxy","tag-squid"],"_links":{"self":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/1802","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/comments?post=1802"}],"version-history":[{"count":0,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/1802\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media\/1554"}],"wp:attachment":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media?parent=1802"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/categories?post=1802"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/tags?post=1802"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}