[squid-users] compiling squid 4

Alex Gutiérrez Martínez alex at dvm.esines.cu
Thu Feb 28 21:03:00 UTC 2019


Hello again community, I still have problems compiling squid 4. This is 
what i did this time

Soporte básico necesario:

# apt install arj bzip2 xz-utils cabextract cpio file lzma lhasa lzop 
rpm2cpio gzip nomarch pax lzop rar unrar unzip zoo unace razor pyzor 
tnef ripole zip p7zip-full mc multitail ccze libcppunit-dev libsasl2-dev 
libxml2-dev libkrb5-dev libdb-dev libnetfilter-conntrack-dev 
libexpat1-dev libcap2-dev libldap2-dev libpam0g-dev libgnutls28-dev 
libssl-dev libdbi-perl libecap3 libecap3-dev libntlm0-dev libkf5kiontlm5 
samba-dev ldap-utils

Instalar binarios necesarios para compilar Squid4, the system retunr a 
error whe in start the service:

sudo apt install logrotate acl attr autoconf bison nettle-dev 
build-essential libacl1-dev libaio-dev libattr1-dev libblkid-dev 
libbsd-dev libcap2-dev libcppunit-dev libldap2-dev pkg-config 
libxml2-dev libdb-dev libgnutls28-dev openssl devscripts fakeroot 
libdbi-perl libssl1.0-dev libcppunit-dev libecap3-dev libkrb5-dev 
comerr-dev libnetfilter-conntrack-dev libpam0g-dev libsasl2-dev

  sudo groupadd -g 13 proxy
  sudo mkdir -p /var/spool/squid
  sudo mkdir -p /var/log/squid
  sudo useradd --system -g proxy -u 13 -d /var/spool/squid -M -s 
/usr/sbin/nologin proxy
  sudo chown proxy:proxy /var/spool/squid
  sudo chown proxy:proxy /var/log/squid

cd /opt
wget -c http://www.squid-cache.org/Versions/v4/squid-4.6.tar.xz
  tar xfv squid-4.6.tar.xz

Configuramos las opciones básicas que podamos necesitar:

./configure --srcdir=. --prefix=/usr --localstatedir=/var/lib/squid 
--libexecdir=/usr/lib/squid --datadir=/usr/share/squid 
--sysconfdir=/etc/squid --with-default-user=proxy 
--with-logdir=/var/log/squid --with-open-ssl=/etc/ssl/openssl.cnf 
--with-openssl --enable-ssl --enable-ssl-crtd --build=x86_64-linux-gnu 
--with-pidfile=/var/run/squid.pid --enable-removal-policies=lru,heap 
--enable-delay-pools --enable-cache-digests --enable-icap-client 
--enable-ecap --enable-follow-x-forwarded-for --with-large-files 
--with-filedescriptors=65536 
--enable-auth-basic=DB,fake,getpwnam,LDAP,NCSA,NIS,PAM,POP3,RADIUS,SASL,SMB 
--enable-auth-digest=file,LDAP --enable-auth-negotiate=kerberos,wrapper 
--enable-auth-ntlm=fake --enable-linux-netfilter 
--with-swapdir=/var/spool/squid --enable-useragent-log --enable-htpc 
--infodir=/usr/share/info --mandir=/usr/share/man 
--includedir=/usr/include --disable-maintainer-mode 
--disable-dependency-tracking --disable-silent-rules --enable-inline 
--enable-async-io --enable-storeio=ufs,aufs,diskd,rock --enable-eui 
--enable-esi --enable-icmp --enable-zph-qos 
--enable-external-acl-helpers=file_userip,kerberos_ldap_group,time_quota,LDAP_group,session,SQL_session,unix_group,wbinfo_group 
--enable-url-rewrite-helpers=fake --enable-translation --enable-epoll 
--enable-snmp --enable-wccpv2 --with-aio --with-pthreads

Compiling with  4 cores:

make -j 4

Installing:

sudo  make install

create initi script:

sudo nano /etc/init.d/squid

initi content:

######################################################################################################
######################################################################################################
######################################################################################################
# squid4     Startup script for the SQUID HTTP proxy-cache.
#
# Version:   @(#)squid4 init script  1.0  20-Feb-2019 leslie84 at nauta.cu
########################################################################

### BEGIN INIT INFO
# Provides:          squid
# Required-Start:    $network $remote_fs $syslog
# Required-Stop:     $network $remote_fs $syslog
# Should-Start:      $named
# Should-Stop:       $named
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Squid HTTP Proxy version 4.x
### END INIT INFO

NAME=squid
DESC="Squid HTTP Proxy 4.x"
DAEMON=/usr/sbin/squid
PIDFILE=/var/run/$NAME.pid
CONFIG=/etc/squid/squid.conf
SQUID_ARGS="-YC -f $CONFIG"

[ ! -f /etc/default/squid ] || . /etc/default/squid

. /lib/lsb/init-functions

PATH=/bin:/usr/bin:/sbin:/usr/sbin

[ -x $DAEMON ] || exit 0

ulimit -n 65535

find_cache_dir () {
         w="     " # space tab
         res=`sed -ne '
s/^'$1'['"$w"']\+[^'"$w"']\+['"$w"']\+\([^'"$w"']\+\).*$/\1/p;
                 t end;
                 d;
                 :end q' < $CONFIG`
         [ -n "$res" ] || res=$2
         echo "$res"
}

find_cache_type () {
         w="     " # space tab
         res=`sed -ne '
                 s/^'$1'['"$w"']\+\([^'"$w"']\+\).*$/\1/p;
                 t end;
                 d;
                 :end q' < $CONFIG`
         [ -n "$res" ] || res=$2
         echo "$res"
}

start () {
         cache_dir=`find_cache_dir cache_dir`
         cache_type=`find_cache_type cache_dir`

         #
         # Create spool dirs if they don't exist.
         #
         if [ "$cache_type" = "coss" -a -d "$cache_dir" -a ! -f 
"$cache_dir/stripe" ] || [ "$cache_type" != "coss" -a -d "$cache_dir" -a 
! -d "$cache_dir/00" ]
         then
                 log_warning_msg "Creating $DESC cache structure"
                 $DAEMON -z -f $CONFIG
         fi

         umask 027
         ulimit -n 65535
         cd $cache_dir
         start-stop-daemon --quiet --start \
                 --pidfile $PIDFILE \
                 --exec $DAEMON -- $SQUID_ARGS < /dev/null
         return $?
}

stop () {
         PID=`cat $PIDFILE 2>/dev/null`
         start-stop-daemon --stop --quiet --pidfile $PIDFILE --exec $DAEMON
         #
         #       Now we have to wait until squid has _really_ stopped.
         #
         sleep 2
         if test -n "$PID" && kill -0 $PID 2>/dev/null
         then
                 log_action_begin_msg " Waiting"
                 cnt=0
                 while kill -0 $PID 2>/dev/null
                 do
                         cnt=`expr $cnt + 1`
                         if [ $cnt -gt 24 ]
                         then
                                 log_action_end_msg 1
                                 return 1
                         fi
                         sleep 5
                         log_action_cont_msg ""
                 done
                 log_action_end_msg 0
                 return 0
         else
                 return 0
         fi
}

case "$1" in
     start)
         log_daemon_msg "Starting $DESC" "$NAME"
         if start ; then
                 log_end_msg $?
         else
                 log_end_msg $?
         fi
         ;;
     stop)
         log_daemon_msg "Stopping $DESC" "$NAME"
         if stop ; then
                 log_end_msg $?
         else
                 log_end_msg $?
         fi
         ;;
     reload|force-reload)
         log_action_msg "Reloading $DESC configuration files"
         start-stop-daemon --stop --signal 1 \
                 --pidfile $PIDFILE --quiet --exec $DAEMON
         log_action_end_msg 0
         ;;
     restart)
         log_daemon_msg "Restarting $DESC" "$NAME"
         stop
         if start ; then
                 log_end_msg $?
         else
                 log_end_msg $?
         fi
         ;;
     status)
         status_of_proc -p $PIDFILE $DAEMON $NAME && exit 0 || exit 3
         ;;
     *)
         echo "Usage: /etc/init.d/$NAME 
{start|stop|reload|force-reload|restart|status}"
         exit 3
         ;;
esac

exit 0
######################################################################################################
######################################################################################################
######################################################################################################

set permissions:

cambiar permisos al archivo
      sudo chmod +x /etc/init.d/squid

activar servicio de squid
      sudo update-rc.d squid defaults



After all this when i start the service this is the response from the system


  systemctl status squid.service
â squid.service
    Loaded: loaded (/etc/init.d/squid; generated)
    Active: failed (Result: exit-code) since Thu 2019-02-28 15:52:15 
CST; 5s ago
      Docs: man:systemd-sysv-generator(8)
   Process: 18732 ExecStart=/etc/init.d/squid start (code=exited, 
status=203/EXEC)

feb 28 15:52:15 sq4 systemd[1]: Starting squid.service...
feb 28 15:52:15 sq4 systemd[18732]: squid.service: Failed to execute 
command: Exec format error
feb 28 15:52:15 sq4 systemd[18732]: squid.service: Failed at step EXEC 
spawning /etc/init.d/squid: Exec format error
feb 28 15:52:15 sq4 systemd[1]: squid.service: Control process exited, 
code=exited status=203
feb 28 15:52:15 sq4 systemd[1]: squid.service: Failed with result 
'exit-code'.
feb 28 15:52:15 sq4 systemd[1]: Failed to start squid.service.


Im using Ubuntu 18.04.2, thanks in advance.


PD: Thanks for your answer  Rafael Akchurin but unforntunately the 
article that you suggest won´t work for me.

-- 
Saludos Cordiales

Lic. Alex Gutiérrez Martínez

Tel. +53 7 2710327





More information about the squid-users mailing list