Thursday, February 08, 2007

Total Backup problems

I've been hastled by the "do_backup already running" error when using 4PSAs Total Backup. It suddenly struck me that this error might be triggered because the remote system is running a backup when the local system is trying to try connecting for storage.

The other problem I had was exponential growth of the backups - the backups were taking backups of the backups!

You need to assign an exclude path if you put the backups in the /home or /var directories as I initially tried. You can't just put them in root either!

Edit the config file: /usr/local/tbackup/paths.cfg
tar_path /bin/tar
md5_path /usr/bin/md5sum
gpg_path /usr/bin/gpg
exclude_path /boot /dev /initrd /lib /misc /mnt /opt /proc /sbin /tmp /rbackup
include_path
tar_debug_file
log_level LOG_INFO
Well at least I've got the root of that problem now!

Friday, February 02, 2007

LDAP revisited

I revisited the LDAP config this morning thinking that if things didn't work, I'd maybe get some help from Dave who left a message on the blog over night.

I reloaded the base config file for phpLDAPadmin and started to add in server information:
server name: My LDAP server
server host: ldap.server.domain.ltd
server port: 389
server base: dc=server,dc=domain,dc=tld
server auth_type: cookie
Then, login via the browser:
Login DN: cn=admin,dc=server,dc=domain,dc=tld
password: blah
And it worked!

As far as getting thunderbird to find the contact details:
Name: obvious
Hostname: obvious
Base DN: ou=personal,dc=server,dc=domain,dc=tld
Port: 389
Bind DN: cn=admin,dc=server,dc=domain,dc=tld
TBird doesn't list the entries, but it you Shift+F, you can find the entries.
Go back to Options, and under Composition->Addressing, select the Directory server.

The autopopulation of the address fields still doesn't seem to work, but I can search and find my contacts, so things are looking up.

Thursday, February 01, 2007

LDAP and thunderbird

I've always hankered after a central db for contacts. I just hate that going from machine to machine means that I can't have a list of people I email regularly and when a system re-install happens, all that data is lost - it's a pain the proverbial.

I decided that I'd give an LDAP installation a try. Why not install an LDAP server on my local webserver and point all my email clients to that? Hmmm...

UbuntuForums
Linux.com
sudo apt-get install slapd ldap-utils
sudo apt-get install db4.2-util
sudo /etc/init.d/slapd restart
You shouldn't have any errors - if you do... stop and pull your hair out (life shouldn't be this tough).

phpLDAPadmin is a web-based GUI for performing LDAP maintenance.

Well, in the end... after several attempts at setting it up, I finally got some data IN... only to find that I couldn't see it in TBird or Evolution. I need to try this again at some other point in the future. Maybe future Ubuntu releases will make this a trivial task! We can only hope so.

Wednesday, January 31, 2007

phpEclipse

I have been look at PHP IDEs for a while now. I'm quite happy playing around with gEdit and having some rudimentary code colouring, but it get confused with PHP and HTML at times and doesn't really work too well when you add in Javascript.

I did use the trial version of Zend Studio 5 for while on a previous incarnation of my system, but an upgrade came and I didn't want to shell out a significant amount of money for an IDE. I'd love to find an open source alternative...

I have tried BlueFish (2/5) and nuSphere (a lot of cash for not as good as Zend) along with other not so impressive alternatives.

Finally I stumbled across phpEclipse and thought I'd give it a go. It seems though, that from other blogs and forums, installation on Ubuntu Edgy is no mean feat. So, armed with google, I set off on another intrepid adventure.

After installing Eclipse and phpEclipse, finding some bugs and searching the internet to find solutions, I became more aware of another project: EasyEclipse.

EasyEclipse:
It does extactly what it says on the tin and a simple download will give you a working copy for Windows, Linux or Mac. I chose EasyEclipse for PHP, but if you have a LAMP server, there is a version for LAMP control too Basically, the different distributions comes with different pre-loaded modules. The PHP one has PHP, SVN, HTMLTidy and many more.

The download is about 130Mb, so takes a wee while, but there is no "install": just run the app and it works. You'll need Java installed and it works with Blackwater (the opensource version) as well as the official Java from Sun.

SVN:
Once downloaded and running, "change perspective" using the menu or the top right button and choose 'SVN repository'. Using the left hand side taskbar, add a new repository (http://www.carrubbers.org/svn/ccc/www) and check out. You'll be asked if you want to create a new project (yes) and asked for the location. For me, with the current apache config the way it was, this was '/home/ccc/'. Once the checkout was compelete, I just needed non-SVN files: images, xml and dbf, along with .ht*, postgres login and symlinks (see the previous post).

PHP browser:
There is a build in browser which seems to work pretty well. You'll need to specify the document_root and localhost vars first:
Window->Preferences:
PHPeclipse...->Project Defaults ->
localhost and document root
If the document_root is wrong, Eclipse seems to think that files that are included by the PHP files are not within the current project and gives errors.

NB: I couldn't find how to use SVN for a while. It's under the Navigator context menu under "Team".

Now I just need to work out how to use the build in apache controls, get SVN icons rather than CVS ones on the navigation pane and see about Postgres control too.

Then there is the task of getting debugging working: DBG is allegedly a good tool to use and natively supported (client side) in eclipse. It's just a case of installing the software server side - I'll try it locally first!

Plesk and Courier IMAP

Seeing "Unable to connect to your IMAP server. You may have exceeded the maximum number of connections to this server" has been driving me insane!

Whenever I add another account to Thunderbird, I have to specify that it can only have one connection to the server per account and even then, if my wife switches on her machine, we have more than the prespecified Plesk maximum of 4 IMAP connections and we start getting errors.

I devided that enough was enough and went in search of a solution. I found it too :o)
perl -p -i -e 's/^MAXDAEMONS=40/MAXDAEMONS=80/g' /etc/courier-imap/imapd
perl -p -i -e 's/^MAXPERIP=4/MAXPERIP=40/g' /etc/courier-imap/imapd
Then a quick restart of the service and all should be working.
/etc/init.d/courier-imap stop
/etc/init.d/courier-imap start
These changes increase the maximum daemons to 80 and Maximum connections per IP to 40. Should be enought for us at the momnet, but may need altered in the future.

Local CCC

Getting a local copy of our website on my Ubuntu box for development purposes:


Local files:

We use svn on our church website as a versioning system and I need a local version for testing and development. First thing is to get a local copy of the repro and then add non-repro files (images etc).
sudo apt-get install subversion subversion-tools
The problem I have is remembering the repro address. Make sure that you're in /home/ccc
svn checkout http://www.carrubbers.org/svn/ccc/www/htdocs
svn checkout http://www.carrubbers.org/svn/ccc/www/userdb
The checkout happens and the path /home/ccc/htdocs/ should be correct. SVN doesn't cope with symbolic links at present - need to add them for pgadmin and lib/v1/

Get the postgres login details for the local filesystem.
Get a copy of the htpwd and htusergroup files.
Get a copy of the /image directory
Get a copy of all the xml and dbf files - they aren't in svn
~$ find -name *.xml | xargs tar rvf xml.tar
~$ find -name *.dbf | xargs tar rvf xml.tar
Apache:
Then comes the setup of apache.
sudo apt-get install apache2
Move the previously saved apache config to /etc/apache2/sites-available/ and enable the setup.
sudo a2dissite 000-default
sudo a2ensite ccc
sudo /etc/init.d/apache2 restart
Then we need to install PHP with dbase.

Postgres:
Finally, comes the addition of postgres - make sure the correct version is installed!
sudo aptitude search postgres
sudo apt-get install postgresql-8.1
sudo apt-get install phppgadmin pgadmin3
The other option would be to get the latest version of phppgadmin and install it in /usr/share/phadmin with a symbolic link from /admin/pgadmin.

Remote:
Connect to the CCC postgres db. Post 5432 is the standard port for postgres communication, but is closed on the CCC server. Set up a tunnel to it, but don't use port 5432 because we'll be running a local server on that port. SSH keys should be in place for passwordless login.
ssh -L5431:localhost:5432 carrubbers.org
Setup pgAdminIII to connect to the remote server using localhost:5431

Local:
Start to setup the local postgres server. First thing is to create a user.
~$ sudo su postgres -c createuser yourusername
~$ sudo su postgres -c psql yourusername
=# ALTER USER yourusername WITH PASSWORD 'yourpassword';
=# \q
Setup pgAdminIII to connect to the local server using localhost:5432


Get a local copy of the postgres database.
~$ pg_dump database_name > database
~$ tar -cf database.tar database
~$ scp database local_machine:

~$ createdb master
~$ tar -xf database.tar
~$ psql -d master
Or, if you need to get the data from the entire server, use:
~$ pg_dumpall -d > pg_server
~$ psql -f pg_server postgres
Irritatingly, it will ask for your password for every transaction. ie., for every database that is dumped!

That should be us done... have a quick test.

Tuesday, January 30, 2007

Plesk 8.1 and awstats

The new version of Plesk (8.1) does seem much nicer to use than 8.01 and has a couple of extra features. One such feature is the inclusion of awstats as standard. Domains are still assigned webalizer by default, but getting awstats is just a drop down box away on the domain setup page.

Once this is done, the stats are available at: www.domain.com/webstat and are viewable using the domain's ftp username and password.

This didn't work for me initially and I just got an error that the system hadn't run the statistics cron and if it didn't work within 24h, to check with my domain admin... that's me! Well, 24h passed and nothing had changed:
/usr/local/psa/admin/sbin/statistics --calculate-one --domain-name=domain.com
After a short wait, the process was complete and a pretty awststa page appeared where it should have been all along. I'll just have to wait and see if a) it updates and b) whether this needs to be done for other domains.