Installing wordpress on Debian squeeze

Well this post is for anyone setting up virtual servers with Debian and I also need to remind myself how to do it because its not something you do everyday and I quite like using Linux.

How to set ups worpress on debian LAMP server

How to set ups wordpress on debian LAMP server

So  here we go how to setup wordpress on Debian LAMP server

WordPress install on a debian LAMP server

  1. Open a terminal application
  2. Enter command:
    enter the root password
  3. Enter Command:
    apt-get update -y && sudo apt-get upgrade –y
  4. Enter command:
    apt-get install wordpress –y
  5. Enter command:
    nano /etc/wordpress/htaccess
  6. Update the text as follows:
    1. Uncomment these two lines by removing the hash symbol:
      <IfModule mod_rewrite.c>
      RewriteEngine On
      RewriteBase /
    2. Add these 2 lines:
      RewriteCond %{HTTP_HOST} ^www.(.+) [NC]
      RewriteRule ^.*$ http://%1%{REQUEST_URI} [QSA,R=301,L]
    3. Uncomment these 4 lines:
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule . /index.php [L]
  7. Save the file by pressing CTRL+O, then accepting the filename by pressing Enter
  8. Exit nano by pressing CTRL+Z, you will be returned to the command prompt
  9. To setup apache, use nano to edit this file: /etc/apache2/sites-available/[your domain name]
    e.g. if your site is called, type this command, followed by Enter:
    nano /etc/apache2/sites-available/
  10. Paste this text into your new file, but change the ip and email address and domain name:
    DocumentRoot /var/www/
    DirectoryIndex index.php
    <Directory /var/www/>
    AllowOverride All
    Order Deny,Allow
    Allow from all
  11. Save the file and exit nano
  12. Create another file in nano with the same content as before but add the www. In front of your domain name in the “Server name” line.  name the file: “/etc/apache2/sites-available/” remember to change the file name to match your domain name.
  13. Now create a link (shortcut) from your www directory to your wordpress files which are in a different directory.  Enter these commands:
    cd /var/www/
    ln -s /usr/share/wordpress
  14. Now instruct apache to use these 2 new sites you have created.  Enter these commands:
    /etc/init.d/apache2 restart
    on some systems to restart apache, you may need this command instead:
    service apache2 restart
  15. Next we need to setup the wordpress database, change directory to:
    cd /usr/share/doc/wordpress/examples/
    then run the setup-mysql script by entering this command:
    bash ./setup-mysql –n prawnsalad
    the first variable is the mysql database name followed by the domain name
  16. Now open a browser on the debian server and browse to to setup wordpress

If you have not yet pointed your domain name at your server, you may need to add/update an entry in your server’s hosts file by following these steps:

  1. Open Terminal
  2. Enter this command to raise your privileges to root:
    enter password when prompted
  3. Enter this command to open the hosts file for editing:
    nano /etc/hosts
  4. Find the line that reads “       localhost”.  Move your cursor to the end of that line and add a space, then type your domain name.  e.g.        localhost
  5. Save by pressing CTRL+O, press the Y key to confirm overwriting the file
  6. To exit nano, press CTRL+Z
  7. Now browse to your domain name and you should land on the local server.



Hope all goes well


Leave a reply


We're not around right now. But you can send us an email and we'll get back to you, asap.


Log in with your credentials

Forgot your details?