Technical Recipes

Set up WordPress environment on Linux

1 Install Apache HTTP server
	# yum install httpd
2 Install PHP
	# yum install php
3 Configure php.ini
	# cp php.ini-production php.ini
	# vi php.ini
      extension_dir = ./ext
      log_errors = On
      error_log = php_errors.log
4 Edit httpd.conf to load the PHP module
	# vi /etc/httpd/conf/httpd.conf
      <FilesMatch \.php$>
        SetHandler application/x-httpd-php
5 Restart Apache web server
	# /usr/sbin/apachectl restart
	# /etc/init.d/httpd restart
	# service httpd restart
6 Install MySQL database server
    # yum install mysql mysql-server
    # mysql_secure_installation
7 Create MySQL database and user for WordPress

   7.1 Start MySQL database server
	# service mysqld start
   7.2 Create database and user
	# mysql -u root -p
        > create database blog
        > grant all privileges on blog.* to ''@'localhost' identified by ""
        > flush privileges;
        > exit
8 Download and install the WordPress package

   8.1 Download the WordPress package to the document root of the Apache web server
	# wget
   8.2 Extract the package under the same directory under a folder called wordpress
	# tar -xzvf latest.tar.gz
9 Configure wp-config.php

   9.1 Edit wp-config.php file
		define('DB_NAME', 'blog');
	define('DB_USER', '');
	define('DB_PASSWORD', '');
	define('DB_HOST', 'localhost');
	define('DB_CHARSET', 'utf8');
	define('DB_COLLATE', '');
        If you cannot connect to the database from WordPress on Linux, change the 'localhost' to ''. If you have custom port for MySQL database server, add the port after "localhost:3000".

   9.2 Use the online generator to generate security keys, add them into the wp-config.php and save wp-config.php.
10 Run the install script
     In browser, open and register WordPress admin user.