Pages

Jun 11, 2011

How to setup a web server on Fedora 15 with Apache+MySQL+PHP (LAMP)

It had been three years since I first knew Linux. I had tried several different distributions like Ubuntu, Fedora and OpenSUSE, but I didn't have enough time to learn it in depth.

Now I have a plan to learn more about linux (Fedora), such as setting up a web server, starting a FTP server, doing some development, etc.

I had setup a web server successfully recently. The methods are as follows (my system is Fedora 15, there are some differences in other systems):

Firstly, install Apache, MySQL and PHP, run follow commands:
$ su
# yum install mysql-server httpd php
Now, you should have necessary packages installed. After installed, you must set a password for mysql root usr:
$ su
# systemctl start mysqld.service
# mysqladmin -u root password PASSOWRD_HERE
To run the apache and mysql services, enter the following in terminal. This should be done each time you want to use.
$ su
# systemctl restart mysqld.service
# systemctl restart httpd.service
The web server directory is "/var/www/html/". If you want the services to start with your OS, run the follows:

$ su
# systemctl enable mysqld.service
# systemctl enable httpd.service
At last, you must check the firewall to confirm the port 80 is open.



After all the above are done, open your browser and visit http://127.0.0.1, you can see a test page:


No comments:

Post a Comment