
LAMP is a combination of operating system and open-source software stack. The acronym LAMP comes from the first letters of Linux, Apache HTTP Server, MySQL/MariaDB database, and PHP, Perl or Python (and sometimes PhpMyAdmin too.)
Installing Apache
Change to root (if not root already) user using the following command:
1 |
su - |
and install apache using yum:
1 |
yum install httpd -y |
Enable the httpd service to start automatically
1 |
systemctl enable httpd |
Then start httpd service
1 |
systemctl start httpd |
Adjust firewall to allow the httpd service to connect with remote clients.
1 2 |
firewall-cmd --permanent --add-service=http firewall-cmd --permanent --add-service=https |
Restart firewalld service:
1 |
firewall-cmd --reload |
Testing Apache:
Open up your browser and enter http://your-ip-address/ in the address bar. You will see the Apache default page.
Installing MariaDB
MariaDB is a drop in replacement for MySQL. It is a robust, scalable and reliable SQL server that comes rich set of enhancements. The default database in Fedora 19 is MariaDB.
Install it using the following command:
1 |
yum install mariadb mariadb-server -y |
Enable mysqld service at boot time with following command:
1 |
systemctl enable mysqld |
And start mysqld service using command:
1 |
systemctl start mysqld |
Set MariaDB root password:
By default mysql root user password is empty. So, to prevent unauthorized access to mysql databases, let us set a root user password:
1 |
mysql_secure_installation |
Installing PHP
PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely used open-source general purpose scripting language that is especially suited for web development and can be embedded into HTML.
Install PHP with following command:
1 |
yum install php -y |
Test PHP:
Create a sample “testphp.php” file in Apache document root folder and append the lines as shown below:
1 |
vi /var/www/html/testphp.php |
Add the following lines:
1 2 3 |
<?php phpinfo(); ?> |
Restart httpd service:
1 |
systemctl restart httpd |
Now, navigate to http://server-ip-address/testphp.php. It will display all the details about PHP such as version, build date and commands etc.
Install PHP Modules:
Search for the available PHP modules using the following command:
1 |
yum search php |
Now install the required module of your choice, for example php-mysql, using the following command:
1 |
yum install php-mysql -y |
Restart the httpd service.
1 |
systemctl restart httpd |
To verify the modules, open your web browser and navigate to http://server-ip-address/testphp.php. You will able to see the installed PHP modules.
Thanks a lot. I was looking for a guide. This helped me a lot.
hiiiii