Archive for the ‘Linux’ Category

Install PostgreSQL on OpenSuse 12.1

February 6th, 2012 | admin

First,

$sudo zypper install postgresql postgresql-server pgadmin3

Start server

$sudo rcpostgresql start

Change password for postgres user

$sudo postgres -c psql postgres
ALTER USER postgres WITH PASSWORD 'postgres';
\q

Error!

“IDENT authentication failed for user”

Hence, if you do not use IDENT, edit the /var/lib/pgsql/data/pg_hba.conf file and change “ident” to “md5″. Say, for instance, the lines below

local all all ident
host all all 127.0.0.1/32 ident
host all all ::1/128 ident

to

local all all md5
host all all 127.0.0.1/32 md5
host all all ::1/128 md5

Once done,restart postgreSQL as follows:

opensuse:~ # rcpostgresql restart

Create and Delete users

To create an user

opensuse:~ # su postgres

postgresql@opensuse:~> createuser -D

for user with password

postgresql@opensuse:~> createuser -D -p

To delete user

postgresql@opensuse:~> dropuser





Installing Oracle (sun) Java 1.7u2 openSUSE 12.1

February 6th, 2012 | admin

Download the RPM version of Java from www.oracle.com (in my case I downloaded 1.7u1).

The one I downloaded was: jdk-7u2-linux-i586.rpm

Install the jdk with yast2, zypper, or by double clicking the rpm within dolphin or nautilus:

sudo zypper in jdk-7u2-linux-i586.rpm -y

Now you have to setup the alternatives so you can use switch between Iced Tea, which is default, and the Oracle Java.

First install the alternative:

sudo /usr/sbin/update-alternatives --install "/usr/bin/java" "java" "/usr/java/jdk1.7.0_02/bin/java" 40

Now install the alternative for your browser plugin:

sudo /usr/sbin/update-alternatives --install "/usr/lib/browser-plugins/javaplugin.so" "javaplugin" "/usr/java/jdk1.7.0_02/jre/lib/i386/libnpjp2.so" 40

Note: the first quotes are pointing to the path, the the name of the alternative script, and the 3rd is the location to point to. The numbers at the end is the priority in case it was set to automode.

Now you have to configure the alternatives, first we’ll do java:

sudo /usr/sbin/update-alternatives java

Choose the number associated with /usr/java/jdk1.7.0_01/bin/java, in my case it was 1.

Now lets configure javaplugin:

sudo /usr/sbin/update-alternatives javaplugin

Choose the number associated with /usr/java/jdk1.7.0_01/jre/lib/i386/libnpjp2.so, in my case it was 1.

First, for the haters. I do linux for a living on servers, so I’m used to sudo, and that’s why I use it on my laptop.

Second, also for the other haters. Yes, I could have added some super high priority and kept it on auto, but I like doing it manually.

For the rest, you can check to see what you currently have set by running:

/usr/sbin/update-alternatives --query (or --display) java (or javaplugin)

You can test your java at oracles website: