Saturday, January 31, 2009

Config Postgres from binary packages on OpenSolaris

Download binary package from
http://www.postgresql.org/ftp/binary/

Choose package for solaris

Extract package

Open terminal

Point to package folder/bin

Check library link to initdb

#ldd initdb

if you see some line "Find not found", you can find it in /usr/lib

If in /usr/lib not contains that file, you can copy some file latest version back to version required

Initializing DB
#./initdb //data

using PgAdmin 3 login in to db, using current user you logged in.

Good luck!

VNC on Solaris

As Good A Place As Any


Tim Thomas's Blog






Script to Configure VNC Server in Solaris 10 5/08 and Solaris Express (Nevada)
07/09/08 06:07

I have been using a script for a while to configure VNC server displays for Solaris Express (Nevada) and I just found out that the same script works on Solaris 10 5/08 (Solaris 10 Update 5) as it includes Xvnc also.



I always do a full install of Solaris. If you don't, then maybe Xvnc will not be installed on your system. You can easily check:



# pkginfo | grep xvnc
system SUNWxvnc X11/VNC server



You run the below script once after OS installation is complete. It sets up two VNC displays and you connect to them with a VNC client as :1 and :2 . The second display is shared.



#!/bin/sh
#
# config_Xvnc_s10+snv.sh
#
# Run this script once after OS installation is completed.
#
# This has been tested with Solaris 10 5/08 and Solaris Express (Nevada) b87 onwards
#

#add vnc display 1
svccfg -s application/x11/x11-server add display1
svccfg -s application/x11/x11-server:display1 addpg options application
svccfg -s application/x11/x11-server:display1 addpropvalue options/server astring: "/usr/X11/bin/Xvnc"
svccfg -s application/x11/x11-server:display1 addpropvalue options/server_args astring: '"SecurityTypes=None"'

#add vnc display 2, which is shared
svccfg -s application/x11/x11-server add display2
svccfg -s application/x11/x11-server:display2 addpg options application
svccfg -s application/x11/x11-server:display2 addpropvalue options/server astring: "/usr/X11/bin/Xvnc"
svccfg -s application/x11/x11-server:display2 addpropvalue options/server_args astring: '"SecurityTypes=None"'
svccfg -s application/x11/x11-server:display2 addpropvalue options/server_args astring: '"-alwaysshared"'

# Configure dtlogin to start it
if [ ! -d /etc/dt/config ] ; then
mkdir -p /etc/dt/config
fi
if [ ! -f /etc/dt/config/Xservers ] ; then
cp /usr/dt/config/Xservers /etc/dt/config/Xservers
fi

echo " :1 Local local_uid@none root /usr/X11/bin/Xserver :1" >> /etc/dt/config/Xservers
echo " :2 Local local_uid@none root /usr/X11/bin/Xserver :2" >> /etc/dt/config/Xservers

pkill -HUP dtlogin



#End



The displays persist when you disconnect the VNC client, so you can come back to a session at later time and all the windows and applications will be as you left them. Any jobs you kicked off will have continued to run.



You can get VNC client software from http://www.realvnc.com. There is a Free Edition and an enhanced Personal Edition for which you need a license.

VNC on OpenSolaris

VNC is really a good tool for sharing desktops to your remote peers.
The following is my personal experience with VNC on OpenSolaris. I am
running OpenSolaris build 86. It should be the same case in other
builds.


1.
Check the binaries I am using:

$ which vncserver

/usr/bin/vncserver

$ which vncviewer

/usr/bin/vncviewer


2.
I add a new user "vncuser" with "Basic Solaris User" privilege.
(This step is just my personal favor. But it helps you to have a clean
test environment.)

# users-admin


3.
Try the first run.

$ su - vncuser

$ vncserver


Some files will be created in $HOME/.vnc/ directory, including "xstartup".

Connect to the vncserver.

$ vncviewer localhost:1


A VNC desktop window appears.


4.
The default window manager seems not that good. Edit the file
"xstartup" to use JDS desktop. Comment all lines, and add
"gnome-session" to it.

$ cat xstartup

#!/bin/sh


#[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources

#xsetroot -solid grey

#vncconfig -iconic &

#xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &

#twm &

gnome-session


5.
Run vncserver again. This time I specify more options to customize
it a bit. (Check manpage vncserver(1) for details of the options.)

$ vncserver :16 -alwaysshared -deferupdate 100 -geometry 1024x768 -depth 16


Run vncviewer:

$ vncviewer localhost:16


I then see a nice desktop window appears.


BTW, to kill the VNC servers that are run above, just type:

$ vncserver -kill :1

$ vncserver -kill :16

Show process list

Show processes list on OpenSolaris:

ps -ef

Friday, January 30, 2009

Config VNC server OpenSolaris

A Simple VNC Server and GDM Configuration Example for OpenSolaris 2008.05

My requirement was to be able to connect my VNC client to a system running OpenSolaris 2008.05 and to be able to login as root. I have now done this successfully on a system running the original OpenSolaris 2008.05 binary distribution and on a system running OpenSolaris 2008.05 after I ran a full image update to snv_91.

Update September 19th 2008: This procedure does not work if you have updated the image to snv_97 but does work if you update the image to snv_98. The upgrade from snv_97 to snv_98 wiped out the entries I had made in /etc/X11/gdm/custom.conf so I had to make those again. I have added an extra step at the end, based on Chris Drake's comments, to make the VNS server session persist if you exit the client.

1. Check that the VNC Server is Installed

This should be present as it is part of the 2008.05 binary distribution, but I checked anyway.

# pkg info SUNWxvnc
Name: SUNWxvnc
Summary: X11/VNC server
State: Installed
Authority: opensolaris.org (preferred)
Version: 4.1.2
Build Release: 5.11
Branch: 0.91
Packaging Date: Fri Jun 13 17:49:25 2008
Size: 6.3 MB
FMRI: pkg:/SUNWxvnc@4.1.2,5.11-0.91:20080613T174925Z

2. Add this line to /etc/services

vnc-server 5900/tcp # Xvnc

3. Edit /etc/X11/gdm/custom.conf as below

[xdmcp]
Enable=true
[security]
DisallowTCP=false
AllowRoot=true
AllowRemoteRoot=true

4. Enable the Services

# svcadm enable xvnc-inetd
# svcs xvnc-inetd
STATE STIME FMRI
online 16:22:30 svc:/application/x11/xvnc-inetd:default
# svcadm enable gdm
# svcs gdm
STATE STIME FMRI
online 14:43:13 svc:/application/graphical-login/gdm:default

5. Connect to the Display with a VNC Client

You should now be able to connect to :5900 and you should see the gdm login screen.

If you cannot connect, try stopping & starting the services:

# svcadm disable xvnc-inetd gdm
# svcadm enable xvnc-inetd gdm

6. Making the Session Persist

This may or may not be desirable for you, but if you want the VNC session to persist if you exit the VNC client then do the following:

# svccfg -s xvnc-inetd

svc:/application/x11/xvnc-inetd> editprop

This take you into a vi session. Look for the line...

#setprop inetd/wait = boolean: false

Copy the line, uncomment it and set it to true. Save the file, exit svccfg and run the command...

# svcadm refresh xvnc-inetd

Connect again with you VNC client. Now, when you exit/kill the VNC client, the session on the server will persist and you will be able to connect to it again.

You may now want to add an extra level of security to enable password protection on your VNC server. That is something that I have been unable to make work...and from searching around, it seems that others have a similar problem.
Download mp3 codec for GStreamer

http://www.fluendo.com/shop


Etract file fluendo-mp3-7.solaris-intel.tar.bz2

Create new folder .gstreamer-0.10/plugins
Copy all file from codec dir to plugins

That's all

Sound Driver for OpenSolaris

Download it at here

http://www.opensound.com/download.cgi

Good luck!

Install Vietnamese input method with OpenSolaris

Install SCIM from Package Manager (select all - recommend)

Download

http://www.esnips.com/doc/c05f6a11-563e-4906-9c1a-2ed124cb4aae/scim-tables-vietnamese-ext-0.5.6-16-bin.tar

Extract it, then copy 2 file vi.bin and telex.bin into /usr/share/scim/tables

Then reload scim, choose IMEngine/Global Setup/Disable All, then expand Vietnamese, tick VNI or Telex, expand Others, tick English

Then Apply, OK

Open terminal, type:
#gedit .profile

Add the line: export GTK_IM_MODULE=scim

Save file, then log out

Log on again. You can see system tray icon of SCIM

Open inputable application, left click icon SCIM, choose VNI or TELEX

That's ok

Good luck!

Wednesday, January 28, 2009

Check OpenSolaris 32bit or 64bit

isainfo -k

Install GRUB OpenSolaris using LiveCD

Boot from LiveCD

Open terminal

#pfexec format

Note the diskid look like cd : e.g c0d0, c4d0, c5d0....

==>number root disk cd0s0 : c5d0s0, c6d0s0...

#pfexec installgrub -m /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/cd0s0

reboot

done.

Mount partition in OpenSolaris

Mount NTFS / Ext2 / Ext3 / FAT 16 / FAT 32 in Solaris

I often get queries about mounting NTFS / Ext2 / Ext3 / FAT 16 / FAT 32 partions in Solaris . Follow the below steps . Note that its only read-only support for NTFS / Ext2 / Ext3 .

* Download packages
FSWpart
FSWfsmisc

Note these are packages for x86 Solaris .

* unzip the packages and install it

root~#gzcat FSWpart.tar.gz | tar xvf -

root~#gzcat FSWfsmisc.tar.gz | tar xvf -

root~#pkgadd -d . FSWpart

root~#pkgadd -d . FSWfsmisc

* Now run the prtpart tool

root~#/usr/sbin/prtpart

It would result in following output
root~#/usr/sbin/prtpart


Fdisk information for device /dev/rdsk/c1d0p0

Block Size : 512 bytes
Controller : ide
Disk : cmdk
Capacity : 74 GB

# start block # nblocks startCylSecHd endCylSecHd OSType
1: 0000000063 0006152832 0/ 1/ 1 7e/7f/fe Diagnostic
2: 0006152895 0025173855 7f/41/ 0 ff/ff/fe WIN95 FAT32(LBA)
3: 0031328640 0052432128 ff/ff/fe ff/ff/fe Solaris x86
4: 0083760830 0072535555 ff/ff/fe ff/ff/fe DOS Extended

# start block # nblocks startCylSecHd endCylSecHd OSType
5: 0000000001 0031407012 ff/ff/fe ff/ff/fe Linux native
0: 0031407013 0001994202 ff/ff/fe ff/ff/fe DOS Extended

# start block # nblocks startCylSecHd endCylSecHd OSType
6: 0000000063 0001994139 ff/ff/fe ff/ff/fe Linux swap
0: 0033401215 0039134340 ff/ff/fe ff/ff/fe DOS Extended

# start block # nblocks startCylSecHd endCylSecHd OSType
7: 0000000063 0039134277 ff/ff/fe ff/ff/fe WIN95 FAT32(Upto 2047GB)


Now note the disk id. In the above example its "/dev/rdsk/c1d0p0"

Now run

root~#/usr/sbin/prtpart /dev/rdsk/c1d0p0 -ldevs

Fdisk information for device /dev/rdsk/c1d0p0

** NOTE **
/dev/dsk/c1d0p0 - Physical device referring to entire physical disk
/dev/dsk/c1d0p1 - p4 - Physical devices referring to the 4 primary partitions
/dev/dsk/c1d0p5 ... - Virtual devices referring to logical partitions

Virtual device names can be used to access EXT2 and NTFS on logical partitions

/dev/dsk/c1d0p1 Diagnostic
/dev/dsk/c1d0p2 WIN95 FAT32(LBA)
/dev/dsk/c1d0p3 Solaris x86
/dev/dsk/c1d0p4 DOS Extended
/dev/dsk/c1d0p5 Linux native
/dev/dsk/c1d0p6 Linux swap
/dev/dsk/c1d0p7 WIN95 FAT32(Upto 2047GB)

The above command scan you hard-disk and displays all available filesystems. Note the required filesystems to be mounted.

To mount NTFS partition use

root~#mount -F ntfs /dev/dsk/c1d0p /mnt/windows

To mount FAT 16 / FAT 32 partition use

root~#mount -F pcfs /dev/dsk/c1d0p /mnt/windows

if the above command fails you can try the below option

root~#prtpart /dev/dsk/c1d0p0 -fat

the above command should list the available PCFS / FAT partitions in colon notation, then use the same for mounting (eg)

root~#mount -F pcfs /dev/dsk/c1d0p0:d /mnt/windows

To mount Ext2 / Ext3 partitions use

root~#mount -F ext2fs /dev/dsk/c1d0p /mnt/linux

To unmount a partition use "umount "

root~#umount /mnt/linux

Sunday, January 25, 2009

Enable root account OpenSolaris

su
gedit /etc/user_attr

Remove first element , final resule seems:

root::::type=normal;....

reboot system

Install PostgreSQL on OpenSolarsis

Use Package Manager , check all SUNWpost**-8.3**

Install pgAdmin3

----
Open Terminal 1

su

Setup password for postgres account:
passwd postgres

usermod -P "Postgres Administration" -R postgres bearsoft

su - postgres

If u get some error e.x : su: No shell, u should config shell apply for postgres user

Open another terminal 2,

su
gedit /etc/passwd

u change shell apply for root, bearsoft (current user), and postgres account into /bin/bash

back to terminal 1, type:

pfexec /usr/postgres/8.3/bin/initdb /var/postgres/8.3/data

Start server

/usr/postgres/8.3/bin/pg_ctl -D /var/postgres/8.3/data -l var/postgres/8.3/logfile start
done.

Saturday, January 24, 2009

Tạo plugin java cho FireFox

cd /usr/mozilla/plugins
ln -s /usr/jdk1.6.0/jre/plugin/i386/ns7/libjavaplugin_oji.so

Cài đặt java 6 trên OpenSolaris 2008.11

Tải JDK 6 bản dành cho Solaris về
Giải nén
Bật Terminal:

cd
pkgadd -d . SUNWj6rt SUNWj6dev SUNWj6cfg SUNWj6man SUNWj6dmo

JDK sẽ được lưu vào đường dẫn /usr/jdk/jdk1.6.0

Hoàn tất cài đặt JDK.

Tìm hiểu về PostgreSQL trên OpenSolaris

http://wikis.sun.com/display/DBonSolaris/PostgreSQL

http://blogs.sun.com/felix/

http://blogs.sun.com/jkshah