Fedora - Apache and PHP install
Fedora 10 - Installing Apache and PHP5
Fedora 10 comes with Apache v.2.2.10 and PHP v.5.1.6 and they are easily installed via the default Fedora Package Manager 'yum'.
The advantage of using yum (as opposed to installing via source code) is that you will get any security updates (if and when distributed) and dependencies are automatically taken care of.
A basic Apache install is very easy:
sudo yum install httpd mod_ssl
Oddly, the server does not start automatically when you install it so you have to do this by hand:
sudo /sbin/service httpd start
The first thing you will see is this error:
Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
As you can see, the address 127.0.0.1 is used as the
ServerName by default. It's a good idea to set the
ServerName for the next time the server is started.
Open the main apache
sudo nano /etc/httpd/conf/httpd.conf
Towards the end of the file you will find a section that starts with 'ServerName' and gives the example:
All you need to do is enter your Cloud Server hostname or a FQDN:
Note that my Cloud Server hostname is 'demo'.
sudo /sbin/service httpd reload
Now the warning has gone. Nice.
Note that in some versions of Fedora, a firewall is installed by default which will block access to port 80, on which Apache runs. The following command will open this port:
iptables -I INPUT -p tcp --dport 80 -j ACCEPT
However, for more information on firewalls and their configuration, it is strongly recommended to learn more about Firewalls in our knowledge base.
If you navigate to your Cloud Server IP address:
You will see the default Fedora Apache welcome screen:
I think that's a good start.
Now that we have Apache installed and working properly, we need to make sure that it's set to start automatically if the Cloud Server is rebooted.
sudo /sbin/chkconfig httpd on
Let's check our work to confirm:
sudo /sbin/chkconfig --list httpd httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
Let's move on to the PHP5 install. I'm not going to install all the modules available. Just a few common ones so you get the idea.
As before, due to using yum to install PHP5, any dependencies are taken care of:
sudo yum install php php-common php-gd php-mcrypt php-pear php-pecl-memcache php-mhash php-mysql php-xml
Once done, do a quick Apache reload:
sudo /etc/init.d/httpd reload
Well, almost done.
We do need to configure Apache for our setup so we can host multiple sites and so on.
© 2011-2013 Rackspace US, Inc.
Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License
See license specifics and DISCLAIMER