This is a short tutorial for installing WordPress locally on a Fedora 9 machine (with SELinux enabled). It assumes that you are going to set up a self-hosted WordPress blogging platform. I will present the whole working flow here, with some special concerns on SELinux issues.

  1. Install the web and database server. Of course, we need to have a web server and a database server at first. On Linux, such software bundle is often referred as LAMP (Linux, Apache, MySQL, PHP). There are at least two easy ways to install LAMP.
    • When you install the Fedora system, you can select the option web server. By selecting the option, Apache, PHP and MySQL will be installed automatically.
    • Or, you can use the software manager (System->Adminstration->Add/Remove Software) to install them. Just search and install httpd, PHP and MySQL packages.
    • For other installing methods, you can read this tutorial.
  2. Start the servers. There are three more things to do to successfully start the web server.
    • Start the MySQL server and set a password for the root user. To start the MySQL server, the easiest way is to use the System->Service interface. You can also type $ sudo /sbin/service mysqld start. To set a password for the root user, type in a terminal $ sudo mysqladmin -u root password 'yourpassword'. Use $ sudo /sbin/service mysqld restart to restart mysqld server.
    • Start the Apache httpd server. Again, you can use the System->Service interface. Or, you can type $ sudo /sbin/service httpd start (which actually use the $ /usr/sbin/apachectl command). Use $ sudo /sbin/service httpd graceful to restart httpd server gracefully.
    • Open ports on the firewall for services. When SELinux is enabled, firewall rejects remote access by default. You have to open some ports on the firewall, otherwise, nobody can actually visit your web site. Go to System->Firewall to open the necessary ports. At least the ‘WWW’ (’80/tcp’) port should be open. HTTPS and SSH ports are strongly recommended to be open, too. If you want to connect to you MySQL server from remote machines, of course, mysql ports should be open. The default port for mysql is 3306. You can open special ports in the ‘Other Ports’ section.
    • Now you can test your web site. Write a simple index.html file to the DocumentRoot (default path is /var/www/html) and try to access your website from another machine.
  3. Install WordPress. The WordPress package can be installed by the software manager. But I do recommend to download and install by yourself. It is simple and the best way to install multiple blogs on one machine. For a quick installation, you may look at the Famous 5-Minute Install tutorial. For multiple blog installation, just repeat the process in multiple folders.
  4. Post Installation of WordPress. There are some things to do after installation to make your wordpress work perfect for you.
    • If you want to use the integrated media management interface to upload and manage your media, you have to setup a writable folder to store the uploaded files.
      First, create the uploads directory
      $ sudo mkdir /path-to-your-blog/wp-content/uploads
      Then, make your httpd server (assume as www) as the owner of the folder.
      $ sudo chown -R www:www /path-to-your-blog/wp-content/uploads
    • Restore SELinux context for downloaded themes. If SELinux is enabled, your Apache httpd server may not be able to access the downloaded theme files (you’ll see a yellow star [the SELinux trouble shooter] popped up). You can make theme files accessible by Apache by typing
      $ sudo /sbin/restorecon -R -v /yourpath/wp-content/themes

Hope you enjoy this short introduction.


This entry was posted on Friday, June 13th, 2008 at 10:29 am and is filed under Tutorial, Wordpress. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

One comment


Excellent post.. All the Best

September 10th, 2008 at 10:48 pm

One Trackback/Ping

  1. Installing WordPress | Guide for Blogs and Wordpress    Oct 09 2008 / 11pm:

    [...] Install WordPress Locally on Fedora Linux (easy) [...]

Leave a reply

Mail (will not be published)