Install XAMPP stack on Ubuntu 16.04 using terminal

Apache is the widely used web server, and PHP is a dominant technology when it comes to CMS frameworks i.e. WordPress, Drupal, etc. For this reason the deployment of the stack has been made effortless with XAMPP PHP development environment. XAMPP is an acronym, where X stands for any operating system (WAMP for Windows, LAMP for Linux), A for Apache web server, M for MySQL or MariaDB database engine, and PP stands for PHP and Perl. The post is about setting-up PHP development environment XAMPP on Ubuntu 16.04, suing terminal.

Step 0 – Login and update

First of all login into your Ubuntu machine using SSH – for a regular it’s recommended to add your SSH public key.
ssh <username>@<hostname/IP>

Optional – a recommended step for setup on a fresh machine.

sudo apt-update
sudo apt-upgrade

Step 1 – download XAMPP

Download the XAMPP from the official download page. You can choose from the available versions 7.2.2 is the latest with PHP 7.

For PHP 7

The stack includes – Apache 2.4.29, MariaDB 10.1.30, PHP 7.2.2 + SQLite 2.8.17/3.7.17
wget https://www.apachefriends.org/xampp-files/7.2.2/xampp-linux-x64-7.2.2-0-installer.run

For PHP 5

The stack includes – Apache 2.4.29, MariaDB 10.1.30, PHP 5.6.33 & PEAR + SQLite 2.8.17/3.7.17
wget https://www.apachefriends.org/xampp-files/5.6.33/xampp-linux-x64-5.6.33-0-installer.run

Step 2 – Executeable permission

Do execute the downloaded installer, we need to set executable permissions on it.
chmod +x xampp-linux-x64-5.6.33-0-installer.run

Step 3 – Install XAMPP

For PHP 7

./xampp-linux-x64-7.2.2-0-installer.run

For PHP 5

./xampp-linux-x64-5.6.33-0-installer.run
Xampp install

Step 4 – Start XAMPP

To start all the service (packaged inside XAMPP)

sudo /opt/lampp/xampp start

To stop XAMPP

sudo /opt/lampp/xampp stop

Step 5 – Change service port (optional)

The location of conf can vary – for our case you can find it at /opt/lampp/etc/httpd.conf. Open the file using editor of your choice, find and update the ‘Listen 80’, replace 80 with port of your choice.

Leave a Reply

Your email address will not be published. Required fields are marked *