XAMPP is short for cross-platform(X), Apache(A) server, MariaDB(M), PHP(P) and Perl(P). It enables a user to turn his system into a fully-featured web server.
XAMPP is available for the major OS including Linux, Windows, and MacOS.
It allows building a website offline to test it on the local machine before uploading it to a remote server.
In this context, we shall look into how to install XAMPP on CentOS.
Previously, we have dealt with the installation of XAMPP on Linux Mint .
How to install XAMPP on CentOS ?
To install any program on a Linux system, you must be a root user or have sudo privileges.
For the installation on XAMPP, follow the steps given below.
1. Install Net-tools
XAMPP server requires netstat to be installed on your system. Netstat is a part of the net-tools package. Therefore, you will have to install the net-tools package on your CentOS system.
Execute this command in Terminal to do so:
$ sudo yum install net-tools
Enter the password for sudo, after which the net-tools will be installed on your system.
2. Download the Installer Package
Now you will have to download the XAMPP installer package for Linux OS. Visit the following website and download the latest version of XAMPP for Linux:
Alternatively, you can use execute the below command in Terminal to download XAMPP for Linux:
$ wget https://www.apachefriends.org/xampp-files/8.0.0/xampp-linux-x64-8.0.0-2-installer.run
Once the XAMPP installer is downloaded, move on to the next step.
3. Make the Installer Package Executable
Now using the cd command, move inside the directory which contains the XAMPP installer file you have downloaded in the previous step.
Then execute the below command to make the installer file executable:
$ sudo chmod 755 xampp-linux-x64-8.0.0-2-installer.run
4. Run the Installer
i. Then in order to install XAMPP, run the installer as follows:
$ sudo ./xampp-linux-x64-8.0.0-2-installer.run
ii. After running the above command, the following setup wizard will launch.
iii. Click Next to continue.
iv. Next in the following screen, you will be asked to select the components to install.
v. Leave the default selection as it is and hit Next.
vi. Now for the subsequent windows, keep on clicking Next until you see "Welcome to XAMPP" window.
Wait until the installation of selected components is done.
vii. Then hit Next.
Now a window will inform you about the completion of the XAMPP installation on your system.
viii. Click Finish to close the wizard.
If you do not want to start XAMPP now, you can also uncheck the Launch XAMPP checkbox.
5. Start and Verify XAMPP Installation
To start XAMPP from the Terminal, execute the below command:
$ sudo /opt/lampp/lampp start
You will see an output which indicates that XAMPP is started and already running.
Note that each time you restart your machine; you will need to manually start XAMPP.
After running the above command, you may receive the following error like I had:
httpd: Syntax error on line 522 of /opt/lampp/etc/httpd.conf: Syntax error on line 10 of /opt/lampp/etc/extra/httpd-xampp.conf: Cannot load modules/libphp7.so into server: libnsl.so.1: cannot open shared object file: No such file or directory
To resolve this error, install libnsl library using the below command in Terminal:
$ sudo dnf install libnsl
Now again start XAMPP as described above.
To verify the installation of XAMPP, access the following address in your web browser:
Now, you will see that XAMPP has been successfully installed and running on your system.
Then access the following address to verify if phpmyadmin has been installed:
You will see the phpmyadmin page on your browser which indicates the phpmyadmin has also been successfully installed and running on the system.
If you need to stop XAMPP, execute the below command in Terminal:
$ sudo /opt/lampp/lampp stop
How to Uninstall XAMPP from CentOS system ?
In case you no longer need XAMPP, you can easily remove it from your system.
i. First, move inside the /opt/lampp directory where the XAMPP is installed:
$ cd /opt/lampp
ii. Then run the uninstaller file as follows:
$ sudo ./uninstall
iii. Then you will be asked if you want to uninstall XAMPP and its modules.
Click Yes, after which it will start uninstalling XAMPP from the system.
iv. Once it is uninstalled, you will see a dialog notifying you with the uninstallation completed message. Click OK to close the dialog.
v. If you also want to remove the XAMPP directory along with its files, execute the below command in Terminal:
$ sudo rm -r /opt/lamp