Linux palvelimena – Homework 6 – WordPress

Week 6 – WordPress

The sixth week had us install and configure WordPress

Course homepage: http://terokarvinen.com/2012/aikataulu-%E2%80%93-linux-palvelimena-ict4tn003-3-ja-ict4tn003-5-kevaalla-2012

Sources used:

http://codex.wordpress.org/Using_Themes

http://wordpress.org/support/topic/solved-permalinks-working-in-apache2-ubuntu-1010

Assignment

Use a live CD for a fresh experience

Install WordPress
Enable PermaLinks
Install a theme of your choosing
Install a plugin of your choosing

Environment

I’m using Ubuntu 12.04 @ Virtualbox. I loaded an old snapshop in order to emulate a clean installation from a live CD. (I opted for Virtualbox to get a shared clipboard between Ubuntu and Windows.) Username is ‘antero’ during the whole exercise, seeing as how I didn’t create a separate user for WordPress.

Prerequisite steps

Time to install LAMP. Install apache2 (with mods userdir, php5 and rewrite), mysql-server and php5 and phpmyadmin. For this week’s report, I’m going to omit the usual installation logs for better readability, and concentrate on essential steps. Also, I decided to drop the “let’s/we” narrative. Also, I enable ufw before installing any servers.

Long story short:

antero@VirtualBox:~$ sudo ufw enable

antero@VirtualBox:~$ sudo apt-get install apache2
antero@VirtualBox:~$ sudo apt-get install php5

antero@VirtualBox:~$ sudo a2enmod userdir
antero@VirtualBox:~$ sudo a2enmod php5

antero@VirtualBox:~$ sudo service apache2 restart

antero@VirtualBox:~$ sudo apt-get install mysql-server
antero@VirtualBox:~$ sudo apt-get install phpmyadmin

About phpmyadmin:

I think I ought to enable php for userdir, by commenting out the appropriate lines in /etc/apache2/mods-available/php5.conf:

<IfModule mod_php5.c>
    <FilesMatch "\.ph(p3?|tml)$">
        SetHandler application/x-httpd-php
    </FilesMatch>
    <FilesMatch "\.phps$">
        SetHandler application/x-httpd-php-source
    </FilesMatch>
    # To re-enable php in user directories comment the following lines
    # (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
    # prevents .htaccess files from disabling it.
    #<IfModule mod_userdir.c>
    #    <Directory /home/*/public_html>
    #        php_admin_value engine Off
    #    </Directory>
    # </IfModule>
</IfModule>

Time to log in to phpmyadmin with root and the password given during install. Then, Privileges -> Add new user. I enter the information shown in the following screenshot, and make sure that “Create database with same name and grant all privileges” is checked. After clicking “Create user” I close phpmyadmin.

Provided I haven’t made a mistake somewhere, I should be all set for installing WordPress.

Installing WordPress

I download the latest WordPress archive:

antero@VirtualBox:~/public_html$ wget http://wordpress.org/latest.tar.gz

I extract the downloaded file with the built-in archive manager, File Roller, in the graphical file manager. It extracts to public_html/wordpress, which I deem satisfactory. If I recall correctly, the tar.gz includes proper permissions, so I won’t have to modify those. We’ll see.

antero@VirtualBox:~/public_html/wordpress$ ls
index.php        wp-admin              wp-config-sample.php  wp-links-opml.php  wp-settings.php
license.txt      wp-app.php            wp-content            wp-load.php        wp-signup.php
readme.html      wp-blog-header.php    wp-cron.php           wp-login.php       wp-trackback.php
wp-activate.php  wp-comments-post.php  wp-includes           wp-mail.php        xmlrpc.php

I moved the wp-config-sample.php to wp-config.php, which in retrospect was less handy than using cp.

antero@VirtualBox:~/public_html/wordpress$ mv wp-config-sample.php wp-config.php

I then filled in the proper values:

Time for first run, then. I open http://localhost/~antero/wordpress. Lo and behold:

I call my site ‘Fenix Funk’, username ‘admin’ and the password is omitted in this report. I also enter my secondary e-mail address and make sure “Allow search engines to index this site” is checked.

Result:

Enabling nice permalinks

Permalink Settings are easily found, but WordPress says my .htaccess isn’t writable. Instead, it gives me the corresponding settings for the “Month and name” style, so let’s add those.

antero@VirtualBox:~/public_html/wordpress$ nano .htaccess

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /~antero/wordpress/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /~antero/wordpress/index.php [L]
</IfModule>

Well, that didn’t do anything. Googling helps, though. According to http://wordpress.org/support/topic/solved-permalinks-working-in-apache2-ubuntu-1010 I have to a2enmod rewrite (and restart apache2)

antero@VirtualBox:~/public_html/wordpress$ sudo a2enmod rewrite
antero@VirtualBox:~/public_html/wordpress$ sudo service apache2 restart

That’s better! The “Hello World!” post now has a pretty permalink. Witness the magnificence:

Themes

According to http://codex.wordpress.org/Using_Themes I should download themes from http://wordpress.org/extend/themes and save them to wp-content/themes/themename and then enable it from the WordPress control panel. A theme called Montezuma looks nice. Let’s give that one a go.

antero@VirtualBox:~/public_html/wordpress/wp-content/themes$ wget http://wordpress.org/extend/themes/download/montezuma.1.1.3.zip

Previously used method for extracting the archive applies here. The Montezuma theme is now visible in the WP appearance settings:

The next screenshot will have it on display, when we take a look a plugin.

Plugins

Plugins are installed like themes. I found an amusing plugin called “Stargate Quotes” at http://wordpress.org/extend/plugins

According to its description:

This plugin will randomly display quotes from the Stargate franchise on every page of your user dashboard. Based on the Hello Dolly plugin by Matt Mullenweg.

I don’t particularily need it, but it’s probably OK for testing plugins in general.

antero@VirtualBox:~/public_html/wordpress/wp-content/plugins$ wget http://downloads.wordpress.org/plugin/stargate-quotes.1.5.zip

I’ll take a look whether it shows up in the WP settings after extracting.

Yes! Let’s activate it.

Bummer, there’s something wrong with it.

Let’s just activate the included Hello Dolly and call it a day for now:

Advertisements

About a1100320

IT student, musician, gamer. Beep boop.
This entry was posted in Linux palvelimena ICT4TN003-4. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s