In this tutorial we will be setting up a LAMP stack , which includes Apache 2.2, MySQL or MariDB , PHP on Fedora 19.
This comprehensive Linux guide expects that you run the following commands as root user but if you decide to run the commands as a different user then ensure that the user has
sudoaccess and that you precede each of the privileged commands with
Install Apache Server
Using yum, we will be installing our Apache web server. Also, by default Fedora 19comes with native Apache 2.4 package.
yum install httpd
Now start the http service and enable it to start at boot .
systemctl start httpd.service systemctl enable httpd.service
Fedora server comes with firewall service for network filtering. If firewall is enabled, then we need to perform the below steps.
firewall-cmd --permanent --zone=public --add-service=http firewall-cmd --reload
Now, open web browser on a remote PC and type in the URL http://<Your server IP>. You should see a page similar to the following.
We have successfully installed our Apache web server. Lets move forward with further installation process.
Install MySQL / MariaDB
Since MariaDB is a MySQL fork of the original MySQL developer Monty Widenius, We will go with MariaDB.
yum install mariadb-server
After installation we need to start and enable the DB services.
systemctl start mariadb.service systemctl enable mariadb.service
Now we need to configure the Database to complete the installation
We will be asked to enter the password for the MySQL root account, since
we haven’t set this yet, so just hit ENTER . Then we will be asked to set that password. we should type Y to set a root password.
To rest of all the questions, the script asks, you should press Y, followed by the ENTER key at each prompt. During this process we will remove anonymous users and the test database, disable remote root logins, and load these new rules MySQL.
NOTE :This is an optional step, since MariaDB is already installed. If you want to go with MySQL instead of MariaDB, then this for you.
We will be installing mysql using yum repository.
yum install mysql mysql-server -y
systemctl start mysqld.service systemctl enable mysqld.service
Further installation is similar to MariaDB..
Now to generate dynamic content, we need to install PHP. We can get a full list of available PHP modules and extensions using the following command.
yum install -y php php-mysql php-common
we need to create a test PHP file in our document root. We will create a codesposts.php file in the document root to test our configuration
<?php phpinfo(); ?>
After pasting the above code to our codesposts.php file, save and close the file.
Restart the httpd service and we can visit this web page in a web browser from the below shown URL.
systemctl restart httpd.service http://<Your_serverIP>/codesposts.php
we should see a web page that has been generated by PHP with information about your server.
phpMyAdmin is a web interface, used to mange our MySQL/MariaDB database.
By default, Fedora 19 does not have these packages as native, so we will enable the EPEL.
wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm rpm -ivh epel-release-latest-7.noarch.rpm yum repolist
To avoid using MySQL command line to manage our database we will install PhpMyAdmin package
yum install phpmyadmin
We need to configure phpMyAdmin to allow connections from remote hosts by editing phpmyadmin.conf file
Comment out the following lines, using “#” and save the file.
# Order Deny,Allow # Deny from all # Allow from 127.0.0.1
We will be using http authentication instead of cookie based authentication. Open
Modify the below line as follows.. and restart the apache service.
[...] $cfg['Servers'][$i]['auth_type'] = 'http'; // Authentication method (config, http or cookie based)? [...]
systemctl restart httpd.service
Now after the configuration, we can check our PHP configuration from the below URL
We will get an output something similar to the above. We have successfully completed the installation process of LAMP stack on Fedora.
Thanks for being with us, hope this help you in gaining knowledge and we are always ready to help you. For furthers queries or suggestions, kindly drop a comment below