The LAMP stack (Linux, Apache, MySQL, PHP) is a group of open source software that is typically installed together to enable a server to host dynamic PHP websites and web apps.
There is a new player on the table, LAMP which originally stood for Linux, Apache, MySQL and PHP, has now been going through some change, that being the new player Maria DB, a replacement for original MySQL.
MariaDB has almost all the features of MySQL and features library binary equivalency and exact matching with MySQL APIs and commands. It means if an app is able to run with MySQL and it also is able to on MariaDB without any glitch. I will not explain what is Apache and PHP as I’ve explained before and I believe you already knew what it is.
If you want more info on the similarities and differences on MariaDB and MySQL, here is the article:
Let’s start with the step by step tutorial:
INSTALL APACHE WEB SERVER
Step 1 – Login to your server via Terminal.
Step 2 – Now issue command below to install Apache 2.4 on your CentOS 7 server:
|1||yum install httpd -y|
As you can see the command is still the same.
And when the process finished, you’ll see something like this:
Step 3 – Now you have Apache 2.4 installed which you can then start the service by typing command below:
|1||systemctl start httpd.service|
Step 4 – You can verify that Apache is really running by opening your favorite web browser and access your vps via its IP address:
and you’ll see default Apache welcome page.
In current example I’ve installed Apache v2.4.6.
or, you can directly issue this command:
systemctl status httpd.service
you’ll see something like this:
Enable Apache to automatically run every time your server reboot:
|1||systemctl enable httpd.service|
Step 5 – Now, it is time to install PHP5. Default command is:
|1||yum install php -y|
That’ really is a simple command but since we will install MySQL then we’ll need PHP MySQL modules plus any other PHP5 modules you website / app may need it. You can view all available modules using this command:
You can simply use command below that includes common PHP5 modules most websites can run with it.
yum install php php-common php-cli php-devel php-gd php-imap php-intl php-mysql php-process php-xml php-xmlrpc php-zts -y
And once done, you’ll see something like this:
INSTALL MARIADB MYSQL SERVER
Step 6 – Once again we’ll make us of yum package manager:
|1||yum install mariadb-server mariadb -y|
and once done you’ll see something like this:
Step 7 – Now you can start MariaDB server for the very first time using this simple systemctl command :
|1||systemctl start mariadb.service|
MARIADB INITIAL CONFIGURATION
Step 8 – So its service is now running but there is one thing you should do immediately: configuring MariaDB setup for the very first time like setting up your mysql root password. Issue this command:
Then you’ll see a series of question, just answer it accordingly. The main important part is to define your root password while everything else is just up to you or you can simply hit the “ENTER” key through each prompt to accept the default values.
You, my friend, are done!, Congrats!