Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»Network Services»Proxy»How to Install Squid Proxy Server on CentOS/RHEL 7/6 & Fedora 30/29/28

    How to Install Squid Proxy Server on CentOS/RHEL 7/6 & Fedora 30/29/28

    By RahulJune 4, 20192 Mins Read

    Squid is the most popular Proxy server for Linux systems. The squid proxy server is also useful for the web packet filtering. Most of the web hosting providers use the Squid proxy for caching the repetitive data to increase website speed.

    Advertisement

    This article will help you to Install and Configure SQUID Proxy Server on CentOS, Redhat and Fedora Linux systems.

    Step 1 – Install Squid

    Squid packages are available in default yum repositories. Execute below command on your server to install SQUID proxy server.

    sudo yum install squid       # On CentOS/RedHat Systems 
    sudo dnf install squid       # On Fedora Systems 
    

    Step 2 – Change Squid Port (optional)

    Squid default runs on port 3128. If you want to start squid on different port, Edit squid configuration file and change http_port value. For example we are changing squid to run on port 8080.

    /etc/squid/squid.conf

    http_port 8080
    

    After making changing let’s restart Squid service to reload the configuration changes

    service squid restart
    

    Step 3 – Block Specific Website with Squid

    Let’s start with the additional configuration like blocking any website using squid proxy server. Add below rules to block specific website before any allow all rules. Below example will block yahoo.com and www.rediff.com.

    acl blocksite1 dstdomain yahoo.com
    acl blocksite2 dstdomain www.rediff.com
    http_access deny blocksite1
    http_access deny blocksite2
    

    If you have a long list of domain names, Create a file /etc/squid/blockwebsites.lst and put domain names one per line and add below rule in squid configuration file.

    acl blocksitelist dstdomain "/etc/squid/blockwebsites.lst"
    http_access deny blocksitelist
    

    blockwebsites.lst file content example:

    # cat /etc/squid/blockwebsites.lst
    
    yahoo.com
    www.rediff.com
    

    Step 4 – Block Specific Keyword with Squid

    Add below rules to block specific website before any allow all rules. Below example will block all pages having keyword yahoo or Gmail.

    acl blockkeyword1 url_regex yahoo
    acl blockkeyword2 url_regex gmail
    http_access deny blockkeyword1
    http_access deny blockkeyword2
    

    If you have a long list of keywords, Create a file /etc/squid/blockkeywords.lst and put keywords one per line and add below rule in the squid configuration file.

    acl blockkeywordlist url_regex "/etc/squid/blockkeywords.lst"
    http_access deny blockkeywordlist
    

    blockkeywords.lst file content example:

    # cat /etc/squid/blockkeywords.lst
    
    yahoo
    gmail
    facebook
    

    Congratulation’s you have successfully install and configured Squid proxy server. Read next article to Configure Squid for Mac Address Based Filtering.

    configure squid install squid proxy proxy server setup squid squid squid on centos
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    How To Set Up Nginx Reverse Proxy: A Step-By-Step Tutorial

    How to install Squid on Ubuntu and Debian

    How to Setup Squid Proxy Server on Ubuntu and Debian

    How to Use Curl Command with Proxy on Linux

    View 7 Comments

    7 Comments

    1. Viral on March 13, 2021 5:21 am

      twitter.com is not blocking

      Reply
    2. Hung Nguyen on March 27, 2018 3:38 am

      How to config squid.conf to set X-Forwarded-For log Client IP and Proxy IP in HTTP request

      Reply
    3. Sivashankar on November 18, 2017 2:37 pm

      Hi,

      I have successfully installed squid on RHEL 7.3. I want to understand how I can route all the request via squid?

      Reply
    4. abhijeet on January 6, 2016 10:58 am

      I get the error “No squid package found”

      Reply
      • jahanzeb on September 22, 2017 1:51 pm

        configure yum

        Reply
      • ashok on December 18, 2018 9:34 am

        install squid packages

        Reply
    5. Ganesh Solankar on January 9, 2014 1:57 pm

      hello sir,

      i have learning to hadoop s/w created squid proxy server all configuartion is ok i access log webmin s/w
      but i want to access to a log hadoop s/w can you give me the solution .i hope you give the best solution on my email id

      Reply

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • How to Install PHP 8.2-7.4 on RHEL & CentOS Stream 9
    • How to Install MySQL 8.0 on RHEL & CentOS Stream 9
    • How to Split Large Archives in Linux using the Command Line
    • System.out.println() Method in Java: A Beginner’s Guide
    • Split Command in Linux With Examples (Split Large Files)
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.