Install WordPress

So… you want have your voice on the internet.

The easiest way to do that is to host your site on one of the many web-hosting companies around…
… but that costs money and you will have learned nothing.

Having your own web-server eliminates the hosting costs and will give you total control over it’s content and behavior.
And we Slackers are big fans of total control.
Also, it’s a fun learning experience.

As I said before, this site is done with WordPress, which is a great tool for people (like me) who understand little or nothing about html, java and php.

We will now learn how to install WordPress on your very own server.

The first step, is to have installed and configured a LAMP server, which will serve as a back-end for our WordPress site.

First, create a new database and user so your future WordPress can store content.

mysql -u root -p
# insert the mysql's root password and you'll go into the mysql prompt

mysql> create database mysite;
mysql> grant all privileges on mysite.* to mysite@"localhost" identified by 'somepassword';
mysql> fush privileges;
mysql> quit

Next, download WordPress and place it on your custom directory and set ownership.

cd /srv/www/
wget http://wordpress.org/latest.tar.gz
tar zxvf latest.tar.gz
mv wordpress mysite.com
chown -R apache:apache /srv/www/mysite.com/

Last step is to setup WordPress to work with the database you created.

Rename the sample config file

mv /srv/www/mysite.com/wp-config-sample.php /srv/www/mysite.com/wp-config.php

Now, use nano to edit file /srv/www/mysite.com/wp-config.php like so

/** The name of the database for WordPress */
define('DB_NAME', 'mysite');

/** MySQL database username */
define('DB_USER', 'mysite');

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

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

Finaly, restart your webserver…

/etc/rc.d/rc.httpd restart

…and point your browser to the install script at http://mysite.com/wp-admin/install.php and follow instructions.

Enjoy your new WordPress server.

Install and configure a LAMP server

A minimal install of Slackware is very nice and slim, but will not actually do much, as is.

So, let’s expand it

This page is done with WordPress, and is hosted on a VM running a minimal Slackware + apache, mysql and php (the famous LAMP server).

So, as an example, we’re going to make a LAMP server out of our base system and use this new system as our back-end for WordPress.

As usual, all the steps not mentioned here are beyond the scope of this post.
Also, I assume you already have some registered domain (I’ll use mysite.com in this example) or even a free dynamic dns service to get something like mysite.dyndns-blog.org configured in your home DSL router.

So, let’s build our LAMP server!

The best way to do that, is using slackpkg.

First, let’s configure slackpkg by uncommenting a mirror from the /etc/slackpkg/mirrors file (since we have a Slackware 13.1 minimal system, we’ll need a Slackware 13.1 mirror).
You can use nano to accomplish this.

nano -w /etc/slackpkg/mirrors

After you do that, update the available package database with

slackpkg update

Now, you can use the template I prepared earlier, to make this quicker

cd /etc/slackpkg/templates/
wget http://cybercenter.com.pt/slack-minimal/slackpkg-templates/LAMP-server.template
slackpkg install-template LAMP-server

That’s it.
You have a LAMP server installed!

You will have to configure your new LAMP server

First, make the init scripts for mysqld and httpd executable, like so

chmod a+x /etc/rc.d/rc.mysqld /etc/rc.d/rc.httpd

Now, initialize mysql databases

chown -R mysql:mysql /var/lib/mysql/
mysql_install_db --user=mysql

Start mysql and assign a password to the ‘root’ user

/etc/rc.d/rc.mysqld start
mysqladmin -u root password 'somepassword'

And that takes care of the mysql stuff.

Moving on to the webserver itself (apache).

You will need to uncomment the following lines in /etc/httpd/httpd.conf (you can use nano for that).

  • #Include /etc/httpd/extra/httpd-vhosts.conf
  • #Include /etc/httpd/mod_php.conf

Both lines should be near the end of the file and are easy to find.

Next, change the the following section

<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>

To look like this

<IfModule dir_module>
    DirectoryIndex index.html index.php
</IfModule>

Now, use nano to change the /etc/httpd/extra/httpd-vhosts.conf file into something like this

NameVirtualHost *:80

<VirtualHost *:80>
    DocumentRoot "/srv/httpd/htdocs"
</VirtualHost>

<VirtualHost *:80>
    <Directory "/srv/httpd/mysite.com">
        Options Indexes FollowSymLinks
        AllowOverride None
        Order allow,deny
        Allow from all
    </Directory>
    ServerName mysite.com
    DocumentRoot "/srv/httpd/mysite.com"
    ErrorLog "/var/log/httpd/mysite.com-error_log"
    CustomLog "/var/log/httpd/mysite.com-access_log" common
</VirtualHost>

Finaly, point your browser to http://mysite.com and you should be able to see the apache server test page.

That’s it!
Enjoy your new LAMP server.