Enable Path View in Finder (Mac OS X)
เข้าไปที่ Terminal
hostname$sudo defaults write com.apple.finder _FXShowPosixPathInTitle -bool YES
แล้วลองเข้า Finder ใหม่
ดูด้านบนก็จะเห็น Full Path เลยล่ะครับ
What is GNU? เผื่อหลงลืมกัน
โครงงาน GNU คืออะไร?
โครงงาน GNU เริ่มต้นขึ้นในปี 1984 เพื่อพัฒนาระบบปฏิบัติการ Unix ให้เป็น Free Software: ระบบ GNU ซึ่งความแตกต่างของระบบปฏิบัติการ GNU จะใช้ Kernel ที่เรียกว่า Linux ซึ่งมีการใช้อย่างกันอย่างแพร่หลาย ระบบนี้มักจะถูกเรียกว่า“Linux” ซึ่งถ้าจะเรียกให้ถูกต้องแล้ว ควรจะเรียกว่า ระบบกนู/ลินุกซ์ ( GNU/Linux systems )
GNU ย่อมาจาก “GNU’s Not Unix” ออกเสียงว่า guh-noo หรือเกือบจะเหมือน canoe
Free Software คืออะไร?
Free Software นั้นเป็นเรื่องของเสรีภาพ ไม่ใช่เรื่องของราคา เพื่อให้เข้าใจคอนเซปต์มากยิ่งขึ้น คุณควรจะนึกถึงเสรีภาพ หรืออิสรภาพในการพูด ไม่ใช่เบียร์ฟรี
Free Software นั้นเป็นเรื่องของเสรีภาพที่จะ run , copy , แจกจ่าย , ศึกษา , เปลี่ยนแปลงและพัฒนาซอฟแวร์ให้ดีขึ้น ถ้าจะพูดให้ชัดก็คือ มันเน้นถึงเสรีภาพที่ผู้ใช้ซอฟแวร์จะได้รับ 4 อย่างด้วยกัน คือ
1.อิสระที่จะ run program เพื่อจุดประสงค์อะไรก็ได้
2.อิสระที่จะเรียนรู้วิธีการทำงานของโปรแกรม และปรับเปลี่ยนมันให้เป็นไปตามอย่างที่คุณต้องการ โดยที่ให้ใส่ Access ให้กับ source code ก่อนถึงจะเปลี่ยนแปลงได้
3.อิสระที่จะแจกจ่าย copy เพื่อให้คุณสามารถช่วยเหลือเพื่อนของคุณได้
4.อิสระที่จะพัฒนาโปรแกรม และนำสิ่งที่คุณพัฒนาออกสู่สายตาประชาชน เพื่อที่จะให้สังคมได้รับประโยชน์จากโปรแกรมที่คุณพัฒนา และแน่นอนว่าต้องเข้าไปใส่ Access ให้กับ source code ก่อนถึงจะพัฒนาโปรแกรมได้
ที่มา : linuxthailnad.org
wikipedia เลิกใช้ Redhat เปลี่ยนใจมาใช้ ubuntu
เว็บไซต์ wikipedia 1 ใน 10 เว็บไซต์ ที่มีจำนวนผู้เข้าชมมากที่สุด ซึ่งเดิม server มีทั้งที่รัน redhat , fedora , ubuntu
ตอนนี้จะเปลี่ยนจาก server ที่ใช้ OS เป็น Redhat จำนวน 400 Server ไปใช้งาน Ubuntu Linux 8.04 เพื่อให้บริการเว็บไซต์แทน
เหตุผลก็คือ ทาง wikipedia ไม่ต้องการจ่ายเงินให้กับ redhat (os support + software solution) และ linux ubuntu ก็ update บ่อย
ซะด้วย และอีกอย่างคือไ่ม่มีอะไรดีกว่า apt package manager ของ ubuntu
ที่มา : http://www.cyberciti.biz/tips/wikipedia-moving-400-servers-to-ubuntulinux.html
mail server พัง
สองทุ่มกว่า ๆ จะ remote เข้าไปเช็ค server กรรมทำไม remote เข้าไปได้ ลอง ssh ไปที่เครื่องอื่น ก็ได้นี่นา
เลยตัดสินใจเมล์แจ้ง Pacific เพื่อให้ตรวจสอบเครื่องให้ reboot ก็แล้ว , ต่อจอดู ไม่มีอะไรเลย งานเข้าสิครับท่าน
นั่งคุยกับเพื่อน ๆ สักพัก ก็กลับมาห้อง ดิ่งไป Pacific ทันที ไปถึง แกะเครื่องดู สัญชาติญาณ ดมกลิ่น ได้กลิ่นไหม้ ๆ
ที่ Power Supply ผลิตจากจีน เป็นของยี่ห้อ R-Senda รุ่น 360U Part No: RSD-3600UP กว่าจะหาร้านที่ซื้อได้ นู่น บางแค (http://store.thaiclever.com)

power supply
* เสีย downtime ไปเกือบ 17 ชั่วโมง
can not edit /etc/fstab
พอดี มี server อยู่ตัวนึงเป็น redhat enterprise 5 ( โหลดมาใช้ตั้งแต่ Redhat เปิดให้ download แรก ๆ นู่น) มัน boot ไม่ขึ้น
Checking filesystems
/:Resize inode not valid.
/:UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY
(i.e., without -a or -p options)
*** An error occurred during the file system check.
*** Dropping you to a shell; the system will reboot
*** When you leave the shell.
Give root password for maintenance
(or type Control-D to continue):
เนื่องจาก มันเช็ค file system แล้วผิดปกติ ประมาณ not clean อะไรประมาณนี้ ที่นี้เราจะแก้ไข /etc/fstab แต่มันเป็น read only ทำให้เราไม่สามารถแก้ไขได้ ถ้ามันขึ้นแบบนี้แล้วให้ใส่ password root
จากนั้นเข้า single mode ด้วยคำสั่ง init 1
#mount -n -o remount /
แค่นี้ก็แก้ fstab แล้ว
** ไม่ได้ทำบ่อย ๆ ก็ลืมได้ ขอ blog ไว้หน่อย
uptime
ไม่มีอะไรมากเอา uptime ของ Labtop ที่ใช้งานอยู่ ก็เป็น winXP นี่แหละ ที่ uptime ขนาดนี้ก็เพราะว่าไม่เคย reboot เลย ( hibernate ตลอด) นาน ๆ ถึงจะ reboot ทีนึง แต่ปกติไม่เคยเกิน 10 วันก็ reboot แล้ว

ส่วนอีกอันเป็น server ตัวนึงที่อยู่ในความดูแลไม่เคย reboot มาปีนึงและ

ที่เอามาเขียนใน blog เพราะว่าอยากเก็บไว้เป็นที่ระลึก แค่นั้นเอง
Network Management using Nagios
ลองลง Nagios บน Debian จริง ๆ ไปเจอ manual ใน sourceforge แต่เป็นของ Ubuntu แ่ต่ก็ใช้กันได้เพราะ Debian เป็นต้นกำเนิดของ Ubuntu (http://nagios.sourceforge.net/docs/3_0/quickstart-ubuntu.html)
apt-get install apache2
apt-get install build-essential
apt-get install libgd2-xpm-dev
1) create account for nagios
/usr/sbin/useradd nagios
passwd nagios
Create a new nagcmd group for allowing external commands to be submitted through the web interface. Add both the nagios user and the apache user to the group.
/usr/sbin/groupadd nagcmd
/usr/sbin/usermod -G nagcmd nagios
/usr/sbin/usermod -G nagcmd www-data
2)Download nagios and the Plugins ไว้ที่ไหนก็ได้ง่าย ๆ ก็ /usr/local/src
wget http://osdn.dl.sourceforge.net/sourceforge/nagios/nagios-3.0.tar.gz
wget http://osdn.dl.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.11.tar.gz
3) Compile and Install Nagios
tar xzf nagios-3.0.tar.gz
cd nagios-3.0
./configure –with-command-group=nagcmd
Compile the Nagios source code.
make all
Install binaries, init script, sample config files and set permissions on the external command directory.
make install
make install-init
make install-config
make install-commandmode
4) Customize Configuration
config file ของ nagios ที่เรา compile อยู่ที่ /usr/local/nagios/etc/
ให้เราแก้ไข email address ที่อยู่ในไฟล์
vi /usr/local/nagios/etc/objects/contacts.cfg
ตรง yourmail@yourdomain ให้เป็น mail ของเราที่ต้องการให้ alert แจ้ง
5) Configure the Web Interface
make install-webconf
และให้ทำการสร้าง user สำหรับ web interface ในที่นี้ให้เป็น user nagiosadmin โดยใช้คำสั่ง
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
จากนั้นจะให้เรากรอก password ของ nagiosadmin
6) Compile and Install the Nagios Plugins
cd /usr/local/src
tar xzf nagios-plugins-1.4.11.tar.gz
cd nagios-plugins-1.4.11
./configure –with-nagios-user=nagios –with-nagios-group=nagios
make
make install
7) Start Nagios
สร้าง link ให้ nagios start ทุกครั้งเมื่อมีการ reboot
ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios
ตรวจสอบ file config ของ nagios โดยใช้คำสั่ง
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
ถ้าไม่มี error ก็ให้ start Nagios
/etc/init.d/nagios start
8) ลอง Login ผ่านหน้าเว็บ http://ipaddress/nagios/
ลองคลิกที่ service detail
โดยรวมแล้วน่าใช้กว่า cacti
Openbravo ERP (enterprise management system) on Debian
ที่มา http://www.howtoforge.com/installing-openbravo-erp-on-debian-etch
เอาไว้ว่าง ๆ ก่อน
1 Preparation
1.1 Debian Backports
This repository provides Sun’s JDK that we need for this setup.
vi /etc/apt/sources.list
Add the following lines.
# Debian Backports deb http://www.backports.org/debian etch-backports main contrib non-free
Afterwards refresh apt …
apt-get update
… and import the gpg-key.
apt-get install debian-backports-keyring
1.2 Needed Packages
Now let’s install and configure the needed packages.
1.2.1 PostgreSQL
Install it via:
apt-get install postgresql-8.2
Afterwards we have to set the PostgreSQL admin password.
sed -i ’s/ident sameuser$/trust/’ /etc/postgresql/8.2/main/pg_hba.conf
/etc/init.d/postgresql-8.2 restart
Open a PostgreSQL shell.
psql -U postgres
alter role postgres with password ‘%new_PostgreSQL_admin_passowrd%’;
\q
sed -i ’s/trust$/md5/’ /etc/postgresql/8.2/main/pg_hba.conf
/etc/init.d/postgresql-8.2 reload
1.2.2 Java JDK
Install it via:
apt-get install sun-java6-jdk
Afterwards make it systemwide available.
update-java-alternatives -s java-6-sun
echo ‘JAVA_HOME=”/usr/lib/jvm/java-6-sun”‘ | tee -a /etc/environment
After that log out and in again to take the changes effect.
1.2.3 Apache Tomcat
Install it via:
apt-get install tomcat5.5 tomcat5.5-admin tomcat5.5-webapps
Afterwards we have to configure it.
rm /var/log/tomcat5.5/catalina.out
vi /etc/init.d/tomcat5.5
Change:
TOMCAT5_SECURITY=yes
To:
TOMCAT5_SECURITY=no
Restart Tomcat.
/etc/init.d/tomcat5.5 restart
Now let’s look if all went well.
netstat -tap | grep java
Tomcat should be listening on port 8180.
tcp6 0 0 *:8180 *:* LISTEN 3571/java
As a last resort make it systemwide available.
echo ‘CATALINA_HOME=”/usr/share/tomcat5.5″‘ | tee -a /etc/environment
echo ‘CATALINA_BASE=”/var/lib/tomcat5.5″‘ | tee -a /etc/environment
echo ‘CATALINA_OPTS=”-server -Xms384M -Xmx512M”‘ | tee -a /etc/environment
After that log out and in again to take the changes effect.
1.2.4 Apache Ant
Apache ant has already been installed as dependency at the step before – so only the configuration is left.
echo ‘ANT_HOME=”/usr/share/ant”‘ | tee -a /etc/environment
After that log out and in again to take the changes effect.
2 Openbravo
2.1 Get It
Please have a look at http://sourceforge.net/projects/openbravo/ to find out which is the latest version. When I was writing this howto it was version 2.35mp1.
cd /tmp/
wget http://mesh.dl.sourceforge.net/sourceforge/openbravo/OpenbravoERP-2.35-MP1-linux-installer.bin
chmod +x OpenbravoERP-2.35-MP1-linux-installer.bin
2.2 Installation
A text based installer will guide you through the installation.
./OpenbravoERP-2.35-MP1-linux-installer.bin
First press a few times “Enter” to read the single parts of the license agreement. Type in “yes” at the end if you agree with it.
Before the installation begins you’ll be asked a few questions – answer them as follows.
- Hit “Enter” to choose the default (/opt/OpenbravoERP) when you’re asked for the installation directory.
- Hit “Enter” to choose the default (/opt/OpenbravoERP/AppsOpenbravo/attach) when you’re asked for the attachments directory.
- Hit “Enter” to choose the default (Full (standard) installation) when you’re asked for the installation type.
- Hit “Enter” to choose the default (Full) when you’re asked again for the installation type.
- Choose PostgreSQL as database to use.
- Hit “Enter” to choose the default (/usr/lib/jvm/java-6-sun) when you’re asked for the java home directory.
- Hit “Enter” to choose the default (/usr/share/ant) when you’re asked for the Apache ant home directory.
- Hit “Enter” to choose the default (/var/lib/tomcat5.5) when you’re asked for the Tomcat installation directory.
- Type in your web server’s domain (e.g.: server1.example.com) when you’re asked for it.
- Enter “8180” when you’re asked for the http port.
- Hit “Enter” to choose the default (openbravo) when you’re asked for the context name.
- Enter “/usr/bin” when you’re asked for the directory that contains the PostgreSQL binaries.
- Hit “Enter” to choose the default (localhost) when you’re asked for the database server parameters.
- Hit “Enter” to choose the default (4532) when you’re asked for PostgreSQL’s listening port.
- Hit “Enter” to choose the default (openbravo) when you’re asked for the database name.
- Next enter the PostgreSQL admin password (twice) that you created earlier at step 1.2.1.
- Hit “Enter” to choose the default (tad) when you’re asked for the openbravo database user.
- Next type in a password (twice) for the new user.
- Now type in “y” to start the installation – this will take a while…
2.3 Webinterface
Now you can access Openbravo via http://%servername%:8180/openbravo . Log in with the username “Openbravo” and the password “openbravo”.






