Tutorial : How to install LookingGlass on your Server

 

LookingGlass in webhosting is to check network speed and allow users to perform network related queries on your server. This is helpful if end user wants to check your sever performance before ordering hosting from you. 9to5host’s looking glass server speeds. LookingGlass is hosted on github repo and maintained by Nick, make sure to check out git hub page to know more about him. In this demo we’re using centOS 7.

[[email protected] ~]# cat /etc/redhat-release 
CentOS Linux release 7.8.2003 (Core)

Skill Level : Moderate

Caution : install this only if you know, what you’re doing. we don’t take any responsibility if it doesn’t work as demonstrated in your case.

Features :

  • Automated install via bash script
  • IPv4 & IPv6 support
  • Live output via long polling
  • Multiple themes
  • Rate limiting of network commands

Commands

  • host
  • mtr
  • mtr6 (IPv6)*
  • ping
  • ping6 (IPv6)*
  • traceroute
  • traceroute6 (IPv6)*

* IPv6 commands will only work if your server has external IPv6 setup (or tunneled)

 

Video Tutorial to install LookingGlass on centOS or RHEL

 

How to install LookingGlass on your Server

prerequisite :

  1. VPS, VDS or Dedicated Server
  2. root access or su/sudo ability
  3. PHP >= 5.3
  4. PHP PDO with SQLite driver (required for rate-limit)

steps :

As I’m demonstrating on a fresh VPS, few steps might be optional for you, install them as required.

step 01 : Install Apache with command

yum install httpd -y

step 02 : Start Apache service with command

systemctl start httpd

step 03 : install php, with command

yum -y install php php-common php-opcache php-mcrypt php-cli php-gd php-curl php-mysqlnd

[[email protected] ~]# yum install php php-common php-opcache php-mcrypt php-cli php-gd php-curl php-mysqlnd
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.supportex.net
* extras: centos.mirror.triple-it.nl
* updates: nl.mirrors.clouvider.net
No package php-opcache available.
No package php-mcrypt available.
Resolving Dependencies
--> Running transaction check
---> Package php.x86_64 0:5.4.16-48.el7 will be installed
---> Package php-cli.x86_64 0:5.4.16-48.el7 will be installed
---> Package php-common.x86_64 0:5.4.16-48.el7 will be installed
--> Processing Dependency: libzip.so.2()(64bit) for package: php-common-5.4.16-48.el7.x86_64
---> Package php-gd.x86_64 0:5.4.16-48.el7 will be installed
--> Processing Dependency: libjpeg.so.62(LIBJPEG_6.2)(64bit) for package: php-gd-5.4.16-48.el7.x86_64
--> Processing Dependency: libt1.so.5()(64bit) for package: php-gd-5.4.16-48.el7.x86_64
--> Processing Dependency: libjpeg.so.62()(64bit) for package: php-gd-5.4.16-48.el7.x86_64
--> Processing Dependency: libXpm.so.4()(64bit) for package: php-gd-5.4.16-48.el7.x86_64
--> Processing Dependency: libX11.so.6()(64bit) for package: php-gd-5.4.16-48.el7.x86_64
---> Package php-mysqlnd.x86_64 0:5.4.16-48.el7 will be installed
--> Processing Dependency: php-pdo(x86-64) = 5.4.16-48.el7 for package: php-mysqlnd-5.4.16-48.el7.x86_64
--> Running transaction check
---> Package libX11.x86_64 0:1.6.7-3.el7_9 will be installed
--> Processing Dependency: libX11-common >= 1.6.7-3.el7_9 for package: libX11-1.6.7-3.el7_9.x86_64
--> Processing Dependency: libxcb.so.1()(64bit) for package: libX11-1.6.7-3.el7_9.x86_64
---> Package libXpm.x86_64 0:3.5.12-1.el7 will be installed
---> Package libjpeg-turbo.x86_64 0:1.2.90-8.el7 will be installed
---> Package libzip.x86_64 0:0.10.1-8.el7 will be installed
---> Package php-pdo.x86_64 0:5.4.16-48.el7 will be installed
---> Package t1lib.x86_64 0:5.1.2-14.el7 will be installed
--> Running transaction check
---> Package libX11-common.noarch 0:1.6.7-3.el7_9 will be installed
---> Package libxcb.x86_64 0:1.13-1.el7 will be installed
--> Processing Dependency: libXau.so.6()(64bit) for package: libxcb-1.13-1.el7.x86_64
--> Running transaction check
---> Package libXau.x86_64 0:1.0.8-2.1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=========================================================================================================================================================================
Package Arch Version Repository Size
=========================================================================================================================================================================
Installing:
php x86_64 5.4.16-48.el7 base 1.4 M
php-cli x86_64 5.4.16-48.el7 base 2.7 M
php-common x86_64 5.4.16-48.el7 base 565 k
php-gd x86_64 5.4.16-48.el7 base 128 k
php-mysqlnd x86_64 5.4.16-48.el7 base 174 k
Installing for dependencies:
libX11 x86_64 1.6.7-3.el7_9 updates 607 k
libX11-common noarch 1.6.7-3.el7_9 updates 164 k
libXau x86_64 1.0.8-2.1.el7 base 29 k
libXpm x86_64 3.5.12-1.el7 base 55 k
libjpeg-turbo x86_64 1.2.90-8.el7 base 135 k
libxcb x86_64 1.13-1.el7 base 214 k
libzip x86_64 0.10.1-8.el7 base 48 k
php-pdo x86_64 5.4.16-48.el7 base 99 k
t1lib x86_64 5.1.2-14.el7 base 166 k

Transaction Summary
=========================================================================================================================================================================
Install 5 Packages (+9 Dependent packages)

Total download size: 6.4 M
Installed size: 22 M
Is this ok [y/d/N]: y
Downloading packages:
(1/14): libX11-common-1.6.7-3.el7_9.noarch.rpm | 164 kB 00:00:00 
(2/14): libX11-1.6.7-3.el7_9.x86_64.rpm | 607 kB 00:00:00 
(3/14): libXpm-3.5.12-1.el7.x86_64.rpm | 55 kB 00:00:00 
(4/14): libXau-1.0.8-2.1.el7.x86_64.rpm | 29 kB 00:00:00 
(5/14): libjpeg-turbo-1.2.90-8.el7.x86_64.rpm | 135 kB 00:00:00 
(6/14): libxcb-1.13-1.el7.x86_64.rpm | 214 kB 00:00:00 
(7/14): libzip-0.10.1-8.el7.x86_64.rpm | 48 kB 00:00:00 
(8/14): php-5.4.16-48.el7.x86_64.rpm | 1.4 MB 00:00:00 
(9/14): php-common-5.4.16-48.el7.x86_64.rpm | 565 kB 00:00:00 
(10/14): php-gd-5.4.16-48.el7.x86_64.rpm | 128 kB 00:00:00 
(11/14): php-cli-5.4.16-48.el7.x86_64.rpm | 2.7 MB 00:00:00 
(12/14): php-pdo-5.4.16-48.el7.x86_64.rpm | 99 kB 00:00:00 
(13/14): php-mysqlnd-5.4.16-48.el7.x86_64.rpm | 174 kB 00:00:00 
(14/14): t1lib-5.1.2-14.el7.x86_64.rpm | 166 kB 00:00:00 
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 20 MB/s | 6.4 MB 00:00:00 
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : libzip-0.10.1-8.el7.x86_64 1/14 
Installing : php-common-5.4.16-48.el7.x86_64 2/14 
Installing : php-cli-5.4.16-48.el7.x86_64 3/14 
Installing : php-pdo-5.4.16-48.el7.x86_64 4/14 
Installing : libX11-common-1.6.7-3.el7_9.noarch 5/14 
Installing : libXau-1.0.8-2.1.el7.x86_64 6/14 
Installing : libxcb-1.13-1.el7.x86_64 7/14 
Installing : libX11-1.6.7-3.el7_9.x86_64 8/14 
Installing : libXpm-3.5.12-1.el7.x86_64 9/14 
Installing : t1lib-5.1.2-14.el7.x86_64 10/14 
Installing : libjpeg-turbo-1.2.90-8.el7.x86_64 11/14 
Installing : php-gd-5.4.16-48.el7.x86_64 12/14 
Installing : php-mysqlnd-5.4.16-48.el7.x86_64 13/14 
Installing : php-5.4.16-48.el7.x86_64 14/14 
Verifying : libXpm-3.5.12-1.el7.x86_64 1/14 
Verifying : libjpeg-turbo-1.2.90-8.el7.x86_64 2/14 
Verifying : php-mysqlnd-5.4.16-48.el7.x86_64 3/14 
Verifying : t1lib-5.1.2-14.el7.x86_64 4/14 
Verifying : libXau-1.0.8-2.1.el7.x86_64 5/14 
Verifying : libX11-common-1.6.7-3.el7_9.noarch 6/14 
Verifying : libX11-1.6.7-3.el7_9.x86_64 7/14 
Verifying : php-cli-5.4.16-48.el7.x86_64 8/14 
Verifying : php-pdo-5.4.16-48.el7.x86_64 9/14 
Verifying : php-gd-5.4.16-48.el7.x86_64 10/14 
Verifying : libzip-0.10.1-8.el7.x86_64 11/14 
Verifying : libxcb-1.13-1.el7.x86_64 12/14 
Verifying : php-common-5.4.16-48.el7.x86_64 13/14 
Verifying : php-5.4.16-48.el7.x86_64 14/14

Installed:
php.x86_64 0:5.4.16-48.el7 php-cli.x86_64 0:5.4.16-48.el7 php-common.x86_64 0:5.4.16-48.el7 php-gd.x86_64 0:5.4.16-48.el7 php-mysqlnd.x86_64 0:5.4.16-48.el7

Dependency Installed:
libX11.x86_64 0:1.6.7-3.el7_9 libX11-common.noarch 0:1.6.7-3.el7_9 libXau.x86_64 0:1.0.8-2.1.el7 libXpm.x86_64 0:3.5.12-1.el7 libjpeg-turbo.x86_64 0:1.2.90-8.el7 
libxcb.x86_64 0:1.13-1.el7 libzip.x86_64 0:0.10.1-8.el7 php-pdo.x86_64 0:5.4.16-48.el7 t1lib.x86_64 0:5.1.2-14.el7

Complete!

step 04 : install MariaDB and secure it, with commands

yum install mariadb-server mariadb -y

step 05 : start MariaDB service
systemctl start mariadb

step 06: Secure MariaDB with command
mysql_secure_installation and follow on screen instructions

 

step 07: Restart httpd service to load new configurations, with command
systemctl restart httpd

step 08: install wget to download LookingGlass from Github, with command
yum -y install wget

[[email protected] ~]# yum -y install wget
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.supportex.net
 * extras: centos.mirror.triple-it.nl
 * updates: nl.mirrors.clouvider.net
Resolving Dependencies
--> Running transaction check
---> Package wget.x86_64 0:1.14-18.el7_6.1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=========================================================================================================================================================================
 Package                              Arch                                   Version                                          Repository                            Size
=========================================================================================================================================================================
Installing:
 wget                                 x86_64                                 1.14-18.el7_6.1                                  base                                 547 k

Transaction Summary
=========================================================================================================================================================================
Install  1 Package

Total download size: 547 k
Installed size: 2.0 M
Downloading packages:
wget-1.14-18.el7_6.1.x86_64.rpm                                                                                                                   | 547 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : wget-1.14-18.el7_6.1.x86_64                                                                                                                           1/1 
  Verifying  : wget-1.14-18.el7_6.1.x86_64                                                                                                                           1/1 

Installed:
  wget.x86_64 0:1.14-18.el7_6.1                                                                                                                                          

Complete!

step 08: IP Address, Optional if you know the ip, mandatory if you use fQDN to ssh
ifconfig | grep inet

step 09: Navigate to server default webpage directory, if you install cPanel its public_html directory
cd /var/www/html

step 10: Download LookingGlass from GitHub
wget https://github.com/telephone/LookingGlass/archive/v1.3.0.tar.gz

[[email protected] html]# wget https://github.com/telephone/LookingGlass/archive/v1.3.0.tar.gz
--2020-12-08 16:38:11--  https://github.com/telephone/LookingGlass/archive/v1.3.0.tar.gz
Resolving github.com (github.com)... 140.82.121.3
Connecting to github.com (github.com)|140.82.121.3|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://codeload.github.com/telephone/LookingGlass/tar.gz/v1.3.0 [following]
--2020-12-08 16:38:11--  https://codeload.github.com/telephone/LookingGlass/tar.gz/v1.3.0
Resolving codeload.github.com (codeload.github.com)... 140.82.121.9
Connecting to codeload.github.com (codeload.github.com)|140.82.121.9|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/x-gzip]
Saving to: ‘v1.3.0.tar.gz’

    [ <=>                                                                                                                            ] 200,067     --.-K/s   in 0.05s   

2020-12-08 16:38:11 (3.74 MB/s) - ‘v1.3.0.tar.gz’ saved [200067]

[[email protected] html]# 

step 11: unrar the downloaded gz file and rename & navigate to directory, with commands
tar -zxvf v1.3.0.tar.gz
mv LookingGlass-1.3.0 speedtest
cd speedtest/LookingGlass/

step 12: run Installer file, and follow on screen info
bash configure.sh

########################################
#
# LookingGlass is a user-friendly script
# to create a functional Looking Glass
# for your network.
#
# Created by Nick Adams (telephone)
# http://iamtelephone.com
#
########################################

Do you wish to install LookingGlass? (y/n): y


Running setup:
Enter your website name (Header/Logo) []: 9to5Host
Enter the public URL to this LG (including http://) []: https://9to5host.com
Enter the servers location []: Amsterdam
Enter the test IPv4 address []: 142.93.133.137
Enter the test IPv6 address (Re-enter everytime this script is run) []: 2001:xxxx:xxxx:xxxx::xxxx:xxx
Enter the size of test files in MB (Example: 25MB 50MB 100MB) []: 10MB 20MB 50MB 100MB 1GB
Do you wish to enable rate limiting of network commands? (y/n): y
Enter the # of commands allowed per hour (per IP) []: 5

Removing old test files:

Creating new test files:
Creating 10MB test file
Creating 20MB test file
Creating 50MB test file
Creating 100MB test file
Creating 1GB test file

Would you like to choose a different theme? (y/n): n

Creating Config.php...

Creating SQLite database...
Enter the username of your webserver (E.g. www-data): root
Enter the user group of your webserver (E.g. www-data): root
Fixing MTR permissions...

Installation is complete

[[email protected] LookingGlass]# 


Congratulations, you have successfully installed Looking Glass on your server.

Lets verify via UI, navigate to /ip or domain-name/speedtest/ following index page loads for you to perform speed checks & pings

 

 

Leave a comment