Guide to Setting Up and Configuring Squid Proxy Server
In this guide, we’ll walk through the process of setting up and configuring a Squid proxy server on an Ubuntu machine. This involves installing necessary packages, configuring the Squid service, and verifying its operation. We’ll also explain each command used throughout the setup.
Step 1: Update and Upgrade the System
Before installing new software, it’s good practice to update the package list and upgrade the existing packages to ensure we have the latest versions and security patches.
sudo apt-get update
sudo apt-get upgrade
Step 2: Install Squid and Network Tools
Next, we’ll install Squid, a popular caching and forwarding HTTP proxy. Additionally, we’ll install net-tools for network troubleshooting.
sudo apt-get install squid3
sudo apt-get install net-tools
Step 3: Manage the Squid Service
After installation, we need to start, enable, and check the status of the Squid service to ensure it runs properly.
sudo systemctl start squid
sudo systemctl status squid
sudo systemctl enable squid
sudo systemctl restart squid
Step 4: Verify Squid’s Network Listening
To ensure Squid is listening on the correct port, we can use netstat and ps.
sudo netstat -tulnp | grep 3128
ps -ef | grep squid
领英推荐
Step 5: Backup and Modify Squid Configuration
Before making changes, we back up the original configuration file. Then, we edit the configuration to set the desired proxy settings.
sudo cp /etc/squid/squid.conf /etc/squid/squid.conf.bak
sudo vim /etc/squid/squid.conf
Inside the configuration file, make the following changes:
#http_port 3128
http_port 192.100.10.10:3128
#http_access allow localhost manager
http_access allow all
#http_access deny manager
acl localnet src 192.168.0.0/16
Step 6: Restart and Check Squid Service
After modifying the configuration, restart the Squid service and check its status.
sudo systemctl restart squid
sudo systemctl status squid
Step 7: Verify Squid’s Network Listening Again
Finally, we recheck if Squid is listening on the correct port and IP.
sudo netstat -tulnp | grep squid
Additional Step: Setting Up a VirtualBox VM
To test the proxy configuration, you can set up a VirtualBox VM with Ubuntu and manually configure the proxy settings to use 192.100.10.10:3128.