How to install Screen Squid

    Where to deploy Screen Squid?

    There are no restrictions on the operating system used.

    Required Set (Basic)

    1. Perl (work with log files).
    2. MySQL database, MariaDB, PostgreSQL (data storage)
    3. PHP (web interface)
    4. Apache or Nginx Web Server

    5. Most likely will work on any web server.

    Screen Squid consists of two parts:
    1. First, reads the log file, parses it and loads the processed information into the database.
    This part is represented by the fetch.pl script. It is desirable to place it as close as possible to the log files. It is ideologically separated from the second part. Usually this script is placed on the server where Squid is deployed.
    2. Second, actually the web interface itself. It serves to display information from the database in the form of different reports.
    This part is represented by a set of PHP scripts. Simply put, this is the entire directory that you get after unzipping the archive of the Screen Squid version. It can be placed anywhere. All you need is a database connection and a server connection with Squid (for online reporting, reading Squid status).

    Installation Instructions

    Download the latest stable version from https://sourceforge.net/projects/screen-squid/files/stable/.

    1. Unzip the archive into the directory that the web server is working with.
      $ sudo tar xzf screensquid_vx_xx.tar.gz -C /var/www/

    2. Create the "screensquid" directory. The name can be anything. And move the contents obtained in step 1 to it.
      $ sudo mv /var/www/html /var/www/html/screensquid/

    This step completes the installation. In the future, unless otherwise stated, to update the version, it is enough to download a new archive and move it to the directory with Screen Squid. Simultaneous operation of several Screen Squid web interfaces is possible. But they will need to be located in different directories. For example screensquid, screensquid1, squidreport and so on. This can be useful when necessary for each base, its own web interface.
    .
    3. Log in to mysql, in any convenient way. A terminal is sufficient for installation, however, you can use phpMyAdmin for example.
    $ mysql -u [user_name] -p [password]

    1. Create a database. The database name can be anything. For example, the name "squidreport" is used. It makes sense to change the name if you have data for different proxies on the same database server. For example, squid_rogaikopita, squid_donjuan. When migrating databases, it will be easier to distinguish them from each other.
      mysql> CREATE DATABASE squidreport DEFAULT CHARACTER SET = utf8;

    2. Connect to the created database.
      mysql> USE squidreport;

    3. Run the script to create the tables in the database. The script for creating tables always comes with the Screen Squid distribution.
      mysql> SOURCE /var/www/html/screensquid/createdb/createdb.sql;

    4. Create a user on behalf of whom the database will be accessed. Access refers to loading data into the database with the fetch.pl script and reading data from the database through the web interface.
      mysql> CREATE USER 'user_name' @ 'localhost' IDENTIFIED BY 'password';
      mysql> GRANT ALL PRIVILEGES ON squidreport. * TO 'user_name' @ 'localhost';

    5. In order to protect against overwriting config.php when copying a new version over the old version, the configuration file in the distribution is named config.php.default.

    6. Open http://your_host/screensquid . Then you will see installation wizard. Go through all steps ang you will get initial config.

    7. Open fetch.pl with any convenient editor. And make similar parameters.
      $ sudo nano /var/www/html/screensquid/fetch.pl

    $ db = "test";
    $ user = "mysql-user";
    $ pass = "pass";
    $ host = "localhost";

    And in addition, we indicate the full path to the squid log file.
    my $ filetoparse = "/var/log/squid/access.log";

    1. Save the file. Make the script file executable.
      $ sudo chmod u + x /var/www/html/screensquid/fetch.pl

    This completes the installation. However, to automate the launch of a script to load data from access.log, you must create a shell script.

    $ sudo touch /var/www/html/screensquid/fetch.sh
    $ sudo nano /var/www/html/screensquid/fetch.sh

    1. Fill the script with the following contents:
      #! /bin/bash
      cd /var/www/html/screensquid /
      perl /var/www/html/screensquid/fetch.pl

    2. Make the resulting script executable.
      $ sudo chmod u + x /var/www/html/screensquid/fetch.sh

    3. Open cron.
      $ sudo crontab -e

    4. Create a task when the script will process the log file. Examples:
      Startup option at 23:00 every day:
      00 23 * * * /var/www/html/screensquid/fetch.sh

    Startup option every five minutes:
    */5 * * * * /var/www/html/screensquid/fetch.sh

    Ideas, bugs, questions?

    Feel free to contact us http://t.me/screensquid