php

Finishing the eee-box installation

It’s been a while since I blogged about the installation of my eee-box – and my intention to use it as a server.

Of course, I did some basic installation in the meantime – and the box is now running perfectly. :)

So – here’s the final chapter in this two-part series, and a list of everything I did to get the box up and running:

Basic tools

The first thing I missed was my good old vim – easy:

sudo apt-get install vim

did the trick. :)

I then made sure that updates happen automatically – there’s a good page on that in the serverguide, and all I had to make sure was that mailx was installed. Logwatch is also an option – but only after a mailsystem is up and running (see below).

Web-Stuff

MySQL installation was pretty easy: I followed the server guide’s page on this, and then created also /etc/mysql/conf.d/charsets.cnf (Download here) – this helped me get rid of some UTF8-errors on my old gentoo box already…

I then made the mysql server accessible from the outside by adding

bind-address my.ip.addr.ess

into /etc/mysql/my.cnf, then following this excellent website that explains everything on how to remote access a mysql database.

After that, I installed apache2 – again, the server guide’s page on that subject includes everything necessary. The guide’s page on PHP also has a lot of good information – I ended up installing php5, libapache2-mod-php5, php5-cli and php5-mysql. Finally, I created a phpinfo.php and deleted index.html, in /var/www.

For the usage of automatic WordPress updates, I also installed an ftp-server – again, just followed the server guide. In WordPress, when installing a plugin, I then have to enter “localhost” plus my local user name plus the corresponding password, whenever it asks for a connection information.

Finally, I installed mediawiki; the packages to install were mediawiki, mediawiki-math, imagemagick and php5-gd; the installation itself is again covered in the server guide.

After the configuration of mediawiki (make sure you use the old backward-compatible charset!), I enabled TeX and uploads and moved my old mediawiki according to my own blog entry (hey – they start to come in handy!!)

For some reason, I had to change the password of my mediawiki admin user after that – luckily, I found this blog entry… and then, I installed the cite extension – again, I followed my own guide on doing so. :)

Samba

For Samba, the installation was really easy; the corresponding page on the ubuntu server guide explains everything needed. All I had to do was to smbpasswd my working user – and everything worked. While I now have a nice NAS, I still wanted to be able to access my home share from outside – mainly due to filesharing, see below.

Mailserver

The mailserver is always a little tricky; I decided to go with dovecot, postfix, procmail and getmail. I started with dovecot (only use the instructions relating to dovecot, not the ones relating to postfix!), and for a proper postfix installation, I closely (!) followed this doc (also, I had to install procmail in order to get over this flawlessly). I created an alias for root pointing to my working user, as explained here. And finally, I installed getmail, as explained on howtoforge.

It took me three attempts – but following these documents in the given order should do it.

Filesharing

While I obviously know that filesharing involves a lot of illegal (or at least…. grey) activities, I still use it – how to get an ubuntu ISO file faster than via bittorrent? Not to speak of all the great american tv shows that you just can’t watch around here (not even DVD’s are available, sometimes….) – so, I still rely on bittorrent and, sometimes on mldonkey. The basic instructions I noted down a while ago were useful, when it came down to configuring mldonkey (it’s config files are in /var/lib/mldonkey…)

As for bittorrent, I highly recommend to go with devinw’s installer package that installs lighthttpd, rtorrent and wtorrent – it’s in the ubuntu forums and it worked after a couple of problems – read the forum entry in case of troubles!

Backup system

I then installed rsnapshot and configured it, following the work I did a while ago.

Upgrade to 9.04

Final step was to update to 9.04 – there is a good instruction provided by the canonical folks on how to do so.

The box now runs for something over 2 months – no problems, AT ALL! :)

Maybe I’ll go ahead and try some anti-spam solution, once again…. :)

Share and Enjoy:
  • Digg
  • Twitter
  • del.icio.us
  • Facebook
  • Technorati
  • MySpace
  • StumbleUpon

Creating the “BlueMonday” theme – Part 03

This entry is part 3 of 7 in the series Creating the BlueMonday Theme

Today we start coding the site. We turn away from the design and go down to the bottom of every WordPress theme – the Loop.

I switched to blip.tv for hosting my files – as they start to get pretty large these days…. hope everything works fine for everybody!

Links from this episode:

Share and Enjoy:
  • Digg
  • Twitter
  • del.icio.us
  • Facebook
  • Technorati
  • MySpace
  • StumbleUpon

php-, Java-, VBA confusion

6.10.07, 16:56 | Tags: ,,,, | No comments

It’s getting more and more difficult for me, really. For business reasons, I sometimes do some Excel VBA macros. VBA is pretty straightforward and quite easy.

For my studies, I am again enrolled in a Java course. Now, Java is a beautiful language, but sometimes quite strict and therefore not always straightforward.

Finally, I often do some PHP hacks – like now, I am currently trying to develop my first WordPress widget.

PHP / Java / VBA: Although both PHP and VBA are script-like languages, and although both VBA and Java are object-oriented, I almost went mad today – until after 2 hours or so I remembered that in PHP, to concatenate two strings, you use the dot-operator . – while in Java, you can use +, and in VBA I think it’s &.

What a mess! I am totally lost on this…. It will be funny when I have to write my next Java examination – I will probably do no VBA and no PHP for the two months before it….

Share and Enjoy:
  • Digg
  • Twitter
  • del.icio.us
  • Facebook
  • Technorati
  • MySpace
  • StumbleUpon

Mediawiki, Apache, MySQL

The most important piece of software that I need to get up and running is mediawiki – and for this, Apache, PHP and MySQL have to work properly. So, the task this time is to get this up and running!

The first part is MySQL – there is a nice Gentoo Wiki entry on this, which I follow – including the steps on configuring MySQL and securing it. To make sure that my installation is as secure as possible, I have a look at the Gentoo Security Handbook – there is a section about MySQL. In order to correctly bring back my old mediawiki database (see below), I had to do the following:

  • compile mysql with the latin1 use flag (add “dev-db/mysql latin1″ in package.use)
  • make sure that all the default-character-set entries in /etc/mysql/my.cnf are saying latin1 (“default-character-set=latin1″)
  • Add this to /etc/mysql/my.cnf: [php-apache2handler]
  • …followed by this: default-character-set=latin1(thank good for this forums entry!!)

Next part is Apache. It is already emerged, so we tweak security, again according to the appropriate section in the Gentoo Security handbook. These settings are altered in /etc/apache2/httpd.conf:
ServerSignature off
Also, we search for the term “Options” in this file and add -Indexes wherever it occurs; example: We turn the line
Options FollowSymlinks
into
Options -Indexes +Followsymlinks
The same is done in the file /etc/apache2/vhosts.d/00_default_vhost.conf
We remove the index.html file from /var/www/localhost/htdocs and add a .htaccess file with the following content:
Options -Indexes
This prevents the box from revealing too much information about itself.

The next pieces of software to emerge are phpMyAdmin and Mediawiki; we want the latest version on both, so we add them to package.keywords; also we add the use-flag “math” for www-apps/mediawiki into package.use; then, we emerge (note that this pulls tetex onto the box…)

phpmyadmin is configured quite easy: The config.default.php file in the libraries directory needs to be copied to phpmyadmin’s main directory and renamed to config.inc.php – and inside, a user has to be set up.

mediawiki is a little bit more trickier to configure. We surf to server/mediawiki and configure – with the same settings that were used on the old environment! In the file LocalSettings.php, we uncomment the following lines:
$wgDisableUploads = false
$wgUseTeX = true

For the backup- and restore-scripts to work, we need a file called AdminSettings.php with chmod 644 in /var/www/localhost/htdocs/mediawiki with this content:
$wgDBadminuser = 'root';
$wgDBadminpassword = 'mypassword';

OK, now we can put our old mediawiki data back in! The data can be exported using these commands:
mysqldump --user=root -p wikidb > wikidb.sql
tar -cjf zuhausewiki-images.tar.bz2 /var/www/localhost/htdocs/mediawiki/images/

The resulting two files (tar and sql) need then to be copied over to the new server.
Then, we copy the whole images-directory from the tarball into the new mediawiki directory (thus becoming mediawiki-somenewname/images). And we import the sql back with
mysql --user=root -p -B wikidb < wikidb.sql
In the maintenance directory, we then run the rebuildall script:
php ./rebuildall.php
(note that pagecount should be greater than 1496!)

Also, I had tedious collation issues with mysql. See above on how to prepare mysql for them; I used phpmyadmin to make sure that the collation on all tables and columns is set to latin1_bin – I had to change quite some entries; also make sure that the wiki database itself has collation latin1_bin. Having all this changed, the mediawiki was up and running.

Share and Enjoy:
  • Digg
  • Twitter
  • del.icio.us
  • Facebook
  • Technorati
  • MySpace
  • StumbleUpon

Head Rush Ajax

12.06.06, 12:25 | Tags: ,,,, | No comments

I’ll start my book-blog with a Web2.0 book (makes kinda sense, or does it?)
When I was approached to create a website once more (I did my last back in 2001) I thought that I can’t rely on HTML, CSS and some basic PHP/MySQL any more – with all this web2.0 stuff around. So, what to do?
I went to my favourite book-store (this time, it was not amazon…), and found a book called “Head Rush Ajax“.
Well – I never read a book like this one. However many stars I would have to rate it, I would give them to this book – because it’s simply one of the best educational books I have ever encountered. Its style is fresh (but not “hey-guys-look-how-cewl-I-am”), it’s layout is terrific (but not “lets-see-how-many-pictures-I-get-on-one-page”) and the educational effects are just great. There are only 7 chapters – but you learn everything about all this web2.0 tools, starting from asynchronous requests involving JavaScript, going on to some cool DOM-stuff and ending with JSON and XML (by the way, this book opened my eyes regarding XML – I finally got the point about it. :)
Now, there is no reference – and sometimes, PHP and Javascript (of course, as well as CSS and HTML) is just used without further explanations (ok, sometimes there actually *are* explanations, but not as in-depth as some people might wish). But then, this book is no reference and no “teach-me-PHP-or-javascript” – it’s “teach-me-AJAX”. And that’s what it does.
I just notice that I can’t really describe the visual and textual style of this book (and it *is* still a workbook – there are exercises, but they were the first exercises in books like these I actually completed) – you might want to look at headfirstlabs.com for an impression.
As already said: n stars out of n!

Share and Enjoy:
  • Digg
  • Twitter
  • del.icio.us
  • Facebook
  • Technorati
  • MySpace
  • StumbleUpon