Install WordPress 3.3.1 on Fedora 16/15, CentOS/RHEL 6.2/5.7

This is guide, howto install WordPress 3.3.1 with Nginx or Apache on Fedora 16/15/14/13, CentOS 6.2/6.1/6/5.7 and Red Hat (RHEL) 6.2/6.1/6/5.7 servers. WordPress needs web server with PHP and MySQL database. This guide uses Apache web server with PHP 5.3 or Nginx web server with PHP 5.3 (PHP-FPM) and Mysql 5.5 database server.

If you want to install WordPress with Apache then use a – [Apache] sections and if you want install WordPress with Nginx then use b – [Nginx] sections.

1. Install Needed Web and Database Servers

[Apache]

1.1a Install the whole LAMP environment with following guide

LAMP (Linux/Apache/MySQL/PHP) on Fedora, CentOS/Red Hat (RHEL)

[Nginx]

1.1b Install the whole LEMP environment with following guide

LEMP (Linux/Nginx/MySQL/PHP) on Fedora, CentOS/Red Hat (RHEL)

OR

[Apache]

1.2a Install just MySQL and Apache with PHP using following guides

  1. Install MySQL 5.5 on Fedora, CentOS, Red Hat (RHEL)
  2. Install Apache (httpd) and PHP 5.3 on Fedora, CentOS, Red Hat (RHEL)

[Nginx]

1.2b Install just MySQL and Nginx with PHP (PHP-FPM) using following guides

  1. Install MySQL 5.5 on Fedora, CentOS, Red Hat (RHEL)
  2. Install Nginx and PHP 5.3 (PHP-FPM) on Fedora, CentOS, Red Hat (RHEL)

2. Install WordPress 3.3.1 on Fedora 16/15/14/13, CentOS/Red Hat (RHEL) 6.2/6.1/6/5.7

2.1 Change root user

su -
## OR ##
sudo -i

2.2 Download WordPress 3.3.1 / latest

cd /tmp
wget http://wordpress.org/latest.tar.gz

[Apache]

2.3a Untar/Extract Downloaded WordPress Package

tar -xvzf latest.tar.gz -C /var/www/html

[Nginx]

2.3b Create needed directories, set permissions and untar/Extract Downloaded WordPress Package

mkdir -p /srv/www/wordpress/public_html
mkdir /srv/www/wordpress/logs
chown -R nginx:nginx /srv/www/wordpress
 
tar -xvzf latest.tar.gz -C /srv/www/wordpress/public_html --strip-components=1

3. Create MySQL Database for WordPress

3.1 Connect MySQL Database as root

## localhost ##
mysql -h localhost -u root -p
 
## Remote server ##
mysql -h 10.0.0.15 -u username -p

3.2 Setup MySQL Database for WordPress

## CREATE NEW USER ##
CREATE USER wordpress@localhost IDENTIFIED BY "some_good_password_for_wordpress";
 
## CREATE NEW DATABASE ##
CREATE DATABASE wordpress_blog;
 
## GRANT needed permissions ##
GRANT ALL ON wordpress_blog.* TO wordpress@localhost;
 
## FLUSH privileges ##
FLUSH PRIVILEGES;
 
## Exit ##
exit

4. Setup WordPress

[Apache]

4.1a Create Apache VirtualHost for WordPress

This is simple VirtualHost setup for local usage. VirtualHost is not mandatory for WordPress installation.
Add following to /etc/httpd/conf.d/wordpress.conf file:

<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>

Reload Apache (httpd)

/etc/init.d/httpd restart

[Nginx]

4.1b Create Nginx VirtualHost for WordPress

Create sites-available and sites-enabled directories

mkdir /etc/nginx/sites-available
mkdir /etc/nginx/sites-enabled

Include sites-enabled
Add following lines to /etc/nginx/nginx.conf file, after “include /etc/nginx/conf.d/*.conf” line (inside http block).

## Load virtual host conf files. ##
include /etc/nginx/sites-enabled/*;

Create Nginx wordpress virtual host file
Add following content to /etc/nginx/sites-available/wordpress file. This is basic Nginx virtual host config file for wordpress.

server {
    server_name wordpress;
    access_log /srv/www/wordpress/logs/access.log;
    error_log /srv/www/wordpress/logs/error.log;
    root /srv/www/wordpress/public_html;
 
    location / {
        index index.php;
    }
 
    location = /favicon.ico {
        log_not_found off;
        access_log off;
    }
 
    location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }
 
    location ~ \.php$ {
        include /etc/nginx/fastcgi_params;
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME /srv/www/wordpress/public_html$fastcgi_script_name;
    }
 
    location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
        expires max;
        log_not_found off;
    }
 
    location ~ /\.ht {
        deny  all;
    }
}

Create symlink on sites enabled directory

cd /etc/nginx/sites-enabled/
ln -s /etc/nginx/sites-available/wordpress

Restart Nginx server

/etc/init.d/nginx restart

4.2 Set wordpress pointing to localhost (or some other host)

Add following to /etc/hosts file:

127.0.0.1  wordpress

[Apache]

4.3a Create wp-config.php

cd /var/www/html/wordpress
cp wp-config-sample.php wp-config.php

[Nginx]

4.3b Create wp-config.php

cd /srv/www/wordpress/public_html
cp wp-config-sample.php wp-config.php

4.4 Configure WordPress wp-config.php file

Open wp-config.php with text editor.

Setup at following database settings (which was created in section 3.2)

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'database_name_here');
 
/** MySQL database username */
define('DB_USER', 'username_here');
 
/** MySQL database password */
define('DB_PASSWORD', 'password_here');
 
/** MySQL hostname */
define('DB_HOST', 'localhost');
 
/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');
 
/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');

Insert some unique data on following section

define('AUTH_KEY',         'put your unique phrase here');
define('SECURE_AUTH_KEY',  'put your unique phrase here');
define('LOGGED_IN_KEY',    'put your unique phrase here');
define('NONCE_KEY',        'put your unique phrase here');
define('AUTH_SALT',        'put your unique phrase here');
define('SECURE_AUTH_SALT', 'put your unique phrase here');
define('LOGGED_IN_SALT',   'put your unique phrase here');
define('NONCE_SALT',	   'put your unique phrase here');

Generate unique phrases using pwgen
Install pwgen:

yum install pwgen

Generate phreses with pwgen:

pwgen -sy 50

Output:

l_fO1Q6\P>yYfsWZ9BY7_jj;U2k&,'5do!;rR5L!~M]y_{]~me
lOVt"rJk.rqZRUXA)VNZHs@]A1W1Zzdcb?+4y5D4'5zCYy>5lI
m8)ab[9]JO$S_;\+u0Q>e~@:VZ|N!R{u#3\NZavWZv.caQ_?GU
bu}g.6=j,6/at-lm1u2S_K>3ckX=EeI~i$?0p]zD|pO((a{b1]
#-otVokEQz9+&M0hokkKL]l*BK|c5w}bFmUZ:|=v'B:"_u^LV7
z{N*`:~6IzgL%p;#j_:8)nReK|*Cdr%#e)"F-v_VKWahLi%p\t
C+to$qo~PTq8=BD0{jv?dJyiY(L;'2sW`CnW!4*#y>|#Xpa4TF
%BCO]d}[ag5ivSZz+[ER]sr@W}`*J6](jFtQ]h>,DF<>KN?#?HXLJXB(i
~dMJ[e"S}c4R>7^Q)vG{Uq-):e}4I+]zsM@h#sz*7{Bnk}oa(y
...

Then simply use these generated phrases on WordPress config file. Remember remove or replace all quotation marks.

Check/Setup following parameters if needed:

// WordPress Database Table prefix
$table_prefix  = 'wp_';
 
// WordPress Localized Language, defaults to English
define ('WPLANG', '');
 
// For developers: WordPress debugging mode
define('WP_DEBUG', false);

Save wp-config.php file!

This guide example wp-config.php could look following

define('DB_NAME', 'wordpress_blog');
define('DB_USER', 'wordpress');
define('DB_PASSWORD', 'some_good_password_for_wordpress');
define('DB_HOST', 'localhost');
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');
define('AUTH_KEY',         'l_fO1Q6\P>yYfsWZ9BY7_jj;U2k&,"5do!;rR5L!~M]y_{]~me');
define('SECURE_AUTH_KEY',  'lOVt"rJk.rqZRUXA)VNZHs@]A1W1Zzdcb?+4y5D4"5zCYy>5lI');
define('LOGGED_IN_KEY',    'm8)ab[9]JO$S_;\+u0Q>e~@:VZ|N!R{u#3\NZavWZv.caQ_?GU');
define('NONCE_KEY',        'bu}g.6=j,6/at-lm1u2S_K>3ckX=EeI~i$?0p]zD|pO((a{b1]');
define('AUTH_SALT',        '#-otVokEQz9+&M0hokkKL]l*BK|c5w}bFmUZ:|=v"B:"_u^LV7');
define('SECURE_AUTH_SALT', 'z{N*`:~6IzgL%p;#j_:8)nReK|*Cdr%#e)"F-v_VKWahLi%p\t');
define('LOGGED_IN_SALT',   '%BCO]d}[ag5ivSZz+[ER]sr@W}`*J6](jFtQ]h>,D<mA(TmdIS');
define('NONCE_SALT',	   '~dMJ[e"S}c4R>7^Q)vG{Uq-):e}4I+]zsM@h#sz*7{Bnk}oa(y');
$table_prefix  = 'wp_';
define ('WPLANG', '');
define('WP_DEBUG', false);

4.5 Finnish WordPress Configuration with Browser

Open browser and Goto following address http://wordpress/.

Setup Basic WordPress Blog Data and Create Admin User

WordPress Installation

WordPress Installation Completed

WordPress Installation Completed

5. Use WordPress

5.1 WordPress Log In

Wordpress Log In

5.2 WordPress 3.3.1 New Welcome Screen and Dashboard

Wordpress 3.3.1 New welcome screen and dashboard

5.3 WordPress 3.3.1 Blog with Twenty Eleven Template version 1.3

Wordpress 3.3.1 Twenty Eleven Template v1.3

Follow If Not True Then False Updates!
  1. LAMP on Fedora 16/15, CentOS/Red Hat (RHEL) 6.2/5.7 – (Linux, Apache, MySQL, PHP)
  2. Install Apache/PHP 5.3.10 on Fedora 16/15, CentOS/Red Hat (RHEL) 6.2/5.7
  3. Install SVN (Subversion) Server on Fedora 16/15, CentOS/Red Hat (RHEL) 6/5.7
  4. Install MySQL 5.5.20 on Fedora 16/15, CentOS/Red Hat (RHEL) 6.2/5.7
  5. Install Nginx/PHP-FPM on Fedora 16/15, CentOS/RHEL 6.2/5.7

19 Comments

  1. hey, nice blog…really like it and added to bookmarks. keep up with good work

  2. Thank you for this guide.

    Really easy and simple way to install latest WordPress on CentOS and Fedora.

  3. thank you your writing style is amazing. just found your site on google. come back later for sure :)

  4. Your blog is very nice,thanks

  5. Great!
    Thanks!

    Best,
    Jozsef

  6. What about the FTP settings?
    Wordpress wants to update some plugins and asking for Hostname, FTP username and password. Do we need to have FTP server for this or there is some work around?
    Thanks.

    Best,
    Jozsef

  7. Found a solution for this as well:

    in /etc/httpd/conf/httpd.conf changed the
    User toMYuserNAME
    Group toMYgroup

    Also, did:
    # setsebool -P httpd_can_sendmail=1
    # setsebool -P httpd_can_network_relay=1
    # setsebool -P httpd_unified 1

    Best,
    Jozsef

  8. Hi.

    First of all I have to thank you for the tutorial. Very useful.

    Unfortunately I have 2 issues:

    1. After install, when trying to add a new theme I get this error: The uploaded file could not be moved to /var/www/html/wordpress/wp-content/uploads/2011/01

    I’ve change the owner and even, temporary change the rights to 777 for wp-content//upload folder. No success. I’ve also changed .htaccess. No success

    2. I think it’s related to the first issue. When trying to change permalinks to Day and name from Default the theme is no longer functional. You can’t access the posts.

    Thank You

    Linux 2.6.18-194.32.1.el5 #1 SMP Wed Jan 5 17:52:25 EST 2011 x86_64 x86_64 x86_64 GNU/Linux

  9. great post , thank you

  10. Thanks a lot

  11. Very good walk through, thanks. However I would definitely update it with how to configure SELinux in order to let apache write in the folder of uploads.

    have a look here

    http://forums.fedoraforum.org/archive/index.php/t-253532.html

    Also I cannot update the permalink’s file .htaccess . I have tried chmod and all kind of owership/group convinations but updating the permalink system from WP dashboard is not possible. Any clue?

    Thanks again for the post.

  12. How can MU or network be enabled so that you do not get forced on to sub domains, because wordpress is already installed? Add define(‘WP_ALLOW_MULTISITE’, true); to wp-config before you run the setup?

    Thanks,

    Matt

  13. Thanks a Lot

  14. My server database version is below 5.3. In that case, is there any alternate way without changing MySQL version?

    • Hi Shariar,

      Your database version is below 5.3? So could you tell your MySQL version? :)

  15. Thanks a lot!

  16. Great tutorial! How do I go about setting up another WP Blog?

    • Hi Kevin,

      Just use same method, but change location and names. :)

Leave a Comment

Your email address will not be published. Required fields are marked *

*

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=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">

contact

Trackbacks/Pingbacks

  1. Install Wordpress 3.0.1 on Fedora 13, CentOS 5.5, Red Hat (RHEL) 5.5/6 | WP Themes and Plugins - [...] is the original post:  Install Wordpress 3.0.1 on Fedora 13, CentOS 5.5, Red Hat (RHEL) 5.5/6 Most Related PostsHowTo ...
  2. wp-popular.com » Blog Archive » Install Wordpress 3.0.1 on Fedora 13, CentOS 5.5, Red Hat (RHEL) 5.5/6 - [...] is the original post: Install Wordpress 3.0.1 on Fedora 13, CentOS 5.5, Red Hat (RHEL) 5.5/6 Tags: centos, fedora, ...
Bear