Feb 052012
 

This post is mainly for me. To document what I did so next time, I don’t have to chase down howto.

Install

$ sudo yum groupinstall "Web Server"
$ sudo yum install mysql-server
$ sudo yum install php-gd

Start the servers

$ sudo service httpd start
$ sudo service mysqld start

For these services to start on reboot:

$ sudo systemctl enable httpd.service
$ sudo systemctl enable mysqld.service

Create a root password (default is nothing):

$ mysqladmin -u root -p password $(NEWROOTPASSWORD)

Create a mysql database

$ mysql -u root -p
mysql>CREATE DATABASE $(WORDPRESS_DATABASE_NAME);
mysql>CREATE USER $(DATABASE_USER)@localhost IDENTIFIED BY “$(USER_PASSWORD)”;
mysql>GRANT ALL ON $(WORDPRESS_DATABASE_NAME).* TO $(DATABASE_USER)@localhost;
mysql> FLUSH privileges;
mysql> exit

Get the latest wordpress zip file

$ cd /var/www/html
$ sudo wget http://wordpress.org/latest.zip
$ sudo unzip latest.zip
$ sudo rm latest.zip

Prepare a new apache site:

$ sudo vi /etc/httpd/conf.d/wordpress.conf
<VirtualHost *:80>
  ServerAdmin test@test
  DocumentRoot /var/www/html/wordpress
  ServerName wordpress
 
  # Logging
  ErrorLog /var/log/httpd/wordpress-error-log
  CustomLog /var/log/httpd/wordpress-acces-log common
</VirtualHost>

Need to create the uploads directory and give it the correct permissions and let selinux know about it

$ sudo mkdir /var/www/html/wordpress/wp-content/uploads
$ sudo chown apache:apache /var/www/html/wordpress/wp-content/uploads
$ sudo chmod 755 /var/www/html/wordpress/wp-content/uploads
$ sudo chcon -R -t httpd_sys_content_rw_t /var/www/html/wordpress/wp-content/uploads/

On the subject of selinux, I want apache able to send me mail

$ sudo restorecon /usr/sbin/sendmail.sendmail
$ sudo setsebool -P httpd_can_sendmail 1

Restart the apache and sendmail server:

$ sudo service httpd restart
$ sudo service sendmail restart

Don’t forget to change the port mapping for a virtual server on your router.

Also make sure you setup a static IP address for the machine

$ sudo vi /etc/sysconfig/network-scripts/ifcfg-eth0
NAME="eth0"
UUID=aaaabbbb-cccc-dddd-eeee-ffffgggghhhh
HWADDR=00:11:22:33:44:55
TYPE=Ethernet
BOOTPROTO=none
IPADDR0=$(IPADDRESS_IN_ZONE)
PREFIX0=24
GATEWAY0=$(ZONE_GATEWAY)
DNS1=$(ZONE_DNS_1)
DNS2=$(ZONE_DNS_2)
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
ONBOOT=yes

Other programs to install and configure

powertop
denyhosts

Other things to check

Firewall: Need to open a port for http on the server (one from the router portmap)

Plugins:
Ultimate Security Checker
wp-syntax
wassup
Importer
Google SiteMap
Theme:
Suffusion

Create sitemap.xml and sitemap.xml.gz. Make sure that apache owns them and then notify selinux

$ sudo chcon -t httpd_sys_content_rw_t sitemap.xml
$ sudo chcon -t httpd_sys_content_rw_t sitemap.xml.gz

Additional selinux commands

 

Information grabbed from numerous sources:
From http://fedoraproject.org/wiki/Administration_Guide_Draft/Apache

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

Human Conf Test * Time limit is exhausted. Please reload CAPTCHA.