Archive for the 'linux' Category

Install phpPgAdmin on Ubuntu 7.10

Update: These instructions have been tested and work fine in the latest version of Ubuntu (8.04, Hardy Heron).

phpPgAdmin is a web based GUI for administrating a PostgreSQL database server.

Here’s some quick notes on getting it installed easily on Ubuntu 7.10…

In the terminal enter the following:

$ sudo apt-get install phppgadmin

This will set up and install all of the phpPgAdmin packages. It will also set-up and configure Apache and php5 for you too if you haven’t installed these already.

Next we need to create a symlink to phpPgAdmin so that Apache can find it:

$ sudo ln -s /etc/phppgadmin/apache.conf /etc/apache2/conf.d/phppgadmin.conf

Now if you navigate to http://localhost/phppgadmin you should be greeted with the phpPgAdmin screen. If your user account has a PostgreSQL account however, you will be logged in automagically.

Optionally, if you would like to be able to use the phpPgAdmin interface as the default ‘postgres’ administration account,1 you will need to do the following2

$ sudo gedit /usr/share/phppgadmin/conf/config.inc.php

Now find and change the following line

$conf['extra_login_security'] = true;

to

$conf['extra_login_security'] = false;

Save and close gedit. Now all you need to do is restart Apache.

$ sudo /etc/init.d/apache2 reload

Now if you head on over to http://localhost/phppgadmin all should be ready for you.


  1. I am assuming here that you have set-up your PostgreSQL server using my set-up instructions and therefore have a password protected ‘postgres’ account and that logins require passwords. 

  2. Please make sure you have read the above footnote and understand the security implications of allowing this type of access to your database server - if you have not secured your administration accounts, do it now! 

Mount ISO Files With Nautilus

Here’s two short bash scripts that allow you to mount and unmount an ISO image easily within the right-click menu in Nautilus (the file manager in Gnome):

$ sudo mkdir /media/ISO
$ cd ~/.gnome2/nautilus-scripts/
$ gedit "Mount ISO Image"

Now paste this code into the file:

1
2
3
4
5
6
7
8
9
#!/bin/bash
#
for I in `echo $*`
do
foo=`gksudo -u root -k -m "enter your password for root terminal access" /bin/echo "got r00t?"`
sudo mount -o loop -t iso9660 $I /media/ISO
done
done
exit0

Save, and exit gedit.

$ gedit "Unmount ISO Image"

Then paste this code in this file:

1
2
3
4
5
6
7
8
9
#!/bin/bash
#
for I in `echo $*`
do
foo=`gksudo -u root -k -m "enter your password for root terminal access" /bin/echo "got r00t?"`
sudo umount $I
done
done
exit0

Save, and exit gedit. Now finally…

$ chmod a+x *

Now you can mount and unmount ISO files by using the ‘Scripts’ options in the right-click menu. :)

Thanks to the Ubuntu Blog for the information.

Installing Apache and PHP Troubles

I just recently set Apache up on my home server (more on the server at some point in the future), but I was having problems serving up php pages. Every time I tried to access a php based page, Firefox came up asking if I wanted to download a ‘.PHTML’ file!!! :(

Thankfully the answer (like most things with Ubuntu) was found on the Ubuntu Forums

Simply edit the file /etc/apache2/apache2.conf by adding the following line:

AddType application/x-httpd-php .php .phtml

Now php files should be handled by the server in the way that they were intended.

Creating New Accounts in PostgreSQL

Getting a new account set up on PostgreSQL is a simple process…

Create our new user:

$ sudo su postgres -c createuser daz

Then you have to give this new user role a name (I called it daz), and then say ‘y’ to the question “Shall the new role be a superuser?” if you want the user to be an administrator.

Give the user a database password (this does not have to be the same as their unix password):

$ sudo su postgres -c psql
postgres=# ALTER USER daz WITH PASSWORD 'mypassword';
postgres=# \q

Finally, give the new user a database to play with:

$ sudo su postgres -c createdb daz

Pretty straight forward… :)

Install PostgreSQL on Ubuntu 7.10

If you are using the latest version of Ubuntu (8.04 - Hardy Heron), you might find these slightly updated instructions useful.

This quick walk-through are my notes for installing the PostgreSQL database server and the PgAdmin administration application on Ubuntu Linux, and also set up the server so it allows access to other PC’s on your network.

Before we move on, this guide was tested on the current release of Ubuntu Linux, (7.10 - Gutsy Gibbon) and PostgreSQL 8.2, but it should also be applicable to older versions (of Ubuntu and PostgreSQL) and other Debian based distros.

Continue reading ‘Install PostgreSQL on Ubuntu 7.10’

Installing VMware Tools on Ubuntu Gutsy

I’ve just started to play about with the new Ubuntu (7.10 - Gutsy), I have to say that I quite like it - I was a big fan of Feisty and all other Ubuntu releases previously, so this is more of the same good stuff.

As I’m working with VMWare Fusion, the first thing that needs to be done is install the VMWare Tools. This is quite simply done with the following lines in the terminal once you have started your VM and mounted the tools image (Virtual Machine > Install VMWare Tools in the menu):

1
2
3
4
5
6
7
sudo aptitude update
sudo aptitude install build-essential linux-headers-$(uname -r)
cp -a /media/cdrom/VMwareTools* /tmp/
cd /tmp/
tar -vxzf VMwareTools*.gz
cd vmware-tools-distrib/
sudo ./vmware-install.pl

The just accept all of the defaults for the installation package.

Cheers to Ubuntu Tutorials for the info.