Guides

How to Install and Configure Squid Proxy Server on Ubuntu VPS

A proxy server is a computer that acts as an intermediary between a desktop computer and the Internet and allows a client machine to make an indirect connection to network servers and services. The following article will guide you step-by-step through how to install and configure Squid Proxy server on Ubuntu VPS.

Benefits of Running Squid Proxy VPS

There are many reasons why you might want to include a proxy server on your network:

  • To share Internet connection on a LAN
  • To speed up Internet surfing
  • To hide the IP address of the client computer for anonymous surfing
  • To implement Internet access control
  • To scan outbound content
  • To circumvent regional restrictions

Clearly some of the above reasons are perfectly fitting for a business and some, well, may not fall in line with your best practices. Regardless, knowing how to install and configure a proxy server is a must-have skill for a network administrator. So, let’s take care of that. I will demonstrate installing the Squid proxy server on Ubuntu 16.04 server.

Prerequisites

Prior to installation of Squid Proxy, you will need:

Install Squid Proxy

This installation and configuration will be handled completely from the command line, so open up a terminal window and prepare to type.

The first thing we want to do (as with software installation on Ubuntu) is to check for package updates. To check the package repositories for available updates, issue the following command from your SSH terminal window:

 sudo apt-get update 

You should also run an upgrade at this time, if available, with the command:

 sudo apt-get upgrade

Of course, should this upgrade the kernel, you’ll also want to reboot the server to complete the update. 

Once the update/upgrade is complete, install Squid with the command:

sudo apt-get install squid3

The installation will pick up the necessary dependencies (libecap3, libltdl7, squid-purge, and squid-langpack) and complete without issue.

That is all there is to the installation. Now we move on to the configuration of a basic proxy server.

Squid Proxy Configuration

The configuration of the Squid Proxy Server is handled in the /etc/squid/squid.conf. I will show you how to configure a very basic proxy server. The first thing we need to do is uncomment the line (by removing the # character):

Related Post
#http_access allow localnet

To find that line, issue the command:

sudo grep -n http_access /etc/squid/squid.conf

As you can see (Figure A), the configuration option is found on line 1186 (of my installation).

To open the squid.conf file for editing, issue the following command:

sudo nano /etc/squid/squid.conf

Scroll through the configuration to the previously mentioned line and uncomment by removing the # character.

Figure A

Grepping the necessary configuration option.

Next you want to look for the line:

#acl localnet src

There will be a number of them (for different network IP schemes). You will want to uncomment the one that matches your network (for example, 192.168.0.0/16) and alter it to your needs. Say you run your internal network on the 192.168.1.0/255.255.255.0 network. Your localnet configuration option would look like:

acl localnet src 192.168.1.0/255.255.255.0

Restart squid with the command:

sudo service squid restart

That’s it! You now have a basic proxy server up and running on port 3128 and the IP address of the system you just installed Squid on.

You can now add the proxy server to your client machines and configure them (either on a per-application or OS basis) to use that newly configured proxy via IP and port.

Make it work for you

Of course, Squid can do quite a bit more than serve as a basic proxy server. If you need to get deep into the various configuration options for Squid, make sure to take a look at the official documentation, where you can find out how to configure options for third-party applications, configure options for the neighbor selection algorithm, configure various network parameters, and much more. In the meantime, you can always take a look at the /var/log/squid/access.log and /var/log/squid/cache.log to see what Squid is doing on your network.

 

Editorial Staff

Rad Web Hosting is a leading provider of web hosting, Cloud VPS, and Dedicated Servers in Dallas, TX and Phoenix, AZ.

Recent Posts

How to Install MySQL 8 on VPS Server

This article provides a guide for how to install MySQL 8 on VPS server. Database Management Systems (DBMSs) are applications designed… Read More

30 mins ago

What are the Benefits of Reseller Hosting?

This article provides an overview of the benefits of reseller hosting. Reseller hosting offers numerous benefits. What are the Benefits… Read More

2 hours ago

5 Minute Guide to Integrate WHMCS VPS Reseller

This article provides a guide for how to integrate VPS Reseller with WHMCS. We will start by installing the WHMCS… Read More

2 hours ago

What Are the Advantages of Purchasing a VPS with Bitcoin?

Purchasing a Virtual Private Server (VPS) with Bitcoin or other cryptocurrencies comes with several advantages, reflecting both the nature of… Read More

2 hours ago

How to Debug Critical Error on your WordPress Website

There will be times when you will face serious downtime on your WordPress website due to a plugin causing an… Read More

2 hours ago

Benefits of JetBackup

Data redundancy is vital if you operate an online business. Without it, the risk of permanent data loss increases, which… Read More

2 hours ago