… copied as-is from : http://fedorasolved.org/server-solutions/lamp-stack
Very useful info, everything works like a charm (I tried on FC15) so I am replicating this here in case that page ever gets archived, goes offline, etc. I will see if I can add some more info about setting phpMyAdmin here as well.
Doing the work
The best way to install a LAMP stack is to install each letter in sequence; to spell out the word LAMP, in effect.
If you’ve already got Fedora installed, then you’ve accomplished this step. If you haven’t, check out Install Solutions for more details on installing and configuring Fedora.
Installing Apache means installing the program which will handle requests to your web server. For most people, Apache itself is the web server, terminologically speaking. In your Fedora installation, depending on the choices you made during the install process, you may or may not have Apache already installed. Just use the following command to check:
# rpm -q httpd
If it tells you a version number, then it’s installed and we can progress to the next step. Otherwise, we need to install it:
# yum install httpd
After installation, the service must be configured to start automatically.
# /sbin/chkconfig httpd on
To start the server process immediately:
# /sbin/service httpd start
(fc10 or older)
Finally, it’s important to make sure that port 80 is remotely accessible, by configuring iptables to open the port (and to leave it open by default from the outside). The following commands will remember the rule for you across reboots and apply it immediately:
# echo '-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT' >> /etc/sysconfig/iptables # /sbin/service iptables restart
You can put in the hostname or IP address of the server in the address bar of a web browser (whether on the same host or elsewhere in the network) to test the installation. You’ll see a welcome page if everything was successful. Otherwise, refer to troubleshooting.
(fc11 or newer)
1. Execute the ‘system-config-firewall-tui’ command as root:
2. Use tab to navigate to “customize” and press [enter].
3. Use the arrow keys to navigate to WWW (HTTP) and press the space bar or [enter].
4. Use tab to navigate to ‘forward’ and press [enter].
— httpd is allowed now once we save
— mysql steps
5. On the “Other Ports” screen, use tab to select ‘add’.
6. For the Port/Port-Range, enter 3306. For the protocol, enter tcp. Use tab to navigate to ‘OK’ and press [enter].
7. Use tab to navigate to ‘close’ and press [enter].
8. Use tab to navigate to ‘OK’ and press [enter].
9. Use tab to navigate to ‘Yes’ and press [enter].
NOTE: This is the abbreviated process to setup MySQL.
Installing and running the database component of the LAMP stack, called MySQL, is at least as easy. The following command will install the database and the server process.
# yum install mysql mysql-server
(fc10 or older only) The server process must likewise be running and accessible.
# /sbin/chkconfig mysqld on # echo '-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT' >> /etc/sysconfig/iptables # /sbin/service iptables restart # /sbin/service mysqld start
To test that everything is working okay so far, run this command to print out some information and check its status:
# mysqladmin version status
PHP (or Perl or Python)
PHP interprets the scripts of your favorite web site or application, running on top of the other parts of the LAMP stack.
The following command will install PHP, along with the needed stuff to glue it together with the web server and the database.
# yum install php php-mysql
PHP is pretty much ready to run after that, although you may need to restart the web server to make sure it loads the PHP module.
# /sbin/service httpd restart
If you’d like to use another ‘P’ in the place of PHP (or install alongside), the steps are pretty similar. Both Perl and Python come with ways to access MySQL and modules to allow them to run smoothly and quickly inside of Apache.
To run Python on your web server, run the following. (Python is already installed on all Fedora installations, so it’s not needed to install that as well.)
# yum install mod_python MySQL-python
For Perl, the following will get you started:
# yum install perl mod_perl perl-DBD-mysql
Don’t forget to restart the web server after either (or both) of these commands to make sure the relevant modules will be loaded by Apache.
Definitively testing the whole thing is pretty easy. You can create a small test PHP file and try to access it.
Create the test script:
# echo "<?php phpinfo(); ?>" > /var/www/html/index.php
Then access the web server by putting the address in any web browser that can access the server. If your server’s IP address is 192.168.1.100, put that in the address bar. By going to that address, you should see a long detailed page describing PHP’s configuration and status in detail.
You can skip down to the MySQL section by putting a jump in the address bar to it. (If you used http://192.168.1.100/ to access the page, use http://192.168.1.100/#module_mysql to skip down to the relevant part.) You should see various options about MySQL enumerated.
If all this is successful, you should delete the script you just created.
# rm -f /var/www/html/index.php
Now it’s time to install your favorite web application (phpBB, mediawiki, squirrelmail/roundcube) or learn PHP.
Since I don’t personally use Perl for web development, I’m not sure what exactly is needed to use it with a database.
We test this stuff on our own machines, really we do. But you may run into problems, if you do, come to #fedora on irc.freenode.net
- Android Development
- C programming
- Linux administration
- Linux device drivers
- Linux Gaming
- Linux kernel
- Linux Networking
- Linux on Windows
- Linux printing
- Linux sound and ALSA
- Package Managers
- Shell and environment
- Tips and tricks
- web development
- Wordpress Tips
- X Window System
- July 2017
- February 2017
- January 2017
- November 2016
- October 2016
- September 2016
- August 2016
- July 2016
- June 2016
- April 2016
- March 2016
- December 2015
- November 2015
- September 2015
- June 2015
- May 2015
- April 2015
- March 2015
- February 2015
- January 2015
- December 2014
- October 2014
- February 2014
- January 2014
- November 2013
- October 2013
- June 2013
- April 2013
- March 2013
- February 2013
- January 2013
- December 2012
- October 2012
- August 2012
- July 2012
- June 2012
- May 2012
- April 2012
- March 2012
- February 2012
- September 2011
- August 2011
- June 2011
- May 2011
- April 2011
- March 2011
- February 2011
Cloudaudio bash boot compile C programming cups drupal emacs etc Fedora git grep how to httpd init kernel libc linux linux partition localtime login make mount mp3 mysql networking oracle package managers password phpMyAdmin programming rpm shell sql vbox version control system virtual box vm web server wordpress www xargs xfce xwin yum