Monday, March 1, 2010

Adding Key to Ubuntu

Sometime when you do apt-get update, ubuntu will complain about key not available. For example
...
Fetched 69.7kB in 50s (1,388B/s)
Reading package lists... Done
W: GPG error: http://ppa.launchpad.net karmic Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 5A9BF3BB4E5E17B5
$

To solve the error, you just need to install the key using this command
sudo apt-key adv --recv-keys --keryserver keyserver.ubuntu.com <public key number>

Change public key number with the one ubuntu complained. In this example it would be 5A9BF3BB4E5E17B5.
$sudo apt-key adv --recv-keys --keryserver keyserver.ubuntu.com 5A9BF3BB4E5E17B5
Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /etc/apt/secring.gpg --trustdb-name /etc/apt/trustdb.gpg --keyring /etc/apt/trusted.gpg --recv-keys --keyserver keyserver.ubuntu.com 5A9BF3BB4E5E17B5
gpg: requesting key 4E5E17B5 from hkp server keyserver.ubuntu.com
gpg: key 4E5E17B5: public key "Launchpad PPA for chromium-daily" imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
$

Continue with update.

Wednesday, February 24, 2010

Install PostgreSQL8.4 in Karmic

From terminal type
$sudo apt-get install postgresql
answer yes to all questions.
You may also want to install pgAdmin III. It good tool to manage PostgreSQL especially if you are a beginner. In terminal type
$sudo apt-get install pgadmin3
again, just answer yes to the questions.
To begin using postgre, you need to set postgre user password.
$sudo -u postgres psql postgres
enter your password.
psql (8.4.2)
Type "help" for help.


postgres=# \password postgres
Enter new password:
Enter it again:
postgres=# CREATE DATABASE database_name;
CREATE DATABASE
postgres=# \quit
done. Refer to https://help.ubuntu.com/community/PostgreSQL for complete tutorial.

Display Services Running on Linux and Their Port

In linux, you can easily check which services are running and their corresponding port. Use command
$ cat /etc/services
Pipe it to grep to get particular program, instead of browsing the results. For example, to search which port Postgre running you use
$ cat /etc/services | grep postgre

postgresql  5432/tcp   postgres   # PostgreSQL Database
postgresql  5432/udp   postgres
$
You can see that postgresql is listening to port 5432. Of course there are many other ways around. This is just one of them.
 

DZone.com

Engadget