[squid-users] compiling squid 4
L.P.H. van Belle
belle at bazuin.nl
Fri Mar 1 14:36:08 UTC 2019
Its pretty simple..
Enable the debian sid source in your ubuntu 18
apt install -y software-properties-common debian-archive-keyring dirmngr
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 8B48AD6246925553
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 7638D0442B90D010
add-apt-repository "deb-src http://ftp.nl.debian.org/debian sid main contrib non-free"
apt-get update
I dont enable the deb line from sid because that prevents possible unwanted upgrades/replacements of files.
# get build-depends
apt-get build-dep squid3
# get source and build squid
apt-get source squid3 -B
And wait.
Thats what im doing now ;-) .. 15 min later done.
dpkg-genbuildinfo --build=binary
dpkg-genchanges --build=binary >../squid_4.6-1_amd64.changes
dpkg-genchanges: info: binary-only upload (no source code included)
dpkg-source --after-build squid-4.6
dpkg-buildpackage: info: binary-only upload (no source included)
This results in a some debs, setup a file/web repo to use them so you can apt-get install them.
Move all .deb files in a folder
mkdir amd64
mv *.deb amd64/
apt-ftparchive packages amd64/ > amd64/Packages
And add a line like this in your /etc/apt/sources.list.d/squid-local.list
echo "deb [trusted=yes] file:/home/build/squid/ amd64/" > /etc/apt/sources.list.d/squid-local.list
# NOTE , dont forget to change the path here^^
You can move this to any place as long amd64/ exitst.
You can change this to a webserver, then it looks like : #deb [trusted=yes] http://localhost/ amd64/"
And document root and webserver setup, if you move amd64 to /var/www/html/
Then it should work directly after you install a webserver.
Results.
apt-get update
apt-cache policy squid
squid:
Installed: (none)
Candidate: 4.6-1
Version table:
4.6-1 500
500 file:/root amd64/ Packages
3.5.27-1ubuntu1.1 500
500 http://nl.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
3.5.27-1ubuntu1 500
500 http://nl.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
apt-get install squid
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libdbi-perl squid-common squid-langpack
Suggested packages:
libmldbm-perl libnet-daemon-perl libsql-statement-perl squidclient squid-cgi squid-purge resolvconf smbclient ufw
The following NEW packages will be installed:
libdbi-perl squid squid-common squid-langpack
0 upgraded, 4 newly installed, 0 to remove and 35 not upgraded.
Need to get 861 kB/3,752 kB of archives.
After this operation, 13.4 MB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 file:/root amd64/ squid-common 4.6-1 [309 kB]
Get:2 file:/root amd64/ squid 4.6-1 [2,582 kB]
Get:3 http://nl.archive.ubuntu.com/ubuntu bionic/main amd64 squid-langpack all 20170901-1 [137 kB]
Get:4 http://nl.archive.ubuntu.com/ubuntu bionic/main amd64 libdbi-perl amd64 1.640-1 [724 kB]
Now you ;-)
And why above works...
Because of the fantastic work of the squid devs!
Greetz,
Louis
> -----Oorspronkelijk bericht-----
> Van: squid-users
> [mailto:squid-users-bounces at lists.squid-cache.org] Namens
> Alex Gutiérrez Martínez
> Verzonden: donderdag 28 februari 2019 22:03
> Aan: squid-users at lists.squid-cache.org
> Onderwerp: [squid-users] compiling squid 4
>
> 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,RA
DIUS,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
>
>
>
> _______________________________________________
> squid-users mailing list
> squid-users at lists.squid-cache.org
> http://lists.squid-cache.org/listinfo/squid-users
>
More information about the squid-users
mailing list