How to install PHP based dashboard on CentOS using Xampp and Tomcat

InfoCaptor Dashboard can be installed on any platform.

Let us build a dashboard demo from scratch on CentOS (applicable to all linux flavors Ubuntu, RHEL etc)

We are using Xampp because it comes with Apache, PHP and MySQL. For production setup it is highly recommended to create a hardened/secure stack by individually configuring Apache, PHP and MySQL.

1. Download Xampp for Linux

xampp-linux-x64-7.3.2-2-installer.run (This is the latest file from xampp website)

2. FTP the run file to the home directory or where you have access to

3. SSH to the server and navigate to the home directory

[root@infocaptor ~]# cd /home
 [root@infocaptor home]# ls
 xampp-linux-x64-7.3.2-2-installer.run
Next, make it executable

 [root@infocaptor home]# chmod +x *.run

Run the Installer
 [root@infocaptor home]# ./xampp-linux-x64-7.3.2-2-installer.run
 ----------------------------------------------------------------------------
 Welcome to the XAMPP Setup Wizard.

----------------------------------------------------------------------------
 Select the components you want to install; clear the components you do not want
 to install. Click Next when you are ready to continue.

XAMPP Core Files : Y (Cannot be edited)

XAMPP Developer Files [Y/n] :Y

Is the selection above correct? [Y/n]: Y

----------------------------------------------------------------------------
 Installation Directory

XAMPP will be installed to /opt/lampp
 Press [Enter] to continue:

----------------------------------------------------------------------------
 Setup is now ready to begin installing XAMPP on your computer.

Do you want to continue? [Y/n]: Y

----------------------------------------------------------------------------
 Please wait while Setup installs XAMPP on your computer.

Installing
 0% ______________ 50% ______________ 100%
 #########################################

----------------------------------------------------------------------------
 Setup has finished installing XAMPP on your computer.

Navigate to Xampp install and start the services

cd /opt/lampp

[root@infocaptor lampp]# ./xampp start
 Starting XAMPP for Linux 7.3.2-2...
 XAMPP: Starting Apache...already running.
 XAMPP: Starting MySQL.../opt/lampp/share/xampp/xampplib: line 22: netstat: command not found
 ok.
 XAMPP: Starting ProFTPD.../opt/lampp/share/xampp/xampplib: line 22: netstat: command not found
 ok.

Next FTP the infocaptor_server.zip file to the home directory

FTP infocaptor_server.zip file

cd /home

and extract the contents of the infocaptor_server.zip directory.

Unzip infocaptor_server.zip file

It creates the "dash" directory. This contains the infocaptor server files

Copy the dash directory to the /opt/lampp/htdocs directory

Change ownership to daemon (this is the Apache user)

chown -R daemon:daemon dash

Create infocaptor database

Navigate to your browser and type in the IP address of your server

You should see the Apache web page

Click on "PHPMyAdmin" link at the top right

Click on "New" to create new database

Give a name to the database and select "utf8_general_ci"

Click on "Create" to have the database created.

Launch the InfoCaptor install URL

Go to your browser again and type in

http://<your ip address>/dash/mt_install.php

Note: dash is the directory where infocaptor files reside and you moved this directory to the lampp/htdocs directory

Provide the mysql database you created in the previous steps.

Leave the password field blank if you did not set it up (The default password for root with Xampp mysql is blank)

Click on "Install" and follow through all the steps

Login into InfoCaptor

The default password for admin is admin123

Change the password after logging in the first time

 

Confirmation that InfoCaptor is installed correctly

This completes the basic setup.

To proceed with database connections we need to perform following steps

Tomcat install needed for JDBC setup

Tomcat 9 requires Java SE 8 or later. In this tutorial we will install OpenJDK, the open source implementation of the Java Platform which is the default Java development and runtime in CentOS 7.

Create Tomcat system user

Running Tomcat as the root user is a security risk and not considered best practice.

sudo useradd -m -U -d /opt/tomcat -s /bin/false tomcat

Download Tomcat
We will download the latest version of Tomcat 9.0.x from the Tomcat downloads page.

At the time of writing, the latest Tomcat version is 9.0.16. Before continuing with the next step you should check the Tomcat 9 download page to see if a newer version is available.

Navigate to the /tmp directory and download the Tomcat zip file using the following wget command:

We’ll create a new system user and group with home directory /opt/tomcat that will run the Tomcat service:

yum install wget
wget http://mirrors.gigenet.com/apache/tomcat/tomcat-9/v9.0.16/bin/apache-tomcat-9.0.16.tar.gz

Install java

sudo yum install java-1.8.0-openjdk-devel

install tomcat

When the download is complete, extract the tar file:

tar -xf apache-tomcat-9.0.16.tar.gz

Move the Tomcat source files to it to the /opt/tomcat directory:

sudo mv apache-tomcat-9.0.16 /opt/tomcat/

The tomcat user that we previously set up needs to have access to the tomcat installation directory.

Run the following command to change the directory ownership to user and group tomcat:

sudo chown -R tomcat: /opt/tomcat

Tomcat is updated frequently. To have more control over versions and updates, we will create a symbolic link latest which will point to the Tomcat installation directory

sudo ln -s /opt/tomcat/apache-tomcat-9.0.16 /opt/tomcat/latest

The tomcat user that we previously set up needs to have access to the tomcat installation directory.

Run the following command to change the directory ownership to user and group tomcat:

sudo chown -R tomcat: /opt/tomcat

Make the scripts inside the bin directory executable:

sudo sh -c 'chmod +x /opt/tomcat/latest/bin/*.sh'

To make Tomcat run as a service open your text editor and create a tomcat.service unit file in the /etc/systemd/system/ directory:

sudo vi /etc/systemd/system/tomcat.service
[Unit]
 Description=Tomcat 9 servlet container
 After=network.target

[Service]
 Type=forking

User=tomcat
 Group=tomcat

Environment="JAVA_HOME=/usr/lib/jvm/jre"
 Environment="JAVA_OPTS=-Djava.security.egd=file:///dev/urandom"

Environment="CATALINA_BASE=/opt/tomcat/latest"
 Environment="CATALINA_HOME=/opt/tomcat/latest"
 Environment="CATALINA_PID=/opt/tomcat/latest/temp/tomcat.pid"
 Environment="CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC"

ExecStart=/opt/tomcat/latest/bin/startup.sh
 ExecStop=/opt/tomcat/latest/bin/shutdown.sh

[Install]
 WantedBy=multi-user.target

Notify systemd that we created a new unit file by typing:

sudo systemctl daemon-reload

Enable and start the Tomcat service:

sudo systemctl enable tomcat
sudo systemctl start tomcat

Check the service status with the following

sudo systemctl status tomcat

Go to the browser and

Open your browser and type: http://<your_domain_or_IP_address>:8080

e.g http://127.0.0.1:8080

Copy InfoCaptor JSP files to Tomcat directory

Navigate to /opt/lampp/htdocs/dash/system/tomcat_files/jsp directory

 cp *.jsp /opt/tomcat/latest/webapps/examples/

Next, copy the all the drivers in the tomcat_files/lib directory to your webserver's tomcat/lib directory

Navigate to the /opt/lampp/htdocs/dash/system/tomcat_files/lib directory

cp *.jar /opt/tomcat/latest/lib/

Restart Tomcat since we have new jar files added

sudo systemctl start tomcat

Go back to InfoCaptor and create a test JDBC connection to MySQL

1. Click on MySQL under the JDBC connections on the left side panel

2. Enter a name in the connection handle

3. Enter localhost since mysql and infocaptor are on the same server, Enter 3306 for port and enter "infocaptor" as the database name or whatever you named it when you first created in previous step

4. Enter root as the mysql password for Xampp Mysql

5. The default root password for xampp mysql is blank. So leave it blank if you did not set it up.

6. Click on "Test Connection"

7. A successful list of tables indicates that everything was setup correctly.

This completes the full setup of InfoCaptor Dashboard on CentOS using Xampp for Linux (Infocaptor server, php, apache,mysql , tomcat)

Posted in analytics, business intelligence, How-to, MySQL | Tagged , , , ,


Would you like to build your dashboard now?

If so, click to buy now, including 60 minutes of dashboard development for free!