Setup WordPress on Ubuntu

Here are the steps I use when setting up WordPress on new Ubuntu server.

  1. Log into the console and grab a root shell
    Note: I don’t like typing sudo in front of every command

    $ sudo bash
  2. Install an ssh server to make remote management easy
    # apt-get install openssh-server
  3. Install a LAMP stack
    Note: You will need to remember the root password you setup for MySQL

    # apt-get install lamp-server^
  4. Download the latest wordpress
    # wget http://wordpress.org/latest.tar.gz
  5. Extract the archive file
    # tar -xzvf latest.tar.gz
  6. Make a folder to hold the wordpress install
    # mkdir /var/www/wordpress
  7. Move all the WordPress files to folder you created
    # cp -r ~/wordpress/* /var/www/wordpress
  8. Create a mysql user account and database for wordpress. 
    Note: Will need the root password created when installing the lamp stack

    # mysql -u root -p
  9. Create now a new database for wordpress 
    Note: Replace WordPress with any name of your choice

    mysql> CREATE DATABASE WordPress;
  10. Add now a new mysql user for wordpress
    Note: Replace “username” with any name of your choice

    mysql> CREATE USER username;
  11. Assign a password to the wordpress mysql user
    Note: Replace “abcd” with your own password

    mysql> SET PASSWORD FOR 'username' = PASSWORD('abcd');
  12. Grant the wordpress user all privileges for the wordpress database
    mysql> GRANT ALL PRIVILEGES ON WordPress.* TO 'username' IDENTIFIED BY 'abcd';
  13. After setting up the database and user, exit MySQL
    mysql> exit;
  14. Create a WordPress configuration file by copying the template
    Note: If you installed in another directory, then correct the given path to your own.

    # cp /var/www/wordpress/wp-config-sample.php /var/www/wordpress/wp-config.php
  15. Edit the WordPress configuration (wp-config.php) so it contains your MySQL information
    Note: I use nano for all text editing, but feel free to use whatever tickles your fancy

    # nano /var/www/wordpress/wp-config.php
  16. Insert now your MySQL settings you have just created by replacing:
    • database_name_here   —> with the database name you have created. For this tutorial, it’s named “WordPress”
    • username_here  —> with the MySQL user you have created earlier
    • password_here  —> with the password you assigned to the MySQL user

    Note: After editing is complete, exit nano by a ctrl-x, then y to save

  17. Create an Apache config for the WordPress site by copying the default
    # cp /etc/apache2/sites-available/default /etc/apache2/sites-available/wordpress
  18. Open the config you copied to edit it
    # nano /etc/apache2/sites-available/wordpress
  19. Edit the wordpress config as follows:
    • Change the DocumentRoot and Directory to /var/www/wordpress
    • Edit the “AllowOverride” options to say All instead of None

     

  20. Disable the default apache config, enable the WordPress apache config, and enable the rewrite module
    # a2dissite default && a2ensite wordpress && a2emod rewrite
  21. Create a .htaccess to hold the wordpress rewrite rules
    # touch /var/www/wordpress/.htaccess
  22. Give the apache service rights to the folder and allow editing of the .htaccess file
    # chown -R www-data:www-data /var/www/wordpress/
    # chmod -v 664 /var/www/wordpress/.htaccess
  23. Restart apache to reload settings
    # apachectl restart

Finished.

Site redesign in progress

Alas, I have moved away from PHP and MySQL (wordpress) towards .NET and MSSQL (blogengine.net), although I still have many negative feelings towards Microsoft (mostly because of their licensing/DRM policies) and many positives toward open source and freedom from cost. WordPress rocks, don't get me wrong; boy wordpress and I sure had a lot of fun. Yet, I am training for MS certifications, and coding in dotnet just comes natural anymore. Plus Visual Studio 2k5 blows any php editor out of the water. With the advent of .NET being released to the open community by Microsoft, I foresee a foothold on the web app scene by .NET. Besides, any one who codes both languages knows that that C# is a more polished C language than PHP is anyway; plus its available class library is far more organized. I dig organization, now if I could just get over the whole selling out thing… oh and I love my Xbox.

Host your own site from your dynamic ip

If you have a linksys wireless router (usually blue with 2 antennas), chances are it has built in dyndns subscription software. Thats what I have anyway. I'm sure other routers have the same type of functionality. Dyndns will keep track of your ip address and allow you to associate it with a free host name. Afterwards, configure your router to allow port 80 (or port 443 if you are running a secured site) to be passed to a specific machine behind your router. You could purchase a domain name somewhere like GoDaddy.com . they're cheap. You can configure your newly purchased domian name as described in this forum.

These instructions are written for MyDomains.com and Dyndns.org, but they could certainly apply to other similar services. 1. Purchase a domain name, and verify your account at the registrar. You will need to be able to login to your account to change the nameserver ip addresses. For our example we will use the name: myhost.com 2. Login to your account at your registrars (where you bought your domain name) and locate info on changing the nameservers. You will need to access this information and change your nameservers to: Continue reading “Host your own site from your dynamic ip”