If you’re setting up your own VPS or dedicated host, or just trying to setup a web server on a linux host, this post might come to some use to you. Today, we shall see how we can install a LAMP (Linux Apache MySQL and PHP) server easily on a Fedora machine (or host).
First, you need to login to the server as root. You can use Terminal (on Unix, Mac or Linux) or Putty on Windows. Now, first upgrade the system.
The command shall make sure you have all the latest package on the server. Now we can start installing the web server. Type this command and press enter:
yum install httpd mysql mysql-server php php-mysql
You can also use Yum’s group install feature to install all the packages once. In that case the command shall be:
yum groupinstall "Web Server"
But I recommend the first method. It installs only the packages required for the web server. The second one installs the total package sometimes causing installation of unnecessary packages.
After installation, you can change the owner of /var/www (comes to good use on a desktop machine) by issuing this command:
chown -hR masnun /var/www
Here, “masnun” was my username. Please change that accordingly.
Now, let’s start the apache web server by issuing the following command:
/sbin/service httpd restart
If you get any error messages, you can use this command to validate the apache configuration file and get any error messages:
Now we’re all done!
In the upcoming posts, we shall see how to install other required functionality on a linux host.