Setting up a LAMP Stack in Fedora 14 :
· Sunday, August 21, 2011
· M.Baran Mahamood
LAMP Stack :
1. Linux
2. Apache
3. MySql
4. PHP
In this post let us see how to setup a LAMP Stack. LAMP is an acronym for a solution stack of free, open source software, originally coined from the first letters of Linux (operating system), Apache HTTP Server, MySQL (database software) and Perl/PHP/Python, principal components to build a viable general purpose web server.
Setting up this LAMP stack is essential for you to design websites and test it in your local computer.
1. Installing MySQL 5
To install MySQL type the following command in the Terminal:
Setting up this LAMP stack is essential for you to design websites and test it in your local computer.
1. Installing MySQL 5
To install MySQL type the following command in the Terminal:
yum install mysql mysql-server
In order to make MySQL start automatically whenever the system boots, type
chkconfig --levels 235 mysqld on
To Start the MySQL server
/etc/init.d/mysqld start
To set a password for the user root (otherwise anybody can access your MySQL database!) Run
mysqladmin -u root password yourrootsqlpassword
To reset password for MySQL enter,
mysql_secure_installation
The intial password for 'root' is nothing.. So just press enter..It will prompt if you want to change it. Then press 'Y', current password "blank(press enter)" and enter the new password what you want..
2. Installing Apache 2
Apache2 is available as a Fedora package, therefore we can install it like this
To install Apache 2 enter the following command
yum install httpd
Now configure your system to start Apache at boot time...
chkconfig --levels 235 httpd on
To start Apache
/etc/init.d/httpd start
To check if it has been installed,
Go to the browser and enter http://localhost
Now direct your browser to http://localhost, and you should see the Apache2 placeholder page Apache's default document root is /var/www/html on Fedora, and the configuration file is /etc/httpd/conf/httpd.conf. Additional configurations are stored in the /etc/httpd/conf.d/ directory.
You must see a Fedora Test Page.
3. Installing PHP 5
Introduction:
PHP is a general-purpose scripting language originally designed for web development to produce dynamic web pages. For this purpose, PHP code is embedded into the HTML source document and interpreted by a web server with a PHP processor module, which generates the web page document. It also has evolved to include a command-line interface capability and can be used in standalone graphical applications.
PHP can be deployed on most web servers and as a standalone interpreter, on almost every operating system and platform free of charge. A competitor to Microsoft's Active Server Pages(ASP) server-side script engine and similar languages, PHP is installed on more than 20 million websites and 1 million web servers.
` PHP was originally created by Rasmus Lerdorfin 1995. The main implementation of PHP is now produced by The PHP Group and serves as the de facto standard for PHP as there is no formal specification. PHP is free software released under the PHP License which is incompatible with the GNU General Public License (GPL) due to restrictions on the usage of the term PHP.
PHP does not come with the basic installation of Fedora so it requires a web server, php and mysql to be installed on the machine.
Enter the following command
yum install php
Then restart apache,
/etc/init.d/httpd restart
The default directory for all PHP files is /var/www/html.
So place any .php file there and then test it as http://localhost/YourFileName.php.
4. Installing MySQL (to be used with PHP)
Enter the following command
4. Installing MySQL (to be used with PHP)
Enter the following command
yum install php-mysql
Restart the apache as mentioned in the previous step.
5. Installing PhpMyAdmin
phpMyAdmin is a free software tool written in PHP intended to handle the administration of MySQL over the World Wide Web. phpMyAdmin supports a wide range of operations with MySQL. The most frequently used operations are supported by the user interface (managing databases, tables, fields, relations, indexes, users, permissions, etc), while you still have the ability to directly execute any SQL statement.
To install PhpMyAdmin enter the following:
yum install phpmyadmin
Restart Apache.
Thats it!!! Its done. Now you are ready to use LAMP... :)
Create all your programs in /var/www/html/ and the output can be viewed in a web browser by giving the url as http://localhost/yourfilename.php
Note: if you couldnot create a file at /var/www/html then login as root user by issuing a command su
Hope this will be helpful for you!!!
Stay tuned for updates. If you find any problem or have any suggestions for improvements, you can always mail me.
By M.Baran Mahamood
No comments:
Post a Comment