glassfish on opensolaris

written by bankster on 10 June 2009

Probably I can install Tomcat by downloading it from the Tomcat site, unpack it, and run it, but I don’t want to do this: I’d rather use the OpenSolaris packaging system. However, it seems there isn’t a package available for Tomcat. Atleast, I haven’t found it. So, my initial thought was to install JBoss instead. I’ve good experiences with JBoss, and for me, JBoss is a good replacement (or superset) for Tomcat. However, I also couldn’t find a proper download for this. So, why not install GlassFish then?

I’ve never worked with GlassFish before, but installing and configuring wasn’t a problem at all. I just followed the instructions I found here, and did the following steps:

1) pkg set-authority -O http://pkg.opensolaris.org:80 opensolaris.org
2) pkg refresh
3) pkg install glassfishv2
4) Then run the command to create a default domain1/usr/appserver/bin/asadmin create-domain –user admin –adminport 4848 domain1

During the creation of new domain
a)type (typical default) admin password : adminadmin
b)type (typical default) master password : changeit

5) Then run the command to start the newly created default domain1
/usr/appserver/bin/asadmin start-domain –user admin domain1

6) Now you should be able to access the GlassFishv2 on OpenSolaris

GlassFish Admin Console
http://hostname_or_ip_address:4848

GlassFish HTTP
http://hostname_or_ip_address:8080
https://hostname_or_ip_address:8181

And it all worked. I love when things just work!

lsb_release : to print out the ubuntu release information

written by bankster on 26 May 2009

#lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 7.04
Release:        7.04
Codename:       feisty

น่าคิดดีนะ

written by bankster on 9 May 2009

Setting up NTP Client on CentOS 5.3

written by bankster on 9 May 2009

setting up the ntp client for time synchronization on centos cando as follow

1. login to your shell as root

2. install ntp client by invoke this command
yum -y install ntp
3. edit ntp file configuration|
vi /etc/ntp.conf
comment out all the default time server and add your own time server. in case of me , Im in Thailand
so I use the time server that located in thailand.

server  clock.thaicert.org
server  time1.nimt.or.th
server  time2.nimt.or.th
server  time3.nimt.or.th

5. start the service

service ntpd start

6. start ntp on boot
chkconfig –levels 235 ntpd on

Setting up NTP Client on Solaris 10

written by bankster on 7 May 2009

1. vi /etc/inet/ntp.conf

#Created by bankster: 2009-05-07
#follow the last modified by Mr.Kitti :2008-06-17

#
# To start/stop/restart process :
#    # svcadm disable ntp
#    # svcadm enable ntp
#    # svcadm restart ntp

driftfile /etc/inet/ntp.drift

logfile /var/log/xntpd.log

server  clock.thaicert.org
server  time1.nimt.or.th
server  time2.nimt.or.th
server  time3.nimt.or.th

# end of /etc/inet/ntp.conf

2.
# touch /etc/inet/ntp.drift
# touch /var/log/xntpd.log

3. svcadm enable ntp

SUN Solaris 10 and the word “Secure by Default” in practice

written by bankster on 27 April 2009

คำว่า secure by default คิดว่าหลายๆ คนในวงการ sysadmin ได้ยิน ได้เห็น แล้วคงต้องนึกถึง OS ที่ ถูกตั้งค่ามาให้มีความปลอดภัยแบบ  out of the box โดยแทบจะไม่ต้อง tune กันเลยทีเดียว อย่างเช่น ระบบปฏิบัติการที่เป็นที่รู้จักกันดีอย่าง OpenBSD นอกจากนั้น ระบบปฏิบัติการใหม่ๆ อย่าง ubuntu และ windows vista ก็เข้าข่าย secure by default กับเค้าบ้างเหมือนกัน โดย ubuntu และ vista มุ่งเน้นไปที่ administrative priviledges ใน ubuntu จะไม่มี root account มากับการติดตั้งครั้งแรก โดยจะให้สิทธิ์ super user กับ user account แรกของระบบ ส่วน windows vista ก็ได้เน้นเรื่องของ administrative priviledges เหมือนกัน โดยเมื่อมีการทำอะไรสักอย่างที่เกี่ยวข้องกับระบบ หรือ ระบบจะได้รับผลกระทบ ไม่ว่าจะเป็นการกระทำโดย Software หรือ User เอง ก็จะมี prompt ขึ้นมา alert ซึ่งก็คือ UAC นั่นเอง

Solaris/OpenSolaris เองก็ concern เรื่อง secure by default เหมือนกัน โดยวิธีการของ solaris ก็คือ สร้าง profile สำหรับ Service Management Facilities (SMF) เพื่อ limit การทำงาน service ต่างๆ ตามความเหมาะสมของ ระบบ

สำหรับการ apply profile ต่างๆ ให้กับ SMF สามารถทำได้ดังนี้

#svccfg apply /var/svc/profile/generic_limited_net.xml

หรือเข้าไปดู profile ทั้งหมดได้ที่ /var/svc/profile

#cd /var/svc/profile
#ls -la
drwxr-xr-x   2 root     sys          512 Apr 24 11:59 .
drwxr-xr-x   5 root     sys          512 Apr 24 11:26 ..
lrwxrwxrwx   1 root     other         18 Apr 24 11:26 generic.xml -> ./generic_open.xml
-r–r–r–   1 root     sys        11830 Mar 12  2008 generic_limited_net.xml
-r–r–r–   1 root     sys         5860 Mar 12  2008 generic_open.xml
-r–r–r–   1 root     sys         3118 Mar 12  2008 inetd_generic.xml
lrwxrwxrwx   1 root     other         17 Apr 24 11:26 inetd_services.xml -> inetd_generic.xml
-r–r–r–   1 root     sys          739 Jan 22  2005 inetd_upgrade.xml
lrwxrwxrwx   1 root     root          12 Apr 24 11:52 name_service.xml -> ns_files.xml
-r–r–r–   1 root     sys          755 Jan 22  2005 ns_dns.xml
-r–r–r–   1 root     sys          547 Jan 22  2005 ns_files.xml
-r–r–r–   1 root     sys          661 Jan 22  2005 ns_ldap.xml
-r–r–r–   1 root     sys          779 Jan 22  2005 ns_nis.xml
-r–r–r–   1 root     sys          785 Jan 22  2005 ns_nisplus.xml
-r–r–r–   1 root     sys         1762 Jan 22  2005 ns_none.xml
lrwxrwxrwx   1 root     root          18 Apr 24 11:59 platform.xml -> platform_i86pc.xml
-r–r–r–   1 root     sys          663 Jan 22  2005 platform_i86pc.xml
-r–r–r–   1 root     sys          560 Jan 22  2005 platform_none.xml
-r–r–r–   1 root     sys        13838 Aug  9  2007 prophist.SUNWcsr
-rw-r–r–   1 root     other       6618 Apr 24 11:37 upgrade.app.20090424115945

จะพบว่า solaris ได้จัดทำ Profile ไว้ให้เรียกใช้ ได้อย่างเหมาะสมตามความต้องการของการให้บริการ ซึ่งเป็นอีกวิธีหนึ่งที่จะช่วย disable service ที่ไม่จำเป็น ซึ่งจะส่งผลในแง่ของ security แล้วยังส่งผลในเรื่องของประสิทธิภาพของ resources ด้วย

change user’s shell

written by bankster on 19 April 2009

solution 1. edit /etc/passwd

or

solution 2. usermod -s /bin/bash user

Solaris Home Directory

written by bankster on 14 April 2009

Under Solaris, home directories are conventionally kept on one of two places, /home or /export/home. The /home directory is under control of the automounter and only the automounter can create directories there. The /export/home directory is where users home directories can be created by the system administrator.

To create an account for user ‘oops’ where the UID is 400 and users home directory is not automounted:

  1. useradd -u 400 -g user -c useroops -m -d /export/home/oops oops
  2. passwd oops (To set the password)
  3. chown oops /export/home/oops
  4. chgrp user /export/home/oops

To create an account for ‘oops’ where the home directory is automounted and the mount point for /home is /etc/auto_home:

  1. useradd -u 400 -g user -c useroops oops
  2. passwd oops (To set the password)
  3. mkdir /export/home/oops
  4. chown oops /export/home/oops
  5. chgrp user /export/home/oops
  6. vi /etc/auto_home and add the line:oops remotehost:/home/&

This sets the user oops’ home directory to /home/oops exported from a remote host.

wget problem [solved]

written by bankster on 7 April 2009

อยู่ดีดี wget ที่เคยใช้ download อะไรต่างๆนาๆ บน Linux/Unix Server ที่ไม่มี GUI
เกิดใช้ไม่ได้ขึ้นมาซะงั้น  อาการก็เป็นแบบนี้อ่ะ

# wget http://awstats.sourceforge.net/awstats.ftp.urldetail.html
–04:17:37–  http://awstats.sourceforge.net/awstats.ftp.urldetail.html
Resolving awstats.sourceforge.net… 216.34.181.96
Connecting to awstats.sourceforge.net|216.34.181.96|:80… connected.
HTTP request sent, awaiting response…

เหมือนจะ http request ผ่าน แต่ http response กลับไม่มาถึงซะงั้น
ก็เลย ลอง man wget ดูว่าัมันมี option อะไีรให้้ใช้บ้าง เพราะว่า ลอง download file เดียวกันจาก windows server
ที่อยู่บน subnet เดียวกันกับ เจ้า linux server ตัวนี้ มันดัน download ได้ เลยคิดว่าต้องเป็นที่ wget แน่ๆ
อ่าน man ไปเรื่อยๆ ก็เจอกับ –user-agent ที่เอาไว้กำหนดชื่อ ของ browser หรือ http client
ก็เลยลอง wget ด้วย option นี้ดู

# wget –user-agent=”Bankster Browser 1.0″ http://awstats.sourceforge.net/awstats.ftp.urldetail.html
–04:22:42–  http://awstats.sourceforge.net/awstats.ftp.urldetail.html
Resolving awstats.sourceforge.net… 216.34.181.96
Connecting to awstats.sourceforge.net|216.34.181.96|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 238747 (233K) [text/html]
Saving to: `awstats.ftp.urldetail.html.2′

100%[============>] 238,747     79.5K/s   in 2.9s

04:22:46 (79.5 KB/s) - `awstats.ftp.urldetail.html.2′ saved [238747/238747]

เย้ download ได้แล้ว แต่ขี้เกียจพิมพ์ –user-agent=”xx” ทุกครั้งอ่ะ
เลยสร้าง bash script ขึ้นมา โดยเฉพาะเลย ตั้งชื่อว่า fooget ละกัน
ก็ cd /usr/bin/ แล้ว vi fooget

#!/bin/bash
/usr/bin/wget –user-agent=”wget” ${1}

แล้วก็ chmod +x /usr/bin/fooget ให้ execute ได้ เวลาเรียกก็ fooget URL
เสร็จแล้วครับ

Proposal Language and Presentation Training at Microsoft Thailand

written by bankster on 3 April 2009

วันนี้ก็ไป train proposal language และัก็ presentation ที่ MS มาแหละ
เจ้า MS ที่ไปนี่อยู่ที่ ชั้น 38 ตึก CRC All Season Place เพลินจิต

ก็ตื่นตั้งแต่ตีสาม อย่าเข้าใจผิดว่าอยากจะไปอะไรขนาดนั้น
จริงๆ มันชอบตื่นเวลานี้อ่ะ ตื่นมาแล้วก็เลยออกไปหาอะไรกิน 7-eleven แล้วก็นั่ง set server ไปเรื่อยๆ
จน หกโมงก็อาบน้ำ แต่งตัว ใส่ชุด Imagine Cup 2009 วันแรก วันนี้เลย 555

เจ็ดโมง 15 ก็ไปขึ้นรถตู้อนุสาวรีย์ กับพี่ลิง Bushido
ถึง อนุสาวรีย์ก็ไปขึ้น BTS ไปลงสถานีเพลินจิต
เหอๆๆ  งงกะทางเข้าตึกมาก สุดท้ายก็เจอ

พอดีเห็นทีมจาก Mahidol เลยทำเนียน เดินตามเค้าไป ก๊าากก
lift ขาขึ้นนี่ไม่เท่าไหร่ แต่ขาลงนี่ เสียวมาก ==”

ไปถึงชั้น 38 พี่เค้าก็บอกว่า IC2009 Train ที่ Audirium 3
ก็เดินเข้าไปนั่ง

พอคนมาเกือบครบ ครูสอนก็เดินเข้ามา โอ้โห ทุ่มทุน
ไม่ผิดคาด wallstreet จัดซะอย่าง มี ครูสอนฝรั่งสองคน
ชื่อ Jesse กับ Luke  ตอนเช้าก็เรียน Proposal Language
พวก persuative writing , emotive adjective , powerful and strong verbs,
logical , cause and effect , seems to be facts
โดยตอนเรียนก็แบ่งกลุ่ม ให้คละๆ กัน

ในทีมก็มี ตั้ม จาก จุฬา พี่แคน จาก สุรนารี
พี่ทิพย์ จาก Mahidol , พัฒน์ จาก Mahidol และก็มีพี่เบิร์ด MSP มารวมกลุ่มด้วย

เค้าก็สอนดีอ่ะนะ แล้วตอนหลังก็มีให้เอาความรู้ในช่วงเช้า มา
prove proposal ของแต่ละทีม โดยกระจาย proposal ไปตามทีมต่างๆ
แล้วก็รวมกลุ่มกลับมาเป็น University แล้วแจกคืน และก็เิปิดโอกาสให้
ทีมที่ Prove proposal ได้ discuss กัน

เหนื่อยมากมายวันนี้
กลัีบมาถึงบ่ายสอง อาบน้ำ แล้วนอนเลย
ข้าวปลาไม่กินละ เพิ่งจะตื่นเนี่ย