sontek ( John M. Anderson )

September 30, 2007

Setting up Postgresql on SUSE

Filed under: Databases, Linux, Postgresql, Programming, SUSE — Tags: , , , — sontek @ 12:54 am

To install postgresql you just need to use the SUSE package manager, either from yast or from zypper:

zypper in postgresql-server
or
yast -i postgresql-server

By default Postgresql on SUSE is setup in ‘ident’ mode, which matches your SQL user with your unix user, so only the unix user ’sontek’ can login to the database with the username ’sontek’. This is great security but is confusing the first time you are setting up the server because you wont be able to login with your user or root.

What you have to do is switch your user to postgres :
su - postgres

and then you will be able to setup your own user account: 
createuser ’sontek’ 

and now your user will be able to login to the postgresql server with your account.

The other issue with ident is now only unix users will be able to connect to your database server, so if you are a programmer and need to write an application that connects to the database you will need to setup a non-ident user. To do this you first need to create a user with a password:

createuser ‘appuser’ –pwprompt -E

This will create a user named ‘appuser’ and will prompt you for a password that will be encrypted.

and then add this line to your /var/lib/pgsql/data/pg_hba.conf file:

host   all        appuser         127.0.0.1/32          md5

This will setup your server to  allow ‘appuser’ to be authenticated via an md5 password. After you modify the pg_hba.conf file you will need to restart postgresql and then you are all set to start working with postgresql on SUSE!

/etc/init.d/postgresql restart

September 29, 2007

Recover locked terminal from dead SSH session

Filed under: Linux — Tags: , — sontek @ 2:21 pm

If you’ve ever been shelled into a server when your connection drops, you would have noticed that your terminal is completely locked up, you can’t even CTRL+C to get out of it. If you would like to save your terminal you can with the key sequence “<ENTER> ~ .”

SSH has a few more key strokes you can use too! To find out which ones are available type “<ENTER> ~?”

it’ll bring up this:

Supported escape sequences:
~. - terminate connection
~B - send a BREAK to the remote system
~C - open a command line
~R - Request rekey (SSH protocol 2 only)
~^Z - suspend ssh
~# - list forwarded connections
~& - background ssh (when waiting for connections to terminate)
~? - this message
~~ - send the escape character by typing it twice
(Note that escapes are only recognized immediately after newline.)

Thanks to Herlo for this tip.

September 28, 2007

Installing SUSE without a CD-ROM

Filed under: Linux, SUSE — Tags: , , — sontek @ 9:16 pm

To install SUSE without a CD-ROM all you need is a USB Drive and the ISO. Grab the ISO and mount it:

mount -o loop /data/operatingsystems/openSUSE\ 10.3\ i386.iso /mnt/temp

now mount your thumb drive, If you don’t know what device your thumb drive is you can run:

dmesg

You’ll see something like:

usb-storage: device found at 5
usb-storage: waiting for device to settle before scanning
scsi 3:0:0:0: Direct-Access Kingston DataTraveler 2.0 1.00 PQ: 0 ANSI: 2
sd 3:0:0:0: [sdb] 1994752 512-byte hardware sectors (1021 MB)

So, my thumb drive is /dev/sdb:

mount /dev/sdb /mnt/thumbdrive

and then copy the files from boot/<arch>/loader to your USB Drive. Then move isolinux.cfg to syslinux.cfg

cp /mnt/temp/boot/i386/loader/ * /mnt/thumbdrive
mv /mnt/thumbdrive/isolinux.cfg /mnt/thumbdrive/syslinux.cfg

and then unmount your USB drive and run syslinux on it.

umount /mnt/thumbdrive
syslinux /dev/sdb

and then you will be able to boot off of your thumb drive and launch the SUSE installer and install from NFS, FTP, CIFS, or your local harddrive. One caveat of this method is that it will now try to install grub onto your thumb drive, so after it boots up the base system into memory, unplug your drive.

This does still change the boot order in which grub detects its drives from. So (hd0,0) is actually going to be your thumb drive, not your first disk. So on your first boot you will have to modify /boot/grub/menu.lst and point it to the right disk.

Powered by WordPress