Category: Linux

Go to the root directory,
Download the latest wordpress installation using the following command and then unzip it:

* wget http://wordpress.org/latest.tar.gz
* tar -xzvf latest.tar.gz

Setting up Database for wordpress

1- mysql -u root -p
2- CREATE DATABASE wordpress;
3- CREATE USER wordpressuser@localhost;
4- SET PASSWORD FOR wordpressuser@localhost= PASSWORD("password");
5- GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser@localhost IDENTIFIED BY 'password';
6- FLUSH PRIVILEGES;
7- exit

Copying the wp-config-sample file to wp-config: (Just to make a proper config file and leave the default which comes with the installation)

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

Modify the ‘wp-config’ file to add in the database and user details:

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

Moving the wordpress installation to the webroot directory:

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

Now the wordpress is installed but we have to follow the online instructions to complete the configuration by hitting the wordpress login page in the browser, but for this we need ‘php-gd’ package installed. Use the following command for this:

* yum install php-gd
* yum install php-common
* yum install php-mysql

Also point the vhost/httpd.conf file to the /var/www/html directory and then restart apache.

Brwose the WordPress installation:
xx.xx.xx.xx/wp-admin/install.php

The wordpress installation will come up with a page to put in some details, and you are done with the installation after this.

* service httpd restart

We can secure the wordpress admin page by restricting this to a source IP in the vhost file as a directory:

NameVirtualHost *:80

        ServerName domain.com
        DocumentRoot /var/www/html/
        
                Options -Indexes FollowSymLinks +ExecCGI
                AllowOverride All
                Allow from All
                Order Allow,Deny
        


        Options -Indexes FollowSymLinks +ExecCGI
        AllowOverride All
        #Allow from All
        Allow from xx.xx.xx.xx
        Allow from 10.255.255.0/255.255.255.0
        Deny from All
        Order Deny,Allow



Optimizing wordpress by using mysql query cache:

Vi /etc/my.cnf
query_cache_size = 256M
query_cache_type=1
query_cache_limit=5M

Changing the memory_limit in ‘php.ini’, this sets the maximum amount of memory a script in allowed to allocate:

vi /etc/php.ini
search for memory_limit and change this to '512MB' or whatever is suitable for you.

Install W3 Total Cache to improve the page speed:

* Brwose the WordPress installation:
xx.xx.xx.xx/wp-login.php

* Click on the Plugins on the left side pannel of the admin page
* Click on 'Add New'
* Search for 'W3 Total Cache' and install this

After installation complete,
Click on the 'Activate' button under the Plugin name
Click on Settings under the new installed 'W3 Total Cache'.

Enable 'Total Cache, Minify, Database Cache, Object Cache, Browser Cache'
Save the Settings 

Congratulations, we are now done with the installation, security and optimization of our wordpress.
Restart the apache and mysql to save them.

* service httpd restart
* service mysqld restart

 

How useful was this post?

Click on a star to rate it!

Average rating / 5. Vote count: