First you need to prepare the machine that you are going to use. I’m using a Rackspace cloud server. In which case, all I need to do is spin up a server and update the Operating System software.
Installing Apache is easy, simply run
apt-get install apache2 as the root user.
[email protected]:~# apt-get install apache2 Reading package lists... Done Building dependency tree Reading state information... Done The following extra packages will be installed: apache2-bin apache2-data libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap ssl-cert Suggested packages: www-browser apache2-doc apache2-suexec-pristine apache2-suexec-custom apache2-utils openssl-blacklist The following NEW packages will be installed: apache2 apache2-bin apache2-data libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap ssl-cert 0 upgraded, 8 newly installed, 0 to remove and 0 not upgraded. Need to get 1,302 kB of archives. After this operation, 5,314 kB of additional disk space will be used. Do you want to continue [Y/n]?
Once the installation has finished, open up a web browser and enter the IP address into the address bar. Hopefully you should see a page like the below.
And that’s it! Apache is now installed and working!
Set the Hostname
Your likely to see the below error message.
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 2a00:1a48:7806:117:936d:610a:ff08:747d. Set the 'ServerName' directive globally to suppress this message [ OK ]
This is caused by the hostname not being set correctly. Open up
/etc/hosts and enter something similar to the below, adjusting for your own environment.
# The following lines are desirable for IPv6 capable hosts ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters 127.0.0.1 www.yourdomain.co.uk www localhost 2a00:1a48:7806:0117:936d:610a:ff08:747d www.yourdomain.co.uk www 184.108.40.206 www.yourdomain.co.uk www 10.180.66.169 www.yourdomain.co.uk www
If you too are using a Rackspace cloud server, the most important line is shown below.
2a00:1a48:7806:0117:936d:610a:ff08:747d www.yourdomain.co.uk www
This will stop the warning message.