Upgrade squid to the latest version

I’m looking to upgrade squid 3.0.x to the latest version 3.1.x.
Is there a way of doing it without losing the current configuration ?

The installed version was done using the binary package (rpm) and not compiled from a tar package.


I don’t know, but I think I know what your best chance would be.

First, whatever you do, back-up your existing squid.conf. I don’t know whether the existing squid.conf is completely compatible with a 3.1 series squid…it probably is (and ‘compatible’ includes ‘working, but leaves some features at their default values’, which I’d hope wouldn’t be dangerous, but you never know, without checking line-by-line.)

Secondly, the only repo I can see with a sufficiently up-to-date squid (on 11.3…you may well be on something more recent…or even something older) for you is Index of /repositories/server:/proxy/openSUSE_11.3
which has 3.1.12-36. There are a number of other repos with a squid, but that is the only one that I can see that meets the 3.1.x requirement.

Having enabled that repo, then switch your squid 3 to the new repo. Now you have a choice:

  • the sensible thing is to check the two squid.confs against one another
  • the dangerous/exciting (!) way is to rename the new squid.conf and copy the old one in place and see what, if anything, breaks…and fix it

I think you should take option 1 (compare (eg, diff) and edit the new .conf to include the stuff from the old one), but I think you’ll take option 2.

I have done this. The 3.1 RPM will not overwrite the old squid.conf but rename the squid.conf from the package as squid.conf.rpmnew. You should then do a diff of squid.conf and squid.conf.rpmnew to see what additional directives there are. Or in my case, I transferred the custom settings to the newer squid.conf.

Make a backup of squid.conf just in case anyway.

Thanks guys.
ken_yap, can you share with us how did you do that ?

I have Opensuse 11.2 running Squid 3.0.x and I downloaded the latest rpm.

Did you just run the command “rpm -U squid-3.1.x.rpm” ?
Did you run that on a live environment ? Were there any downtime.

Can you please give some details ?


I just made a backup of squid.conf just in case, did a rpm -Uhv squid-3.1-blah-blah.rpm and it installed the new squid.conf as squid.conf.rpmnew.

I then compared this with my current squid.conf and copied my customisations over and renamed it as the working squid.conf.

Naturally you should shutdown squid to avoid issues with running old binaries, etc. So there will be downtime. Since I’m using it mostly as an adblock for myself, it didn’t matter. For a production environment you should announce some downtime.

Thanks for your quick reply.
Will go ahead and try this and post my feedback here.


Hello ken_yap,
The upgrade went fine… and squid 3.1.11 was installed…Needed to upgrade some of the dependencies though.
but I noticed that the squid.conf.rpmnew created was not complete. It contains only the minimum recommended configuration as follows:

Recommended minimum configuration:

acl manager proto cache_object
acl localhost src ::1
acl to_localhost dst ::1

Example rule allowing access from your local networks.

Adapt to list your (internal) IP networks from where browsing

should be allowed

acl localnet src # RFC1918 possible internal network
acl localnet src # RFC1918 possible internal network
acl localnet src # RFC1918 possible internal network
acl localnet src fc00::/7 # RFC 4193 local private network range
acl localnet src fe80::/10 # RFC 4291 link-local (directly plugged) machines

acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http

Recommended minimum Access Permission configuration:

Only allow cachemgr access from localhost

http_access allow manager localhost
http_access deny manager

Deny requests to certain unsafe ports

http_access deny !Safe_ports

Deny CONNECT to other than secure SSL ports

http_access deny CONNECT !SSL_ports

We strongly recommend the following be uncommented to protect innocent

web applications running on the proxy server who think the only

one who can access services on “localhost” is a local user

#http_access deny to_localhost


Example rule allowing access from your local networks.

Adapt localnet in the ACL section to list your (internal) IP networks

from where browsing should be allowed

http_access allow localnet
http_access allow localhost

allow localhost always proxy functionality

http_access allow localhost

And finally deny all other access to this proxy

http_access deny all

Squid normally listens to port 3128

http_port 3128

We recommend you to use at least the following line.

hierarchy_stoplist cgi-bin ?

Uncomment and adjust the following to add a disk cache directory.

#cache_dir ufs /var/cache/squid 100 16 256

Leave coredumps in the first cache dir

coredump_dir /var/cache/squid

Add any of your own refresh_pattern entries above these.

refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|?) 0 0% 0
refresh_pattern . 0 20% 4320

Any ideas ??

I need the new squid.conf !
I was thinking about preparing a new machine with Opensuse 11.4 and then install squid 3.1.11 on that machine and copy the new squid.conf to my current producation environment after I make the necessary settings on that file of course…
But this is the hard way.
Any advices ?


If you look in /etc/squid/ there is another file squid.conf.documented which contains all the possible settings.

You’re right, haven’t paid attention to that file…
Will copy it into a new file, make my settings and then rename it to squid.conf, which I presume is the right procedure.

Many thanks for your help.