Installing wordpress under apache 2

I am writing this post as part of Tero Karvinen’s course: Linux palvelimena (roughly translated: Linux as a server) http://terokarvinen.com/2012/aikataulu-linux-palvelimena-ict4tn003-4-ja-ict4tn003-6-syksylla-2012.

I am using 32-bit Xubuntu 12.10 (Quantal Quetzal) Daily Build October 1st live-environment. First impressions after getting to the desktop: I like the new theme, it’s not only a blue background anymore, the highlighting and the terminal have also received a blue color, as a whole the appearance feels more refined. It also seems that my harddrives are were listed twice (i hit F5 on the desktop to refresh).

On this post I will attempt to go through the following:

  • Install Apache 2
  • Install MySQL database
  • Install phpMyAdmin and create a database which wordpress will use
  • Install wordpress
  • Install a new theme to wordpress
  • Install a new plugin to wordpress
  • Activate permalinks in wordpress

Apache 2 & php support

I started by installing Apache 2, testing it and adding php support and also tested that it worked (Check my previous post to find out how to do this). While I was writing the test html/php page I noticed that nano color codes the html-tags! (EDIT: Easy to read yellow color with php files. Not so easy to read blue color with basic html files)

MySQL server

I started the installation by using the command

$ sudo apt-get install mysql-server

The installer asked me for a password (strong recommended)

If you forget the password you can change it with the following command:

$ sudo dpkg-reconfigure mysql-server-5.5

After the installation was completed, I tested that it worked

$ mysql
mysql> show databases;


+--------------------+
| Database |
+--------------------+
| information_schema |
| test |
+--------------------+
2 rows in set (0.00 sec)

And by writing “exit” I exited MySQL.

phpMyAdmin

To make things easier, I installed phpMyAdmin.

$ sudo apt-get install phpmyadmin

In the beginning of installation, the used webserver will be asked. It might seem that apache2 is defaultly chosen but in reality it is only highlighted. You need to hit space before hitting enter. The picture below shows when apache2 is chosen.

When asked if I want to configure phpMyAdmin, I selected yes. The MySQL administrator password is required before the installer can continue.

Next it asks for phpMyAdmin password, by leaving it blank, the program generated a password for me.

Next I opened the phpMyAdmin page with firefox ( localhost/phpmyadmin )

After logging in I opened the privileges tab and clicked “Add a new User”. As seen on the picture below: I wrote a user name, chose local as host from the drop down menu, clicked the generate a password button and chose the second option to create a database with the same name.

I logged out by clicking the logout button on the top left (small button looking like an opened door) and logged in again to test the new user I had created.

I tested the same thing with MySQL:

$ mysql -u samuelwp -p
(-u user -p password) The password will be entered after hitting enter

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| samuelwp |
| test |
+--------------------+
3 rows in set (0.00 sec)

WordPress

I created a new folder for wordpress under public_html and moved in it.

$ mkdir wordpress
$ cd wordpress/

and downloaded the latest release of wordpress (as a tar.gz) from http://wordpress.org/download/

I copied and extracted the file

$ cp /home/xubuntu/Downloads/wordpress-3.4.2.tar.gz .
(the last dot is for the current folder)

$ tar -xzf wordpress-3.4.2.tar.gz

I opened WordPress’ address with firefox and proceeded with the installation

The database name and username are the same. After filling the username and password fields and editing the prefix (changing the Table Prefix is optional but might add security since the default value is changed) I pressed submit.

WordPress installation informed me that it could not create the configuration file so I copied the text and pasted it to a file called wp-config.php inside the wordpress -folder. And clicked the “Run the install” button.

I filled the user data proceeded to install WordPress.

(The site can be found at: http://localhost/~xubuntu/wordpress/wordpress/)

A new theme for WordPress

So now that WordPress is installed I searched for a new theme at http://wordpress.org/extend/themes/ and decided to download a theme called “Toolbox”, unzipped it and moved it to wordpress’ theme folder

$ cd
$ cd Downloads/
$ unzip toolbox.1.4.zip
$ cp -r toolbox /home/xubuntu/public_html/wordpress/wordpress/wp-content/themes/

In wordpress’ Dashboard I opened the Appearance -menu and Clicked “Activate” on the Toolbox -theme

After that I navigated to the site by clicking “Visit Site” from the top by hovering mouse on the site’s title

A new plugin for WordPress

I searched for a new plugin at http://wordpress.org/extend/plugins/ and decided to download a plugin called “bbPress”

I unzipped it and moved it to wordpress’ plugins -folder (/home/xubuntu/public_html/wordpress/wordpress/wp-content/plugins/)

In wordpress’ Dashboard I opened the Plugins -menu and Clicked “Activate” on the bbPress -plugin.

I opened the new Forums -menu and created a new forum and after that I created a new Topic and chose the forum I created as the used forum.

I navigated to the website again to see the new forum. I couldn’t find it so I went back to the dashboard and chose Appearance and Widgets. I added the (bbPress) Forums List to Sidebar 1

Now the Forum can be found at the bottom right corner of the website.

Activating permalinks

In wordpress Dashboard I opened settings and Permalinks and chose “Day and name” -option and clicked Save Changes

WordPress informed me that it didn’t have permission to update .htaccess -file and asked me to copy the configurations in it.

In terminal I moved to the first wordpress folder and created the .htaccess file and pasted the text and saved.

My hello world! post wouldn’t load anymore (Not found). I found out from another student’s blog (http://lyriano.wordpress.com/2012/09/30/kurssitehtava-6-sisallonhallintajarjestelmat-ja-wordpress-asennus/) in the same course who had found the answer to the error. Apparently I had to enable apache2’s rewrite -mod and restart apache 2.

$ sudo a2enmod rewrite
$ sudo service apache2 restart

And the site seems to work again with permalinks. I decided to make a second test by creating a new post in wordpress and by opening them both I noticed that the Permalinks work correcly.

Advertisements

5 thoughts on “Installing wordpress under apache 2

  1. Pingback: Apache 2 performance boost with varnish & YSlow « kontsu

  2. Pingback: Viikko 4 – WordPress « Lauri & Linux = love?

  3. Pingback: Sisällönhallintajärjestelmät | ramitahtinen

  4. Pingback: Apache 2 performance boost with varnish & YSlow | Samuel Kontiomaa

  5. Pingback: Tehtävä 6 – Sisällönhallintajärjestelmät | Linux palvelimena ICT4TN003-12

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