2. Configure and Optimize

Squid Proxy Server can't run as super-user root, and for this reason we must create a special user with no shell for running Squid Proxy Server.

                 [root@deep] /# useradd -d /cache/ -r -s /dev/null squid >/dev/null 2>&1
                 [root@deep] /# mkdir /cache/
                 [root@deep] /# chown -R squid.squid /cache/
               

First of all, we add the user squid to the /etc/passwd file. Then, we create the /cache directory if this directory doesn't exist, we repeat only if it doesn't exist. Finally, we change the owner of the directory cache to be the user squid.

Tip

Usually we don't need to perform the command, mkdir /cache/, because we have already created this directory when we partitioned our hard drive during the installation of Linux. If this partition doesn't exist, you must execute this command to create the directory.

  1. Move into the new Squid directory and type the following commands on your terminal: Edit the Makefile.in file, vi +18 icons/Makefile.in and change the line:

                       DEFAULT_ICON_DIR  =  $(sysconfdir)/icons
                     

    To read:

                       DEFAULT_ICON_DIR  =  $(libexecdir)/icons
                     

  2. We change the variable, sysconfdir to be libexecdir. With this modification, the icons directory of Squid will be located under the /usr/lib/squid directory.

    1. Edit the Makefile.in file, vi +34 src/Makefile.in and change the lines:

                             DEFAULT_CACHE_LOG  =  $(localstatedir)/logs/cache.log
                           

      To read:

                             DEFAULT_CACHE_LOG  =  $(localstatedir)/log/squid/cache.log
                           

    2.                      DEFAULT_ACCESS_LOG  =  $(localstatedir)/logs/access.log
                         

      To read:

                           DEFAULT_ACCESS_LOG  =  $(localstatedir)/log/squid/access.log
                         

    3.                      DEFAULT_STORE_LOG  =  $(localstatedir)/logs/store.log
                         

      To read:

                           DEFAULT_STORE_LOG  =  $(localstatedir)/log/squid/store.log
                         

    4.                      DEFAULT_PID_FILE  =  $(localstatedir)/logs/squid.pid
                         

      To read:

                           DEFAULT_PID_FILE  =  $(localstatedir)/run/squid.pid
                         

    5.                      DEFAULT_SWAP_DIR  =  $(localstatedir)/cache
                         

      To read:

                           DEFAULT_SWAP_DIR  =  /cache
                         

    6.                      DEFAULT_ICON_DIR  =  $(sysconfdir)/icons
                         

      To read:

                           DEFAULT_ICON_DIR  =  $(libexecdir)/icons
                         

      We change the default location of cache.log, access.log, and store.log files to be located under /var/log/squid directory. Then, we put the pid file of Squid under /var/run directory, and finally, locate the icons directory of Squid under /usr/lib/squid/icons with the variable libexecdir above.