This article, although old, covers the basics. What I find crap is that you need to copy the /usr/share/moin/data and underlay directories into wherever your wiki is going to live.
If you don't do this, moinmoin will helpfully give you an error saying the data directory doesn't exist or has the wrong permissions. In my case, the directory did exist with the right permissions: the problem was it didn't have all the other subdirectories needed that you get from the copy operation. Yay for clear error messages.
Wednesday, January 27, 2010
Thursday, January 21, 2010
Upgrading postgres after an ubuntu dist-upgrade
After an ubuntu dist-upgrade, there is work to be done to bring a new version of postfix online. First you need to (unintuitively) drop the new empty postgres cluster:
Then upgrade the existing cluster (which will create a new one):
It looks like this does a complete duplication of the data, ie. it takes ages. Once it is finished, test it works, and get your diskspace back with:
pg_dropcluster --stop [new version number] main
Then upgrade the existing cluster (which will create a new one):
pg_upgradecluster [old version number] main
It looks like this does a complete duplication of the data, ie. it takes ages. Once it is finished, test it works, and get your diskspace back with:
pg_dropcluster [old version number] main
HOWTO Backup a Postgres database
Easy!
Here's a quick and dirty way to send it over the network compressed. On the postgres box:
And on the backup box:
pg_dump -U username -h localhost dbname > backup_2010_01_22.sql
Here's a quick and dirty way to send it over the network compressed. On the postgres box:
pg_dump -U username -h localhost dbname | gzip -1 | nc -q 2 backup 5000
And on the backup box:
nc -l 5000 > pg_backup_2010_01_22.sql.gz
Quick postgres cheatsheet
You can use '\h' for help on MySQL commands and '\?' for help on postgres commands. '\d' is show tables. It seems to be important that you specify '-h localhost' when logging in - it wouldn't accept my credentials without it.
On ubuntu you need to so the following to get access as 'postgres' (aka root):
Create dbase and user:
General stuff
On ubuntu you need to so the following to get access as 'postgres' (aka root):
sudo -u postgres psql postgres
Create dbase and user:
create database blah;
create user meblah with password 'blah';
grant all on database blah to meblah;
General stuff
psql -U blah -h localhost
\c databasename
\d
select * from tablename;
\q
Wednesday, January 20, 2010
Recovering a deleted file from Subversion
You need to point at the repository, not the checked out copy. Something like:
The '-r' revision syntax doesn't work, you need to use the '@' syntax as above for the revision.
svn copy file:///var/local/svn/myrepo/trunk/files/blah.conf@83 blah.conf
The '-r' revision syntax doesn't work, you need to use the '@' syntax as above for the revision.
Using rsyslog to log with dynamic file names
I wanted to split logs into /host/year/month/host-yyyy-mm-dd_syslog to avoid having to have a rotate rule for each one. The first thing I tried was syslog-ng, which I found difficult to configure. It also had a memory leak that resulted in logs being lost and the box running out of memory.
Now I'm trialling rsyslogd, which looks quite good. Unfortunately it took much longer to configure than I had hoped. I wanted something fairly simple - the split of logs as above, and local logs going to the regular files to prevent any confusion when others need to use the box. The config I came up with was:
The example config for what I wanted to do was wrong. The source is not 'localhost', but whatever the local dns name is ('mybox').
I also had to change $FileGroup to 'syslog' from 'adm' to make it work, even though this shouldn't have mattered. Without this I was getting 'Could not open dynamic file' errors where the file would be created with the right permissions and ownership, but rsyslogd then couldn't write to it.
Now I'm trialling rsyslogd, which looks quite good. Unfortunately it took much longer to configure than I had hoped. I wanted something fairly simple - the split of logs as above, and local logs going to the regular files to prevent any confusion when others need to use the box. The config I came up with was:
$template timeandhost_auth, "/var/log/rsyslog/%FROMHOST%/%$YEAR%/%$MONTH%/%FROMHOST%-%$NOW%-auth.log"
$template timeandhost_syslog, "/var/log/rsyslog/%FROMHOST%/%$YEAR%/%$MONTH%/%FROMHOST%-%$NOW%-syslog.log"
if $source != 'mybox' then ?timeandhost_syslog
if $source != 'mybox' and ($syslogfacility-text == 'authpriv' or $syslogfacility-text == 'auth') then ?timeandhost_auth
if $syslogfacility-text == 'cron' then -/var/log/cron.log
if $source == 'mybox' and ($syslogfacility-text == 'authpriv' or $syslogfacility-text == 'auth') then /var/log/auth.log
if $source == 'mybox' then -/var/log/syslog
if $source == 'mybox' and $syslogfacility-text == 'daemon' then -/var/log/daemon.log
if $source == 'mybox' and $syslogfacility-text == 'kern' then -/var/log/kern.log
The example config for what I wanted to do was wrong. The source is not 'localhost', but whatever the local dns name is ('mybox').
I also had to change $FileGroup to 'syslog' from 'adm' to make it work, even though this shouldn't have mattered. Without this I was getting 'Could not open dynamic file' errors where the file would be created with the right permissions and ownership, but rsyslogd then couldn't write to it.
Monday, January 18, 2010
HOWTO mount a qcow disk image with multiple partitions
To mount a qcow disk image directly you first need to convert it to raw:
Take a look at the partitions using disktype or fdisk -l:
Our first partition is 32 sectors from the beginning, which is an offset of 32 * 512 = 16384 bytes.
Mount it:
qemu-img convert -O raw disk0.qcow2 disk0.dd
Take a look at the partitions using disktype or fdisk -l:
disktype disk0.dd
--- disk0.dd
Regular file, size 11.72 GiB (12583960576 bytes)
GRUB boot loader, compat version 3.2, boot drive 0xff
DOS/MBR partition map
Partition 1: 9.312 GiB (9999007744 bytes, 19529312 sectors from 32)
Type 0x83 (Linux)
Ext3 file system
UUID 4BF80E7C-244E-43EE-BEA5-0A3D97188C68 (DCE, v4)
Volume size 9.312 GiB (9999007744 bytes, 2441164 blocks of 4 KiB)
Partition 2: 1.863 GiB (1999962112 bytes, 3906176 sectors from 19529344)
Type 0x82 (Linux swap / Solaris)
Linux swap, version 2, subversion 1, 4 KiB pages, little-endian
Swap size 1.863 GiB (1999953920 bytes, 488270 pages of 4 KiB)
Our first partition is 32 sectors from the beginning, which is an offset of 32 * 512 = 16384 bytes.
Mount it:
mount -t ext3 disk0.dd /mnt/temp/ -o loop,offset=16384
Subscribe to:
Posts (Atom)