Monday, July 23, 2007

Stunning icon theme

Yesterday I installed a new icon theme in gnome. I'm very happy with it.

It's beautifully done, and very complete. The artist has obviously taken a long time in construction.

I don't normally play around with icons, yet I've been having trouble looking at the Ubuntu orange all the time. This is a very nice change.

The theme is called: AER-OS-XK. It's 58.96 MB. You can download it at gnome-look here: AER-OS-XK

Installing the theme
First download it. Now open Theme preferences (in Ubuntu click on: System / Preferences / Theme). In Theme preferences click the Customise Button on the right.
In the new windows that opens select the Icons tab at the top. Then click install, navigate to where you downloaded the AER-OS-XK.tar.bz2, and select it.
It will take a long time to install, as there are many icons. Yet I think it is worth it. I'm enjoying using them. I hope you do too.

Sunday, July 22, 2007

New Blog, and new theme

If you have been wondering what I have been upto...
Come and check out my new Blogger theme. I have been busy creating it over the past couple of days. I'm really happy with it. There are still a couple of niggling things that I will look into. Yet overall I really like it.

I have also been preparing another blog: Of Tea and Turtles. This is going to be my personal blog. Of TnT will be about my personal development, opinions, thoughts, links, music, health and other things non computer related.

I have been getting annoyed having to mix information and technical howto's with with my personal thoughts and notes.
Hopefully this will make things easier for you and me.

Therefore the focus on Geekybits³ will now just be Computer related.

Wednesday, July 11, 2007

Installing Wordpress on OpenBSD

To install Wordpress in OpenBSD you need to have a web server, (e.g. Apache) with PHP and a MySQL database.
OpenBSD already comes with Apache. Therefore we only need to install and configure MySQL, PHP and Wordpress.

Starting the Apache (httpd) server
To start Apache from boot edit /etc/rc.conf and change this line:
httpd_flags=NO
To read:
httpd_flags=""
For more information see my tutorial how to start the Apache (httpd) server.

Now reboot then test that Apache is working.
NOTE:
I don't like moving on to the next step until each step works. Then if there is a problem I know what was working last, and where the problem is likely to be.

Installing MySQL Database Server
To learn how to install, and configure MySQL to work inside of chrooted Apache please see my tutorial: Installing MySQL Database Server.

Now test that MySQL is working.

Creating a Database in MySQL for Wordpress
After installing, and configuring MySQL we need to create a database and a database user for Wordpress.
I will call my Wordpress database: wordpressdb, My user: kris and my password: new-password. Please change these to suit your situation.
# mysql -u root -h localhost -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> CREATE DATABASE wordpressdb;
Query OK, 1 row affected (0.04 sec)

mysql> GRANT ALL ON wordpressdb.* TO kris@localhost IDENTIFIED BY 'new-password';
Query OK, 0 rows affected (0.02 sec)

mysql> SHOW DATABASES;
+-------------+
| Database ---|
+-------------+
| wordpressdb |
| mysql ------|
| test -------|
+-------------+
5 rows in set (0.02 sec)

mysql> \q
Bye


Installing Wordpress
Once you have finished creating a MySQL database we can install Wordpress. I'm going to use pkg_add(1)'s interactive mode (-i) so that I can choose which version of wordpress I want to install:
# export PKG_PATH=ftp://ftp.nara.wide.ad.jp/pub/OpenBSD/4.1/packages/i386/
# pkg_add -i wordpress

Ambiguous: choose package for wordpress
0:
1: wordpress-2.0.7
2: wordpress-2.2.1
Your choice: 2
wordpress-2.2.1:libiconv-1.9.2p3: complete
wordpress-2.2.1:expat-2.0.0: complete
wordpress-2.2.1:gettext-0.14.6: complete
wordpress-2.2.1:libxml-2.6.26p0: complete
wordpress-2.2.1:php5-core-5.1.6p1: complete
wordpress-2.2.1:php5-mysql-5.1.6p2: complete
wordpress-2.2.1: complete


Configuring php5
Before we can use Wordpress we need to configure php for use inside of the chrooted Apache: in /var/www/. To do this I ran the following commands:
# /usr/local/sbin/phpxs -s
# cp /usr/local/share/examples/php5/php.ini-recommended /var/www/conf/php.ini
# chown root:www /var/www/conf/php.ini
# chmod 640 /var/www/conf/php.ini
# mkdir /var/www/tmp


Now enable the php MySQL module:
# /usr/local/sbin/phpxs -a mysql

Lastly we need to inform Apache that we have PHP installed, by editing the httpd.conf file and add the following:
# vi /var/www/conf/httpd.conf
LoadModule php5_module /usr/lib/apache/modules/libphp5.so

AddType application/x-httpd-php .php .php4 .php3 .htm .html
AddType application/x-httpd-php-source .phps

Now edit the DirectoryIndex line in httpd.conf to read:
DirectoryIndex index.html index.htm index.php index.php5 index.php4 index.php3

Testing php5
# vi /var/www/htdocs/phptest.html
adding
<?php phpinfo() ?>
Now in your browser open the phptest page, e.g. http://www.yoursever.tld/phptest.html

NOTE: It is a really good idea to remove this page once you have tested php, as it could be a security risk.

Configuring Wordpress
WordPress has been installed into /var/www/wordpress, which is not the document root.

You could point this to the DocumentRoot of your web-server:
# ln -s ../wordpress /var/www/htdocs/wordpress
(make sure you use a relative symlink since Apache is chrooted)

However I want to create two blogs. Therefore I shall copy the contents of the wordpress directory into /var/www/htdocs/

Creating blog one
# cp -rp /var/www/wordpress /var/www/htdocs/one
Creating blog two
# cp -rp /var/www/wordpress /var/www/htdocs/two

Now I need to edit wp-config.php in both blog directories, and add the database information in each.
# vi /var/www/htdocs/one/wp-config.php
// ** MySQL settings ** //^M
define('DB_NAME', 'wordpressdb'); // The name of the database^M
define('DB_USER', 'kris'); // Your MySQL username^M
define('DB_PASSWORD', 'new-password'); // ...and password^M
define('DB_HOST', 'localhost'); // 99% chance you won't need to change this value^M


With the second blog I will also change the $table_prefix option, so that I can use the database created above for both blogs:
# vi /var/www/htdocs/two/wp-config.php
// ** MySQL settings ** //^M
define('DB_NAME', 'wordpressdb'); // The name of the database^M
define('DB_USER', 'kris'); // Your MySQL username^M
define('DB_PASSWORD', 'new-password'); // ...and password^M
define('DB_HOST', 'localhost'); // 99% chance you won't need to change this value^M
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');

// You can have multiple installations in one database if you give each a unique prefix
$table_prefix = '2wp_'; // Only numbers, letters, and underscores please!


Now in your browser go to: http://your-server.address.tld/one/wp-admin/install.php. This should set-up the database tables needed for your blog.
NOTE: If there is an error, double check your wp-config.php file, and try again.

Then follow each of the steps on the page. Make sure you note the password given to you.
The install script should then send you to the login page. Sign in with the username: admin, and the password generated during the installation. You can then click on 'Profile' to change the password.

Have fun with your new Wordpress blog.

Tuesday, July 10, 2007

OpenBSD Tip: Installing MySQL Database Server

Installing the MySQL Database Server, in OpenBSD is needed for a number of different applications. Including Wordpress, which is what I have been playing with today.

Installing MySQL
First if you don't have PKG_PATH set then set this first, then install mysql-server. For a package server near you please see: FTP mirrors
# export PKG_PATH=ftp://ftp.openbsd.org/pub/OpenBSD/4.1/packages/i386/
# pkg_add mysql-server

mysql-server-5.0.33:mysql-client-5.0.33: complete
mysql-server-5.0.33:p5-Net-Daemon-0.39: complete
mysql-server-5.0.33:p5-PlRPC-0.2018p0: complete
mysql-server-5.0.33:p5-DBI-1.53: complete
mysql-server-5.0.33:p5-DBD-mysql-3.0008: complete
mysql-server-5.0.33: complete


Configuring MySQL
The mysql-server package doesn't initialize a default database. The following command will create one:
# /usr/local/bin/mysql_install_db

Now we need to temporarily start mysql to set the root access password for the database. Changing 'new-password' to a password of your choosing.
# /usr/local/bin/mysqld_safe &
# /usr/local/bin/mysqladmin -u root password 'new-password'
# /usr/local/bin/mysqladmin -u root -p -h Your-server.name.tld password 'new-password'


Verify the server is running by using the 'fstat' in the following example:
# fstat | grep "*:" | grep mysql
_mysql mysqld 29321 15* internet stream tcp 0xd6121af4 *:3306

To start MySQL from boot, edit /etc/rc.conf.local:
# vi /etc/rc.conf.local
adding:
mysql=YES
Then edit: /etc/rc.local:
# vi /etc/rc.local
After the 'starting local daemons' and before the following echo '.' Insert the following into the /etc/rc.local file:

if [ X"${mysql}" == X"YES" -a -x /usr/local/bin/mysqld_safe ]; then

echo -n " mysqld"; /usr/local/bin/mysqld_safe --user=_mysql --log --open-files-limit=256 &

for i in 1 2 3 4 5 6; do
if [ -S /var/run/mysql/mysql.sock ]; then
break
else
sleep 1
echo -n "."
fi
done
#
# Apache chroot Settings

mkdir -p /var/www/var/run/mysql
sleep 2
ln -f /var/run/mysql/mysql.sock /var/www/var/run/mysql/mysql.sock

#
# Postfix chroot Settings
if [ "X${postfix_flags}" != X"NO" ]; then
mkdir -p /var/spool/postfix/var/run/mysql
sleep 2
ln -f /var/run/mysql/mysql.sock /var/spool/postfix/var/run/mysql/mysql.sock
fi

fi

Now every time you restart; the machine will check to see whether you have enabled mysql in the rc.conf (rc.conf.local) file then start the mysql daemon. To disable mysql we can simply change mysql=YES to mysql=NO

After restarting verify the server is running again:
# fstat | grep "*:" | grep mysql
_mysql mysqld 29321 15* internet stream tcp 0xd6121af4 *:3306

Once the above startup script has worked you can change the mysqld_safe line to something like:
/usr/local/bin/mysqld_safe --user=_mysql --log --open-files-limit=1000 > /dev/null 3>&1 2>&1 &

For more information, and different configurations please see:

Using MySQL
MySQL security
Remove history
The MySQL history file ( /.mysql history), contains all executed SQL commands, even passwords, (which are stored as plain text). We can easily clear the contents of this file:
# cat /dev/null > /.mysql_history

Disable remote access
If you are only going to use MySQL on this server, (i.e. the database will be used only by locally installed applications) then you can disable remote access. MySQL listens on tcp port 3306, we can disable listening on the port by doing the following:

# vi /etc/my.cnf
add:
skip-networking

Improve local security
The next change is to disable the use of LOAD DATA LOCAL INFILE command, which will help to prevent against unauthorized reading from local files.
# vi /etc/my.cnf
add:
set-variable=local-infile=0

Change admin name
It is also recommended to change the default name of administrator’s account (root), to a different, and harder to guess one.

mysql> UPDATE USER SET user='dbadmin' WHERE user='root';
mysql> FLUSH PRIVILEGES;


Now you should have MySQL up and running on your OpenBSD server. Good luck, and have fun.

Sunday, July 08, 2007

OpenBSD Tip: Starting Apache

Apache is included in a basic install of OpenBSD. However it is not running by default. Starting Apache in OpenBSD is really easy. You can start the server manually or automatically.

Automatic: To start Apache every time the computer starts/restarts you need to do the following:

Edit /etc/rc.conf and change this line:
httpd_flags=NO
To read:
httpd_flags="" # note the use of two double-quotes
Then save the changes. When the computer is restarted, the Apache server (httpd) will automatically start.

Manual: To start Apache manually you need to run the following command:
# /usr/sbin/apachectl start
/usr/sbin/apachectl start: httpd started


Testing your Web Server: To test your webserver point your web browser to your servers IP address, or use lynx on the webserver like this:
# lynx localhost

[ lynx displays the following ...]
[OpenBSD]
Apache
It Worked!

If you can see this page, then the people who own this host have just
activated the Apache Web server software included with their OpenBSD
System. They now have to add content to this directory and replace this
placeholder page, or else point the server at their real content.
[ ... cut ... ]
The Document Root directory (the directory where all of the server's web pages are stored) is /var/www/htdocs. You can now place your web pages in this directory.

Virtualization using VirtualBox

For the past couple of days I have been playing around with VirtualBox.

VirtualBox is a family of powerful x86 virtualization products for enterprise as well as home use. Not only is VirtualBox an extremely feature rich, high performance product for enterprise customers, it is also the only professional solution that is freely available as Open Source Software under the terms of the GNU General Public License (GPL).
VirtualBox
For more information please see: About VirtualBox.

VirtualBox 1.4.0 was realised on June 5, 2007 for Windows and Linux. It now contains support for 64bit Linux Hosts, as well as better networking and storage solutions, (for full details please see: Changelog.)

I have tried a earlier version of VirtualBox, but had limited success installing it. The new version installed perfectly.
I used Automatix in Ubuntu 7.04 ("Feisty Fawn") to install it. Yet there are many other binary versions, including a beta version for OS X, (Intel Macs only). For downloads please see: VirtualBox Downloads.

So far I'm very impressed with VirtualBox. In my opinion it's the best virtualization software I have tried to date. I've found it professional, and easy to use. I feel like the programmers have really thought about how to make this a good product from a user standpoint. Also it is OpenSource, what a wonderful bonus.

There are a number of problems, (to be expected with a new piece of software). Yet each time I have gone to write a bug report; the problem has either been fixed and is available in SVN (subversion) or it's currently being fixed. That impressed me.

Unfortunately there is a problem running OpenBSD, and NetBSD as vm's (virtual machines). Yet the issue has been solved in SVN.

I'm running a FreeBSD vm and it is beautiful. I thought I might have trouble as the machine I'm running it on only has 512MB of RAM, however it's been wonderful. I wouldn't recommend any less than 512MB though. When I close VirtualBox it cleans out the RAM amazingly well.

I will write more about it, when I can install some more virtual machines to play with. I'm intrigued to see if DragonflyBSD, and Slackware will work in it.

If you would like information on installing and using VirtualBox please see:You can download VirtualBox here: Downloading VirtualBox.

EDIT: As pointed out by one of my readers VirtualBox is actually released under two licences (dual licensing). There are two versions:
The Open Source Edition (OSE) is released under the GNU General Public License V2 and:
The full VirtualBox package, which is free of charge for personal use or evaluation purposes is released under the Personal Use and Evaluation License.
For more information please see: VirtualBox Licensing FAQ.

Friday, July 06, 2007

A fresh start

Now that I have realised that my lack of confidence isn't because of my own inadequacy, it's much easier to move on. I can't blame anyone else for my low self-esteem. For if I don't have confidence in myself no one else will.

I want to make a fresh start!

My partner and I are going to start our own business. We're heavily researching this topic. We want to go in with our eyes open. Having everything in place before jumping in. I'm so excited. I really think that this is going to be brilliant.

I didn't really want to have a job anyway. I was only after the experience in the industry. Yet after reading this article: 10 Reasons You Should Never Get a Job, I KNOW we can do this.

I have a new found drive to get on with my life. I'm sick of listening to the naysayers the critics. I'll never get anywhere if I keep allowing people to tell me I can't.

Pay no attention to what the critics say. A statue has never been erected in honour of a critic.
~Jean Sibelius
I'm only hurting myself! It will probably take me a while to not look at myself through others eyes. Yet if I don't start trying I will never get anywhere.