Installing WordPress on CentOS 5/6

1. wget http://wordpress.org/latest.tar.gz
2. cp /home/IICT/latest.tar.gz /var/www/html/
3. cd /var/www/html/
4. tar -xzvf latest.tar.gz
5. mysql -uroot -p(password)
6. nano /var/www/html/wordpress/wp-config.php

<?php
/**
* The base configurations of the WordPress.
*
* This file has the following configurations: MySQL settings, Table Prefix,
* Secret Keys, WordPress Language, and ABSPATH. You can find more information
* by visiting {@link http://codex.wordpress.org/Editing_wp-config.php Editing
* wp-config.php} Codex page. You can get the MySQL settings from your web host.
*
* This file is used by the wp-config.php creation script during the
* installation. You don't have to use the web site, you can just copy this file
* to "wp-config.php" and fill in the values.
*
* @package WordPress
*/

// ** MySQL settings – You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'wordpress');

/** MySQL database username */
define('DB_USER', 'root');

/** MySQL database password */
define('DB_PASSWORD', 'iict123');

/** 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', '');

/**#@+
* Authentication Unique Keys and Salts.
*
* Change these to different unique phrases!
* You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
* You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
*
* @since 2.6.0
*/
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');

/**#@-*/

/**
* WordPress Database Table prefix.
*
* You can have multiple installations in one database if you give each a unique
* prefix. Only numbers, letters, and underscores please!
*/
$table_prefix = 'wp_';

/**
* For developers: WordPress debugging mode.
*
* Change this to true to enable the display of notices during development.
* It is strongly recommended that plugin and theme developers use WP_DEBUG
* in their development environments.
*/
define('WP_DEBUG', false);

/* That's all, stop editing! Happy blogging. */

/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');

/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');

CREATE DATABASE wordpress;
mysql> CREATE USER wordpressuser@localhost;
Query OK, 0 rows affected (0.02 sec)

mysql> SET PASSWORD FOR wordpressuser@localhost= PASSWORD("iict123");
Query OK, 0 rows affected (0.02 sec)

mysql> GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser@localhost IDENTIFIED BY 'password';
Query OK, 0 rows affected (0.02 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye
8. Goto http://localhost/wordpress/wp-admin/install.php

9. Details:

WordPress is a content management system originally developed for blogging, but has been greatly expanded through widgets, themes and plugins. Complete the following steps to install WordPress on a CentOS 5/6.

Pre-reqs

yum -y install mysql-server httpd php php-mysql unzip wget  
chkconfig httpd on 
chkconfig mysqld on  
/etc/init.d/mysqld start 
/etc/init.d/httpd start

Create a WordPress database and MySQL User

Note: After the wordpress files are unzipped, they will be in a directory called wordpress in the home directory.

  • Log in to the MySQL Shell and create a new MySQL directory for wordpress
    mysql -u root -p
  • After logging in using your MySQL root password, create a WordPress database:

(For this example, we will use the database name WordPressdb.)

   CREATE DATABASE WordPressdb; 
  • Then we need to create the new user. You can replace the database, name, and password, with whatever you prefer:
    CREATE USER wordpressuser@localhost; 
  • Set the password for your new user:
   SET PASSWORD FOR wordpressuser@localhost= PASSWORD("password"); 

Note: For security purposes, you would obviously not use “password” for your password. Be sure to assign a secure password in this line instead.

  • Grant all applicable privileges to the new user. Without this command, the wordpress installer will not start up:
   GRANT ALL PRIVILEGES ON WordPressdb.* TO wordpressuser@localhost IDENTIFIED BY 'password'; 

  • Refresh MySQL:
FLUSH PRIVILEGES;
  • Exit out of the MySQL shell:
   exit

Configure WordPress

  • Copy the sample wordpress configuration file from the wordpress directory, into a new file.
  • Edit the new file to create a new usable wordpress config file:
    cp ~/WordPressdb/wp-config-sample.php ~/WordPressdb/wp-config.php
  • Open the wordpress config:
    vi ~/WordPressdb/wp-config.php
  • Find the section that contains the field below and substitute in the correct name for your database, username, and password:
// ** MySQL settings - You can get this info from your web host ** // 
/** The name of the database for WordPress */ define('DB_NAME', 'WordPressdb'); 
/**MySQL database username */ define('DB_USER', 'wordpressuser'); 
/** MySQL database password */ define('DB_PASSWORD', 'password');
  • Save and Exit.

Copy the Files

  • Transfer the unzipped WordPress files to the website’s root directory.
    sudo cp -r ~/wordpress/* /var/www/html
  • Set the permissions on the installation. First, switch in to the web directory:
    cd /var/www/
  • Give ownership of the directory to the apache user.
    sudo chown www-data:www-data * -R sudo usermod -a -G www-data username
  • Install the following php module on your server, to enable the WordPress installation form online. Download php-gd:
    sudo apt-get install php-gd
  • Restart Apache:
    sudo service httpd restart

Confirm setup

http://www.rackspace.com/knowledge_center/article/installing-wordpress-on-centos-56

How To Install WordPress on Centos 6

https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-on-centos-6–2

About WordPress

WordPress is a free and open source website and blogging tool that uses php and MySQL. It was created in 2003 and has since then expanded to manage 22% of all the new websites created and has over 20,000 plugins to customize its functionality.

Setup

The steps in this tutorial require the user to have root privileges. You can see how to set that up here in steps 3 and 4.

Before working with wordpress, you need to have LAMP installed on your server. If you don’t have the Linux, Apache, MySQL, PHP stack on your server, you can find the tutorial for setting it up here.

Once you have the user and required software, you can start installing wordpress!

Step One—Download WordPress

We can download WordPress straight from their website:

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

This command will download the zipped wordpress package straight to your user’s home directory. You can unzip it the the next line:

tar -xzvf latest.tar.gz

Step Two—Create the WordPress Database and User

After we unzip the wordpress files, they will be in a directory called wordpress in the home directory.

Now we need to switch gears for a moment and create a new MySQL directory for wordpress.

Go ahead and log into the MySQL Shell:

mysql -u root -p

Login using your MySQL root password, and then we need to create a wordpress database, a user in that database, and give that user a new password. Keep in mind that all MySQL commands must end with semi-colon. First, let’s make the database (I’m calling mine wordpress for simplicity’s sake; feel free to give it whatever name you choose):

CREATE DATABASE wordpress;
Query OK, 1 row affected (0.00 sec)

Then we need to create the new user. You can replace the database, name, and password, with whatever you prefer:

CREATE USER wordpressuser@localhost;
Query OK, 0 rows affected (0.00 sec)

Set the password for your new user:

SET PASSWORD FOR wordpressuser@localhost= PASSWORD("password");
Query OK, 0 rows affected (0.00 sec)

Finish up by granting all privileges to the new user. Without this command, the wordpress installer will not be able to start up:

GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser@localhost IDENTIFIED BY 'password';
Query OK, 0 rows affected (0.00 sec)

Then refresh MySQL:

FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

Exit out of the MySQL shell:

exit

Step Three—Setup the WordPress Configuration

The first step to is to copy the sample wordpress configuration file, located in the wordpress directory, into a new file which we will edit, creating a new usable wordpress config:

cp ~/wordpress/wp-config-sample.php ~/wordpress/wp-config.php

Then open the wordpress config:

vi ~/wordpress/wp-config.php

Find the section that contains the field below and substitute in the correct name for your database, username, and password:

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'wordpress');

/** MySQL database username */
define('DB_USER', 'wordpressuser');

/** MySQL database password */
define('DB_PASSWORD', 'password');

Save and Exit.

Step Four—Copy the Files

We are almost done uploading WordPress to the server. The final move that remains is to transfer the unzipped WordPress files to the website’s root directory.

sudo cp -r ~/wordpress/* /var/www/html

From here, WordPress has its own easy to follow installation form online.

However, the form does require a specific php module to run. If it is not yet installed on your server, download php-gd:

sudo yum install php-gd

Last of all restart Apache:

 sudo service httpd restart

Step Five—RESULTS: Access the WordPress Installation

Once that is all done, the wordpress online installation page is up and waiting for you:

Access the page by adding /wp-admin/install.php to your site’s domain or IP address (eg. example.com/wp-admin/install.php) and fill out the short online form (it should look like this).

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s