Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have a current version of squid on my system 3.1.4
I tried updating to 3.1.18 by doing this:
wget http://www.squid-cache.org/Versions/...-3.1.18.tar.gz
cd /usr/local/sbin/myscripts
tar xzf squid-3.1.18.tar.gz
cd squid-3.1.18
./configure --prefix=/etc/squid --enable-delay-pools --enable-useragent-log
make
make install
service squid restart
but on restarting and running squid -v, it still reports 3.1.4
To where is the symbolic link of Squid pointing? Most likely the new version got installed in a subdirectory of its own. Check to where the init script is pointing, then check if that's a binary/symbolic link. If it's a symbolic link, find out where it points to, find out where the new binary got installed and change the symlink.
To where is the symbolic link of Squid pointing? Most likely the new version got installed in a subdirectory of its own. Check to where the init script is pointing, then check if that's a binary/symbolic link. If it's a symbolic link, find out where it points to, find out where the new binary got installed and change the symlink.
Yes, indicating it with that prefix would install it there. But you start it with the service command using the init script in /etc/init.d (or /etc/rc.d/init.d for RH if I recall correct). Where is that script's start option pointing to?
Yes, indicating it with that prefix would install it there. But you start it with the service command using the init script in /etc/init.d (or /etc/rc.d/init.d for RH if I recall correct). Where is that script's start option pointing to?
Kind regards,
Eric
hmm not sure:
Code:
start() {
probe
parse=`$SQUID -k parse -f $SQUID_CONF 2>&1`
RETVAL=$?
if [ $RETVAL -ne 0 ]; then
echo -n $"Starting $prog: "
echo_failure
echo
echo "$parse"
return 1
fi
for adir in $CACHE_SWAP; do
if [ ! -d $adir/00 ]; then
echo -n "init_cache_dir $adir... "
$SQUID -z -F -f $SQUID_CONF >> /var/log/squid/squid.out 2>&1
fi
done
echo -n $"Starting $prog: "
$SQUID $SQUID_OPTS -f $SQUID_CONF >> /var/log/squid/squid.out 2>&1
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
timeout=0;
while : ; do
[ ! -f /var/run/squid.pid ] || break
if [ $timeout -ge $SQUID_PIDFILE_TIMEOUT ]; then
RETVAL=1
break
fi
sleep 1 && echo -n "."
timeout=$((timeout+1))
done
fi
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$SQUID
[ $RETVAL -eq 0 ] && echo_success
[ $RETVAL -ne 0 ] && echo_failure
echo
return $RETVAL
}
Look at the beginning of the init file in the part where the variables are defined.
Kind regards,
Eric
Code:
#!/bin/bash
# chkconfig: - 90 25
# pidfile: /var/run/squid.pid
# config: /etc/squid/squid.conf
#
### BEGIN INIT INFO
# Provides: squid
# Short-Description: starting and stopping Squid Internet Object Cache
# Description: Squid - Internet Object Cache. Internet object caching is \
# a way to store requested Internet objects (i.e., data available \
# via the HTTP, FTP, and gopher protocols) on a system closer to the \
# requesting site than to the source. Web browsers can then use the \
# local Squid cache as a proxy HTTP server, reducing access time as \
# well as bandwidth consumption.
### END INIT INFO
PATH=/usr/bin:/sbin:/bin:/usr/sbin
export PATH
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
if [ -f /etc/sysconfig/squid ]; then
. /etc/sysconfig/squid
fi
# don't raise an error if the config file is incomplete
# set defaults instead:
SQUID_OPTS=${SQUID_OPTS:-""}
SQUID_PIDFILE_TIMEOUT=${SQUID_PIDFILE_TIMEOUT:-20}
SQUID_SHUTDOWN_TIMEOUT=${SQUID_SHUTDOWN_TIMEOUT:-100}
SQUID_CONF=${SQUID_CONF:-"/etc/squid/squid.conf"}
# determine the name of the squid binary
[ -f /usr/sbin/squid ] && SQUID=squid
prog="$SQUID"
# determine which one is the cache_swap directory
CACHE_SWAP=`sed -e 's/#.*//g' $SQUID_CONF | \
grep cache_dir | awk '{ print $3 }'`
RETVAL=0
probe() {
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 1
According to the init script you're using this file to start Squid:
Code:
/usr/sbin/squid
Check if it's a symlink to another file or the binary itself. If it's a symlink then delete it and create a new one with the same name pointing to the binary of your installation. If it's a binary, rename it or move it so you can still use it if you want.
According to the init script you're using this file to start Squid:
Code:
/usr/sbin/squid
Check if it's a symlink to another file or the binary itself. If it's a symlink then delete it and create a new one with the same name pointing to the binary of your installation. If it's a binary, rename it or move it so you can still use it if you want.
No! Copy that file to another location for backup purposes, for example to your home directory. Next copy the newly installed binary (in /etc/squid/bin I imagine) to /usr/sbin overwriting the one that you backed up. If you copy it to /etc/squid you'd overwrite the newly installed version. After that restart the service and check. If you compiled with prefix /etc/squid the new binary should be in that directory.
No! Copy that file to another location for backup purposes, for example to your home directory. Next copy the newly installed binary (in /etc/squid/bin I imagine) to /usr/sbin overwriting the one that you backed up. If you copy it to /etc/squid you'd overwrite the newly installed version. After that restart the service and check. If you compiled with prefix /etc/squid the new binary should be in that directory.
Kind regards,
Eric
Could I just recompile and instead install into /usr/sbin/squid ?
So, ./configure --prefix=/usr/sbin/squid --enable-delay-pools --enable-useragent-log
I don't understand why the program goes into usr/sbin/squid when the files and everything else are in /etc/squid
You really should check the FHS (Filesystem Hierarchy Standard). That indicates what goes where. Although Linux let's you be in control you should keep some standards. Installing binaries in /etc is a bad idea, you'll loose track of your installations. /etc is for configuration files only. So compiling with a prefix like /etc/squid will work but is against the FHS and will only complicate your life and ours if you encounter problems since your files will not be in the 'normal' location. You should instead compile without prefix if your version of Squid will be the only one. I'm not sure but normally you should get an idea if you run
Code:
./configure --help
to see what defaults are used if you don't indicate options, most likely if you don't provide --prefix the binary will be installed in /usr/sbin or /usr/bin.
So if you want to undo what you've done, clean up your /etc (remove the squid directory) and compile again, taking into account what I indicated above. Another thing: is there any reason why you are compiling from source instead of using version provided by your distro's repository? I'm guessing you use CentOS, RHEL, ... (RPM based).
You really should check the FHS (Filesystem Hierarchy Standard). That indicates what goes where. Although Linux let's you be in control you should keep some standards. Installing binaries in /etc is a bad idea, you'll loose track of your installations. /etc is for configuration files only. So compiling with a prefix like /etc/squid will work but is against the FHS and will only complicate your life and ours if you encounter problems since your files will not be in the 'normal' location. You should instead compile without prefix if your version of Squid will be the only one. I'm not sure but normally you should get an idea if you run
Code:
./configure --help
to see what defaults are used if you don't indicate options, most likely if you don't provide --prefix the binary will be installed in /usr/sbin or /usr/bin.
So if you want to undo what you've done, clean up your /etc (remove the squid directory) and compile again, taking into account what I indicated above. Another thing: is there any reason why you are compiling from source instead of using version provided by your distro's repository? I'm guessing you use CentOS, RHEL, ... (RPM based).
Kind regards,
Eric
thanks
It's because my distro is only up to v 3.1.4 and squid are already on 3.1.18
I removed the /etc/squid folder then recreated it and put squid.conf in there.
I compiled into /usr/sbin
But now on starting squid I get this error:
Code:
[root@264219 myscripts]# service squid start
Starting squid: [FAILED]
2011/12/06 07:42:15| Processing Configuration File: /etc/squid/squid.conf (depth 0)
2011/12/06 07:42:15| WARNING: Netmasks are deprecated. Please use CIDR masks instead.
2011/12/06 07:42:15| WARNING: IPv4 netmasks are particularly nasty when used to compare IPv6 to IPv4 ranges.
2011/12/06 07:42:15| WARNING: For now we will assume you meant to write /32
2011/12/06 07:42:15| storeDirWriteCleanLogs: Starting...
2011/12/06 07:42:15| Finished. Wrote 0 entries.
2011/12/06 07:42:15| Took 0.00 seconds ( 0.00 entries/sec).
FATAL: MIME Config Table /etc/squid/mime.conf: (2) No such file or directory
Squid Cache (Version 3.1.4): Terminated abnormally.
CPU Usage: 0.015 seconds = 0.005 user + 0.010 sys
Maximum Resident Size: 19312 KB
Page faults with physical i/o: 0
[root@264219 myscripts]#
Presumably because there is nothing in /etc/squid apart from the conf file?
squid -v still says 3.1.4 also.
Your system / Squid installation is probably messed up about now, so I'd suggest you to uninstall everything referring to Squid from your system. Backup your configuration file and delete any symlinks, binaries, directories to Squid you can find, then cleanup your build directory and start from scratch. That will be the easiest way I believe.
I did a yum remove squid.
I have CentOS so did this:
RedHat, RHEL
The following ./configure options install Squid into the RedHat structure properly:
--prefix=/usr
--includedir=/usr/include
--datadir=/usr/share
--bindir=/usr/sbin
--libexecdir=/usr/lib/squid
--localstatedir=/var
--sysconfdir=/etc/squid
./configure --enable-delay-pools --enable-useragent-log --prefix=/usr --includedir=/usr/include --datadir=/usr/share --bindir=/usr/sbin --libexecdir=/usr/lib/squid --localstatedir=/var --sysconfdir=/etc/squid
the make, then make install
but now I cannot start squid:
[root@264219 squid]# service squid restart
squid: unrecognized service
[root@264219 squid]# squid -v
Squid Cache: Version 3.1.18 NOW UPDATED
configure options: '--enable-delay-pools' '--enable-useragent-log' '--prefix=/usr' '--includedir=/usr/include' '--datadir=/usr/share' '--bindir=/usr/sbin' '--libexecdir=/usr/lib/squid' '--localstatedir=/var' '--sysconfdir=/etc/squid' --with-squid=/usr/local/sbin/myscripts/squid-3.1.18 --enable-ltdl-convenience
[root@264219 squid]#
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.