Contents[Hide]

Wordpress installation on ubuntu linuxThis article describes an installation of Wordpress on a Ubuntu Linux system using Apache web-server and MySQL database. Wordpress is an CMS ( Content Management System ), mostly used as a blog publishing web application. Wordpress is written in PHP language and uses MySQL database to store data.

Preliminary notes about the system used for this Wordpress installation:

  • Ubuntu Linux 10.04 - Worpress 3.1 ( Reinhardt )
  • Kernel 2.6.32-21-generic #32-Ubuntu SMP
  • mysql Ver 14.14 Distrib 5.1.41
  • Apache/2.2.14 (Ubuntu)
  • PHP 5

1. Step 1: Prerequisites installation

# apt-get install php5-mysql mysql-server

2. Step 2: Download and Decompress Wordpress

We start by downloading a latest version of Wordpress and decompressing it into /var/www/wordpress .

# cd /var/www
# wget http://wordpress.org/latest.zip
# unzip latest.zip

At this point all files should be within /var/www/wordpress directory.

3. Step 3: Apache Configuration

In this step we will create a new apache site called wordpress, enable it and disable default apache website.

# cd /etc/apache2/sites-available
# sed 's/www/www\/wordpress/g' default > wordpress
# a2ensite wordpress
# a2dissite default

Restart apache to apply all changes:

# /etc/init.d/apache2 restart

4. Step 4: Creating Wordpress database

Next, we will need to create a MySQL database to be used with our Wordpress installation:

  • Username: wordpress
  • Password: wordpress
  • Database name: wordpress
# mysql -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 39
Server version: 5.1.41-3ubuntu12.10 (Ubuntu)

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

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

mysql> CREATE USER 'wordpress'@'localhost' IDENTIFIED BY 'wordpress';
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON wordpress.* to wordpress@localhost;
Query OK, 0 rows affected (0.00 sec)

mysql> quit
Bye

5. Step 5: Creating wp-config.php

To continue a Wordpress installation we need to create a wp-config.php file to accommodate all Wordpress configuration needs. Use following lines to insert database name, database user and password into wp-config.php file.

# cd /var/www/wordpress/
# cp wp-config-sample.php wp-config.php
# sed -i 's/database_name_here/wordpress/' wp-config.php
# sed -i 's/username_here/wordpress/' wp-config.php
# sed -i 's/password_here/wordpress/' wp-config.php
# chmod 600 wp-config.php

OR use text editor of your choice to supply wp-config.php with correct information:

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

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

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

Ensure that apache have access to wordpress installation files. If this is your local system make sure that www-data owns of all files:

# chown -R www-data.www-data /var/www/wordpress

NOTE: Although localhost as a MySQL hostname within wp-config.php file is a most common option, you may need to change this value according to your webhost needs.

Here are some possible MySQL host values:

Hosting Company MySQL hostname
1and1 db12345678
AN Hosting localhost
A Small Orange localhost
BlueHost localhost
DreamHost mysql.example.com
GoDaddy h41mysql52.secureserver.net
HostGator localhost
HostICan localhost
ICDSoft localhost:/tmp/mysql5.sock
LaughingSquid localhost
MediaTemple GridServer internal-db.s44441.gridserver.com
NearlyFreeSpeech.Net username.db
one.com localhost
pair Networks dbnnnx.pair.com
Rackspace Cloud mysql50-01.wc1.dfw1.stabletransit.com
Yahoo mysql
Hosts with cPanel localhost
Hosts with Plesk localhost
Hosts with DirectAdmin localhost
Tophost.it sql.your-domain-name.it

Optional ( recommended ) step:

Create slathash for wordpress. Visit https://api.wordpress.org/secret-key/1.1/salt/ and copy all lines into your wp-config.php file replacing current non-set values.

6. Step 6: Install Wordpress

At this stage everything should be ready to install Wordpress on your ubuntu Linux system. Open your browser and point it to your webserver's IP / hostname . Follow Wordpress installer instructions to finish Wordpress installation.

7. Troubleshooting

Wordpress blank page problem:

If you have created wp-config.php file and navigated to your Wordpress installation page using your browser you may see a blank page. This is mostly a result of wp-config.php misconfiguration. Check all data you have filled in to your wp-config.php as well as check actual permissions of this file.

If worst comes to worst you may attempt to continue Wordpress installation without wp-config.php where Wordpress installer will offer you creation of new wp-config.php file.



Go to top