Install WordPress 3.7.1 Using LAMP Server On Debian 7 Wheezy

A few days before, WordPress 3.7, code named ‘Basie’, has been released with automatic update option, many security features and bug fixes. And today WordPress 3.7.1 Maintenance release is available for download and upgrade. You can find the complete changelog here.

In this tutorial let us see how to setup WordPress 3.7 using apache server (LAMP Server) on Debian 7 Wheezy. You don’t have to manually upgrade to WordPress 3.7, everything will be done in the background while you sleep. For those who want to setup their own new WordPress site, then this tutorial will help.

In this tutorial, I use Debian 7 with LAMP Server to setup WordPress. My test box hostname is server.unixmen.com and IP address is 192.168.1.200/24. I am going to host my WordPress site in a sub directory i.e my WordPress site URL will be http://domain-name/wordpress.

Prerequisites

You should have a working LAMP server before installing WordPress. To Setup a Working LAMP Server on Debian 7, please follow the below link.

>>> Install LAMP Server (Apache, MySQL or MariaDB, PHP) On Debian 7 Wheezy

Create Database for WordPress

Now let us create a database called “wpdb” and database user called “wpuser” with password “debian” for WordPress. You can define database and user as per your liking.

Login to mysql using command:

mysql -u root -p

And enter the following commands to create a new database and user.

mysql> create database wpdb;
Query OK, 1 row affected (0.02 sec)

mysql> GRANT ALL ON wpdb.* TO wpuser@localhost IDENTIFIED BY 'debian';
Query OK, 0 rows affected (0.01 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

mysql> exit
Bye

Download Latest WordPress Version

Download the latest version of WordPress using the following command:

wget http://wordpress.org/latest.zip

Extract it using command:

unzip latest.zip

Copy the extracted folder to your website document root using the following commands. As i mentioned before, i am going to host my WordPress site in a sub directory, so that i can access my WordPress site using URL http://domain-name/sub-directory-name i.e in my case http://unixmen.com/wordpress.

cp -R wordpress/ /var/www/wordpress

Make the document root and the WordPress files in it writable by the apache user using following command:

chown -R www-data:www-data /var/www/

Configure WordPress

Go to the folder /var/www/wordpress,

cd /var/www/wordpress

Rename the file wp-config-sample.php to wp-config.php.

mv wp-config-sample.php wp-config.php

Open the file wp-config.php and set your database details.

nano wp-config.php

Navigate to MySQL Settings section. Enter the WordPress database name, user and password details which we have created earlier.

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

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

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

/** MySQL hostname */
 define('DB_HOST', 'localhost');

[...]

Save and close the file.

Create VirtualHost file for WordPress

Let us copy the default vhost configuration for our new wordpress site as shown below.

cp /etc/apache2/sites-available/default /etc/apache2/sites-available/wordpress

Open up the new vhost file wordpress using any editor,

nano /etc/apache2/sites-available/wordpress

Make the changes as shown below. Replace the IP address and domain name with your own where it appropriate.

NameVirtualHost 192.168.1.200:80
<VirtualHost 192.168.1.200:80>
        ServerAdmin sk@unixmen.com

        DocumentRoot /var/www/wordpress
        <Directory /var/www/wordpress>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>
        ErrorLog ${APACHE_LOG_DIR}/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Save and close the file.

We have done with vhost configuration. Now let us enable the vhost by simply creating a symbolic link as shown below.

ln -s /etc/apache2/sites-available/wordpress /etc/apache2/sites-enabled/wordpress

Now disable the default vhost and enable the new vhost wordpress.

a2dissite default
a2ensite wordpress

Open the file /etc/apache2/ports.conf  in any editor,

nano /etc/apache2/ports.conf

Find the line NameVirtualHost *:80 and comment it as shown below.

[...]
# README.Debian.gz

#NameVirtualHost *:80
Listen 80
[...]

Then restart apache service.

service apache2 restart

Begin WordPress Installation

Open up your web browser and navigate to http://ip-address/wordpress/ or http://domain-name/wordpress/. You should see the following screen.

Enter your WordPress site name, username, password and mail id etc and click on Install WordPress link.

WordPress › Installation - Mozilla Firefox_001Now click Log In to enter into your WordPress site.

WordPress › Installation - Mozilla Firefox_002Enter your username and password that you’ve created earlier.

Unixmen › Log In - Mozilla Firefox_003Now you will be redirected to your WordPress Dashboard.

Dashboard ‹ Unixmen — WordPress - Mozilla Firefox_004This is how my WordPress site looks:

Unixmen | Just another WordPress site - Mozilla Firefox_005Now we have successfully installed WordPress On Debian 7 using LAMP server. It is time to add some contents and additional pages.