<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Jiramot.info &#187; freebsd</title>
	<atom:link href="http://www.jiramot.info/tag/freebsd/feed" rel="self" type="application/rss+xml" />
	<link>http://www.jiramot.info</link>
	<description>Developer&#039;s Life</description>
	<lastBuildDate>Mon, 06 Feb 2012 08:49:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>Install portupgrade on FreeBSD 6</title>
		<link>http://www.jiramot.info/install-portupgrade-on-freebsd-6</link>
		<comments>http://www.jiramot.info/install-portupgrade-on-freebsd-6#comments</comments>
		<pubDate>Fri, 10 Dec 2010 20:53:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Article]]></category>
		<category><![CDATA[freebsd]]></category>

		<guid isPermaLink="false">http://www.jiramot.info/?p=778</guid>
		<description><![CDATA[<p>ติดตั้ง cvsup โดยไปที่ /usr/ports/net/cvsup-without-gui และทำการติดตั้งได้เลยครับ #cd /usr/ports/net/cvsup-without-gui #make install clean</p> <p>จากนั้นก็ทำการ synchronize ports index กับเซิร์ฟเวอร์ที่เป็น cvsup server โดยผมเลือก cvsup.jp.freebsd.org เพราะทำการ ping ดูแล้ว ได้เวลาเร็วสุด เมื่อเทียบกับเซิร์ฟเวอร์อื่นๆครับ โดยใช้คำสั่ง</p> <p>#/usr/local/bin/cvsup -g -L 2 -h cvsup.jp.freebsd.org /usr/share/examples/cvsup/ports-supfile</p> <p>จากนั้นก็ทำการติดตั้ง portupgrade ครับ #cd /usr/ports/sysutils/portupgrade ถ้าไม่เจอให้ใช้ #cd /usr/ports/ports-mgmt/portupgrade #make install clean</p> <p>ทำการอัพเดต ports database</p> <p>#/usr/local/sbin/portsdb -Uu</p> <p>ทำการค้นหาโปรแกรมที่เคยติดตั้งไปแล้ว แต่ยังไม่ใหม่ล่าสุด เพื่อทำการอัพเดตครับ</p> <p>#/usr/local/sbin/portversion [...]]]></description>
			<content:encoded><![CDATA[<p>ติดตั้ง cvsup โดยไปที่ /usr/ports/net/cvsup-without-gui และทำการติดตั้งได้เลยครับ<br />
#cd /usr/ports/net/cvsup-without-gui<br />
#make install clean</p>
<p>จากนั้นก็ทำการ synchronize ports index กับเซิร์ฟเวอร์ที่เป็น cvsup server โดยผมเลือก cvsup.jp.freebsd.org เพราะทำการ ping ดูแล้ว ได้เวลาเร็วสุด เมื่อเทียบกับเซิร์ฟเวอร์อื่นๆครับ โดยใช้คำสั่ง</p>
<p>#/usr/local/bin/cvsup -g -L 2 -h cvsup.jp.freebsd.org /usr/share/examples/cvsup/ports-supfile</p>
<p>จากนั้นก็ทำการติดตั้ง portupgrade ครับ<br />
<span id="more-778"></span><br />
#cd /usr/ports/sysutils/portupgrade<br />
ถ้าไม่เจอให้ใช้<br />
#cd /usr/ports/ports-mgmt/portupgrade<br />
#make install clean</p>
<p>ทำการอัพเดต ports database</p>
<p>#/usr/local/sbin/portsdb -Uu</p>
<p>ทำการค้นหาโปรแกรมที่เคยติดตั้งไปแล้ว แต่ยังไม่ใหม่ล่าสุด เพื่อทำการอัพเดตครับ</p>
<p>#/usr/local/sbin/portversion -l &#8220;<"</p>
<p>ทำการอัพเดตโปรแกรมที่เคยติดตั้งแล้ว ให้ใหม่ล่าสุดครับ </p>
<p>#/usr/local/sbin/portupgrade -arR</p>
<p>ถ้าไม่เกิดปัญหาระหว่างการอัพเดต ก็ใช้คำสั่งถัดไปได้เลยครับ</p>
<p>#/usr/local/sbin/pkgdb -F</p>
<p>แต่ถ้าเกิดปัญหาขึ้นมา แบบนี้</p>
<p>campus# /usr/local/sbin/portsdb -Uu<br />
Updating the ports index ... Generating INDEX.tmp - please wait..make: don't know how to make describe. Stop<br />
===> textproc/p5-Sort-PolySort failed<br />
*** Error code 1<br />
1 error</p>
<p>ก็ใช้คำสั่ง</p>
<p>#/usr/local/sbin/pkgdb -fu</p>
<p>แต่ถ้ายังเกิดปัญหาลักษณะแบบนี้ ซึ่งเกิดจากการที่เราเคยติดตั้ง และใช้งาน FreeBSD มานานแล้ว จนเวอร์ชันของ portupgrade นั้นเปลี่ยน ซึ่งลักษณะของ error เป็นดังนี้ครับ</p>
<p>campus# /usr/local/sbin/portsdb -Uu<br />
Updating the ports index &#8230; Generating INDEX.tmp &#8211; please wait..make: don&#8217;t know how to make describe. Stop<br />
===> ftp/lukemftpd failed<br />
*** Error code 1<br />
1 error</p>
<p>********************************************<br />
Before reporting this error, verify that you are running a supported<br />
version of FreeBSD (see http://www.FreeBSD.org/ports/) and that you<br />
have a complete and up-to-date ports collection. (INDEX builds are<br />
not supported with partial or out-of-date ports collections &#8212; in<br />
particular, if you are using cvsup, you must cvsup the &#8220;ports-all&#8221;<br />
collection, and have no &#8220;refuse&#8221; files.) If that is the case, then<br />
report the failure to ports@FreeBSD.org together with relevant<br />
details of your ports configuration (including FreeBSD version,<br />
your architecture, your environment, and your /etc/make.conf<br />
settings, especially compiler flags and WITH/WITHOUT settings).</p>
<p>Note: the latest pre-generated version of INDEX may be fetched<br />
automatically with &#8220;make fetchindex&#8221;.<br />
********************************************</p>
<p>*** Error code 1</p>
<p>Stop in /usr/ports.<br />
*** Error code 1</p>
<p>Stop in /usr/ports.<br />
failed to generate INDEX!<br />
portsdb: index generation error</p>
<p>วิธีการแก้ปัญหาก็คือ ให้เอาโปรแกรม portupgrade ออกก่อน แล้วก็ทำการ ติดตั้ง portupgrade ใหม่ครับ </p>
<p>#cd /usr/ports/sysutils/portupgrade<br />
ถ้าหาไม่เจอให้ใช้<br />
#cd /usr/ports/ports-mgmt/portupgrade<br />
#make deinstall<br />
#make install clean</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jiramot.info/install-portupgrade-on-freebsd-6/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Web proxy in freeBSD with Squid</title>
		<link>http://www.jiramot.info/web-proxy-in-freebsd-with-squid</link>
		<comments>http://www.jiramot.info/web-proxy-in-freebsd-with-squid#comments</comments>
		<pubDate>Tue, 07 Apr 2009 17:30:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[freebsd]]></category>
		<category><![CDATA[proxy]]></category>

		<guid isPermaLink="false">http://www.jiramot.info/?p=229</guid>
		<description><![CDATA[<p>หาที่อยู่ Ports ก่อนครับ >whereis squid /usr/ports/www/squid เข้าไปที่ Ports เพื่อติดตั้ง >cd /usr/ports/www/squid >make all >make install แก้ไข config ของ squid > vi /usr/local/etc/squid/squid.conf หาบรรทัดต่าง ๆ ต่อไปนี้ # http_port 3128 &#8212; เอา # ออก # icp_port 3130 &#8212; เอา # ออก</p> <p>#cache_dir ufs /usr/local/squid/var/cache 100 16 256 &#8212; เอา # ออก #cache_access_log /usr/local/squid/var/logs/access.log &#8212; เอา # [...]]]></description>
			<content:encoded><![CDATA[<p>หาที่อยู่ Ports ก่อนครับ<br />
>whereis squid<br />
/usr/ports/www/squid<br />
เข้าไปที่ Ports เพื่อติดตั้ง<br />
>cd /usr/ports/www/squid<br />
>make all<br />
>make install<br />
แก้ไข config ของ squid<br />
> vi /usr/local/etc/squid/squid.conf<br />
หาบรรทัดต่าง ๆ ต่อไปนี้<br />
<span id="more-229"></span><br />
# http_port 3128 &#8212; เอา # ออก<br />
# icp_port 3130 &#8212; เอา # ออก</p>
<p>#cache_dir ufs /usr/local/squid/var/cache 100 16 256 &#8212; เอา # ออก<br />
#cache_access_log /usr/local/squid/var/logs/access.log &#8212; เอา # ออก<br />
#cache_log /usr/local/squid/var/logs/cache.log &#8212; เอา # ออก<br />
#cache_store_log /usr/local/squid/var/logs/store.log &#8212; เอา # ออก</p>
<p>http_access deny all &#8212; เปลี่ยนเป็น http_access allow all</p>
<p>ใส่ visible_hostname แล้วตามด้วยชื่อ host ของคุณ</p>
<p>ตัวอย่าง visible_hostname 192.168.1.1</p>
<p>จาก Path File ข้างบน Squid จะ Cache file ไว้ที่ /usr ซึ่งจะทำให้ Volume เต็มได้ ให้ทำการย้าย Path ทั้งหมดมาเก็บไว้ที่ /var แต่วิธีแก้ไขง่ายๆ คือทำ Link File ดังนี้</p>
<p>เราจะย้าย Path ตั้งแต่ /usr/local/squid ให้ไปอยู่ที่ /var/squid</p>
<p>สร้าง Directory squid<br />
>mkdir /var/squid</p>
<p>>ln -s /var/squid /usr/local/squid</p>
<p>สร้าง directory cache และ file log ที่ /var/squid/</p>
<p>> mkdir /var/squid/cache<br />
> chown -R nobody:nogroup /var/squid<br />
> chmod -R 777 /var/squid/<br />
> cd /var/squid/logs<br />
> touch access.log cache.log store.log<br />
> chmod 777 *</p>
<p>>/usr/local/sbin/squid -z * ถ้าเกิด error ให้กลับไปดู visible_hostname</p>
<p>run squid เป็น background</p>
<p>> /usr/local/squid/bin/RunCache &#038;</p>
<p>ดูว่า squid ทำงานหรือไม่ โดย</p>
<p>> ps -ax grep RunCache</p>
<p>ถ้ามี process 13625 p0 I 0:00.00 /bin/sh ../bin/RunCache แบบนี้แสดงว่าทำงานแล้ว</p>
<p>ให้ squid ทำงานทุกครั้งเมื่อ reboot เครื่อง</p>
<p>> vi /etc/rc.local</p>
<p>ใส่ข้อความดังนี้เพิ่มเข้าไป/usr/local/squid/bin/RunCache &#038;</p>
<p>จากนั้นให้ทำการทดสอบ โดย set Browser ของท่านให้ทำงานผ่าน Proxyโดยใส่ IP ของ server และ port 3128</p>
<p>#&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-Debug&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
>/usr/local/squid/bin/RunCache &#038; [1] 1071<br />
> Running: squid -sY >> /usr/local/squid/var/squid.out 2>&#038;1<br />
Abort trap<br />
Running: squid -sY >> /usr/local/squid/var/squid.out 2>&#038;1<br />
Abort trap<br />
Running: squid -sY >> /usr/local/squid/var/squid.out 2>&#038;1<br />
Abort trap<br />
Running: squid -sY >> /usr/local/squid/var/squid.out 2>&#038;1<br />
Abort trap<br />
Running: squid -sY >> /usr/local/squid/var/squid.out 2>&#038;1<br />
Abort trap<br />
Running: squid -sY >> /usr/local/squid/var/squid.out 2>&#038;1<br />
Abort trap<br />
RunCache: EXITING DUE TO REPEATED, FREQUENT FAILURES</p>
<p>ให้ตรวจสอบ Permission , Directory ,File ใน /var/squid ว่า Set ถูกหรือไม่ หรือ</p>
<p>>more /usr/squid/squid.out ดู Error ก็ได้ </p>
]]></content:encoded>
			<wfw:commentRss>http://www.jiramot.info/web-proxy-in-freebsd-with-squid/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>OpenSSH Security with Fake banner in FreeBSD</title>
		<link>http://www.jiramot.info/openssh-security-with-fake-banner-in-freebsd</link>
		<comments>http://www.jiramot.info/openssh-security-with-fake-banner-in-freebsd#comments</comments>
		<pubDate>Mon, 24 Nov 2008 04:22:46 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Article]]></category>
		<category><![CDATA[freebsd]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://www.jiramot.info/?p=76</guid>
		<description><![CDATA[<p>โดยปกติแล้วเจ้าเซอเวอร์ของเรามันจะโชว์เวอร์ชันของ ssh โดยจะบอกทั้งเวอร์ชั่น ระบบปฏิบัติการ ทำให้เป็นเป้าหมายของเหล่า hacker สามารถค้นหาและสามารถเล่นงานได้โดยง่าย การทำ fake banner เป็นการเปลี่ยนรายละเอียนของโปรแกรมหรือเซอร์วิส เพื่อให้แสดงข้อมูลอย่างที่เราต้องการ ในตัวอย่างนี้ผมจะทำการเปลี่ยน banner ของ service OpenSSH ที่ลงในระบบปฏิบัตการ FreeBSD</p> <p>โดยค่าปกติของ SSH Banner เป็นค่า SSH-2.0-OpenSSH_4.5p1 โดยเราจะเปลี่ยนให้เป็นค่า SSH-2.0-JiramotService</p> <p>โดยทำการเข้าไปแก้ไฟล์ซอร์ส versioh.h ของ OpenSSH โดยใน FreeBSD จะอยู่ที่ </p> <p>/usr/scr/crypto/openssh/ </p> <p>จากนั้นแก้ให้เป็น</p> <p>#define SSH_VERSION (ssh_version_get()) #define SSH_RELEASE (ssh_version_get()) #define SSH_VERSION_BASE &#8220;JiramotService&#8221; #define SSH_VERSION_ADDENDUM &#8220;JiramotInfo&#8221;</p> <p>ทำการบันทึก จากนั้นรีคอมไฟล์ โดยไปที่</p> <p>/usr/src/secure/lib/libssh</p> <p>make [...]]]></description>
			<content:encoded><![CDATA[<p>โดยปกติแล้วเจ้าเซอเวอร์ของเรามันจะโชว์เวอร์ชันของ ssh โดยจะบอกทั้งเวอร์ชั่น ระบบปฏิบัติการ ทำให้เป็นเป้าหมายของเหล่า hacker สามารถค้นหาและสามารถเล่นงานได้โดยง่าย<br />
การทำ fake banner เป็นการเปลี่ยนรายละเอียนของโปรแกรมหรือเซอร์วิส เพื่อให้แสดงข้อมูลอย่างที่เราต้องการ ในตัวอย่างนี้ผมจะทำการเปลี่ยน banner ของ service OpenSSH ที่ลงในระบบปฏิบัตการ FreeBSD</p>
<p>โดยค่าปกติของ SSH Banner เป็นค่า SSH-2.0-OpenSSH_4.5p1<br />
โดยเราจะเปลี่ยนให้เป็นค่า SSH-2.0-JiramotService</p>
<p>โดยทำการเข้าไปแก้ไฟล์ซอร์ส versioh.h ของ OpenSSH โดยใน FreeBSD จะอยู่ที่ </p>
<blockquote><p>/usr/scr/crypto/openssh/ </p></blockquote>
<p>จากนั้นแก้ให้เป็น</p>
<blockquote><p>#define SSH_VERSION             (ssh_version_get())<br />
#define SSH_RELEASE             (ssh_version_get())<br />
#define SSH_VERSION_BASE        &#8220;JiramotService&#8221;<br />
#define SSH_VERSION_ADDENDUM    &#8220;JiramotInfo&#8221;</p></blockquote>
<p>ทำการบันทึก จากนั้นรีคอมไฟล์ โดยไปที่</p>
<blockquote><p>/usr/src/secure/lib/libssh</p></blockquote>
<blockquote><p>make obj &#038;&#038; make depend &#038;&#038; make &#038;&#038; make install</p></blockquote>
<p>จากนั้นทำการ restart service</p>
<blockquote><p>/etc/rc.d/ssh restart</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.jiramot.info/openssh-security-with-fake-banner-in-freebsd/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache Security with Fake Banner</title>
		<link>http://www.jiramot.info/apache-security-fake-banner</link>
		<comments>http://www.jiramot.info/apache-security-fake-banner#comments</comments>
		<pubDate>Sun, 23 Nov 2008 07:09:21 +0000</pubDate>
		<dc:creator>tonhor</dc:creator>
				<category><![CDATA[Article]]></category>
		<category><![CDATA[freebsd]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://www.jiramot.info/?p=70</guid>
		<description><![CDATA[<p>เพื่อเป็นการป้องการกันโจมที apache server โดยการทำ Fake banner ของ apache service</p> <p>/etc/httpd/conf/httpd.conf            ; redhat distro</p> <p>ServerTokens Full,OS,Minor,Minimal,Major,Prod</p> <p>ServerTokens Setting ProductOnly Server: Apache Major Server: Apache/2 Minor Server: Apache/2.0 Minimal Server: Apache/2.0.55 OS Server: Apache/2.0.55 (Debian) Full (or not specified) default Server: Apache/2.0.55 (Debian) PHP/5.1.2-1+b1 mod_ssl/2.0.55 OpenSSL/0.9.8b</p> <p>ถ้าจะแก้ไข header :  กรณีที่ต้องการเปลี่ยน banner ไปเลย </p> [...]]]></description>
			<content:encoded><![CDATA[<p>เพื่อเป็นการป้องการกันโจมที apache server โดยการทำ Fake banner ของ apache service</p>
<p>/etc/httpd/conf/httpd.conf            ; redhat distro</p>
<p><!--ec2-->ServerTokens Full,OS,Minor,Minimal,Major,Prod</p>
<blockquote><p>ServerTokens Setting<br />
ProductOnly	<!--coloro:#33FF33--><span style="#33ff33;"><!--/coloro-->Server: Apache<!--colorc--></span><!--/colorc--><br />
Major	<!--coloro:#33FF33--><span style="#33ff33;"><!--/coloro-->Server: Apache/2<!--colorc--></span><!--/colorc--><br />
Minor	<!--coloro:#33FF33--><span style="#33ff33;"><!--/coloro-->Server: Apache/2.0<!--colorc--></span><!--/colorc--><br />
Minimal	<!--coloro:#33FF33--><span style="#33ff33;"><!--/coloro-->Server: Apache/2.0.55<!--colorc--></span><!--/colorc--><br />
OS	<!--coloro:#33FF33--><span style="#33ff33;"><!--/coloro-->Server: Apache/2.0.55 (Debian)<!--colorc--></span><!--/colorc--><br />
Full (or not specified) default	<!--coloro:#33FF33--><span style="#33ff33;"><!--/coloro-->Server: Apache/2.0.55 (Debian) PHP/5.1.2-1+b1 mod_ssl/2.0.55 OpenSSL/0.9.8b</span></p></blockquote>
<p>ถ้าจะแก้ไข header :  กรณีที่ต้องการเปลี่ยน banner ไปเลย<br />
<!--c1--></p>
<p><!--ec1-->/usr/include/httpd/httpd.h            ; apache v.1<br />
/usr/include/httpd/ap_release.h    ; apache v.2</p>
<blockquote><p>44 #define AP_SERVER_BASEPRODUCT &#8220;Apache&#8221;<br />
45<br />
46 #define AP_SERVER_MAJORVERSION_NUMBER 2<br />
47 #define AP_SERVER_MINORVERSION_NUMBER 2<br />
48 #define AP_SERVER_PATCHLEVEL_NUMBER   9</p></blockquote>
<p>ตัวอย่างการ config ServerTokens แบบ Full ก็เช่นเวปนี้ จะได้</p>
<p>Apache/2.2.9 (FreeBSD) mod_ssl/2.2.9 OpenSSL/0.9.8e DAV/2</p>
<p>PHP/5.2.6 with Suhosin-Patch SVN/1.5.2</p>
<p>อิอิ</p>
<div class="codemain"><!--c2--></div>
<p><!--ec2--></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jiramot.info/apache-security-fake-banner/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Monitor server with munin</title>
		<link>http://www.jiramot.info/monitor-server-with-munin</link>
		<comments>http://www.jiramot.info/monitor-server-with-munin#comments</comments>
		<pubDate>Sat, 08 Nov 2008 19:35:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Article]]></category>
		<category><![CDATA[freebsd]]></category>

		<guid isPermaLink="false">http://www.jiramot.info/?p=8</guid>
		<description><![CDATA[ <p>Monitoring FreeBSD with Munin Munin is a monitoring tool available in the FreeBSD ports. It tracks the vital signs of your servers and charts everything on graphs by day, week, month and year. It makes it easy to see when your server gets spikes of traffic and how well it handles them. It [...]]]></description>
			<content:encoded><![CDATA[<div class="content clear-block">
<p>Monitoring FreeBSD with Munin<br />
Munin is a monitoring tool available in the FreeBSD ports. It tracks the vital signs of your servers and charts everything on graphs by day, week, month and year. It makes it easy to see when your server gets spikes of traffic and how well it handles them. It can also show you how your traffic is increasing over the month or year so that you can plan out when you will need to upgrade or add more servers.</p>
<p>Munin-Node<br />
Munin is split between two ports. One port is for the clients and one is for the server that tracks and charts the data. On all machines that you plan to monitor, including the machine that will act as the munin server if you wish, install munin-node from the ports.</p>
<p># cd /usr/ports/sysutils/munin-node<br />
# make install distcleanIt will prompt you to add the group. Press y for both these as they come up.</p>
<p>You need a group &#8220;munin&#8221;.<br />
Would you like me to create it [y]? y<br />
Would you like me to set up log rotation [y]?<br />
Now that munin-node has been installed you need to enable it in the rc.conf file before you can run it.</p>
<p># ee /etc/rc.confOpen the file and add the following line</p>
<p>munin_node_enable=&#8221;YES&#8221;Munin-Node Config File<br />
The munin node config file contains the settings as well as the ips that can access the data from the node. Open this file:</p>
<p># ee /usr/local/etc/munin/munin-node.confThe only critical setting in this file that you will need to change at first is the list of allowed addresses. It defaults to only allow the localhost to access the node data. If you are running the munin-main server on the same machine then this is all you will want, but if you have it on a seperate machine you will need to add the ip. If your server running munin-main was on 192.168.0.50 you would add the following:</p>
<p>allow ^192\.168\.0\.50$If munin node is already running restart it to put these changes into effect with:</p>
<p># sh /usr/local/etc/rc.d/munin-node.sh restartStarting up Munin-Node<br />
Now that your node is configurated start it up from the rc.d folder.</p>
<p># sh /usr/local/etc/rc.d/munin-node.sh start<br />
Starting munin_node.You can test that everything is working correctly by telneting into munin from the local machine. Type version to check the munin version and fetch cpu to see the current cpu stats.</p>
<p># telnet localhost 4949<br />
Trying 127.0.0.1&#8230;<br />
Connected to localhost.freebsdmadeeasy.com.<br />
Escape character is &#8216;^]&#8217;.<br />
# munin node at www.freebsdmadeeay.com<br />
version<br />
munins node on www.freebsdmadeeasy.com version: 1.2.5<br />
fetch cpu<br />
user.value 11975593<br />
nice.value 14303<br />
system.value 5550264<br />
interrupt.value 3717056<br />
idle.value 948846761<br />
.<br />
quit<br />
Connection closed by foreign host.<br />
Munin-Main<br />
Munin-Main is the server which goes out to all of the nodes, fetches the data, and then graphs it. It is installed only on the one central machine that will be monitoring the nodes. It can be installed from the ports with the following commands.</p>
<p># cd /usr/ports/www/munin-main<br />
make install distcleanYou will be prompted to create the munin group and user if it does not already exist. Press y for these questions.</p>
<p>You need a group &#8220;munin&#8221;.<br />
Would you like me to create it [y]? y<br />
Done.<br />
You need a user &#8220;munin&#8221;.<br />
Would you like me to create it [y]? y<br />
Munin-Main has a config file that stores the node IPs and some of its graphing options. To add nodes besides the localhost you will need to edit this file.</p>
<p># ee /usr/local/etc/munin/munin.confThe default directory to ouput the html to is /usr/local/www/munin, you will need to either set up a vhost for this to access it or change the htmldir to /usr/local/www/data/munin so that you can get to it from the default directory. You will need to create this directory and set the permissions or the update will fail.</p>
<p># chown -R munin:munin /usr/local/www/data/munin/Adding Nodes to the Munin Tree<br />
In the munin.conf file you will have a tree containing the local machine as set up by the ports.</p>
<p># a simple host tree<br />
[master.freebsdmadeeasy.com]<br />
address 127.0.0.1<br />
use_node_name yesTo add the other nodes copy this format and change the hostname and ip for each machine. For example if we wanted to add 2 more machines:</p>
<p># a simple host tree<br />
[master.freebsdmadeeasy.com]<br />
address 127.0.0.1<br />
use_node_name yes</p>
<p>[april.freebsdmadeeasy.com]<br />
address 192.168.0.15<br />
use_node_name yes</p>
<p>[may.freebsdmadeeasy.com]<br />
address 192.168.0.27<br />
use_node_name yes<br />
Munin-Main will now contact these machines and pull in their data which is given by munin-node running on each of these machines.</p>
<p>The Munin user<br />
Unlike munin-node which starts with a script in rc.d, munin-main runs under the munin user from a cron job. To see this job you can su to munin under the root account.</p>
<p># su munin<br />
$ crontab -eThe crontab -e command will show you the scheduled jobs which will look like this:</p>
<p>#BEGIN_MUNIN_MAIN<br />
MAILTO=root</p>
<p>*/5 * * * *     /usr/local/bin/munin-cron<br />
#END_MUNIN_MAIN<br />
If you wish to change who gets the emails about munin change root to that username.</p>
<p>If you are stuck in vi press escape ZZ to get out.</p>
<p>Munin-main will start running as soon as the port installs, but will not do more then access itself until you make the changes above to the config file.</p>
<p>Viewing the Graphs<br />
Once five minutes have gone by and munin has run with the new config file you can check that it outputted them to the htmldir.</p>
<p>If the html is there open it up in your web browser on the server and you will be able to see the munin graphs.</p>
<p>Changing the Templates<br />
Templates are found under the following directory</p>
<p># cd /usr/local/etc/munin/templates/If you are processing .html files as PHP you will need to remove the XML line from the top of every .tmpl page or your pages will not show up. After changing the templates the changes will not show up under after an update has run using the new templates.</p>
<p>Changing the Port<br />
If you wish to change the port from something besides 4949 change it first in your munin-node.conf files on the nodes, and then add the port line to each node in your tree with the port you set.</p>
<p># ee /usr/local/etc/munin/munin.conf<br />
[april.freebsdmadeeasy.com]<br />
address 192.168.0.15<br />
port 7000<br />
use_node_name yes<br />
Troubleshooting<br />
If you are having problems check the logs.</p>
<p># cd /var/log/munin-mainThere are many log files that will tell you everything that munin is currently doing.</p>
<p>You can also run munin-cron manually by doing an su to munin and then running the cron with</p>
<p>$ munin-cronThis will show you some error messages if they are there.</p>
<p>Another trick to try is to telnet from the server into the munin-nodes to make sure that munin-main is able to access them and that you do not have a problem with your ip access in the munin-node.conf files.</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.jiramot.info/monitor-server-with-munin/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Compile Glassfish on FreeBSD (JDK 1.5)</title>
		<link>http://www.jiramot.info/compile-glassfish-on-freebsd-jdk-15</link>
		<comments>http://www.jiramot.info/compile-glassfish-on-freebsd-jdk-15#comments</comments>
		<pubDate>Sat, 08 Nov 2008 19:16:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[freebsd]]></category>
		<category><![CDATA[glassfish]]></category>

		<guid isPermaLink="false">http://www.jiramot.info/?p=3</guid>
		<description><![CDATA[ <p>1) Install and add all those require and avaliable utilities software tools.</p> <p>i) For installation of JDK: Since Sun does not have official JDK 1.5 on FreeBSD platform. Therefore, we either have to build our own jdk from the source(note 1), or with the help from FreeBSD&#8217;s java user group, there is a [...]]]></description>
			<content:encoded><![CDATA[<div class="content clear-block">
<p>1) Install and add all those require and avaliable utilities software tools.</p>
<p>i) For installation of JDK:<br />
Since Sun does not have official JDK 1.5 on FreeBSD platform. Therefore, we either have to build our own jdk from the source(note 1), or with the help from FreeBSD&#8217;s java user group, there is a port version of jdk 1.5 being done (download and install from here).</p>
<p>ii) For installation of Apache Maven<br />
<code><em><big><br />
$cd  /usr/ports/devel/maven<br />
$make install clean<br />
</big></em></code><br />
iii) For installation of Apache ANT<br />
<code><em><big><br />
$cd /usr/ports/devel/apache-ant<br />
$make install clean<br />
</big></em></code><br />
iv) For installation of ported NSS -<br />
<code><em><big><br />
$cd /usr/ports/security/nss<br />
$make install clean<br />
</big></em></code><br />
v) For installation of ported NSPR -<br />
<code><em><big><br />
$cd /usr/ports/devel/nspr<br />
$make install clean<br />
</big></em></code><br />
2) Environment setting after step 1 is done :</p>
<p>For example:  bash shell default environment setting:<br />
<code><em><big><br />
JAVA_HOME=/usr/local/diablo-jdk1.5.0<br />
MAVEN_HOME=/usr/local/share/java/maven<br />
ANT_HOME=/usr/local/share/java/apache-ant<br />
CVSROOT=:pserver:@cvs.dev.java.net:/cvs<br />
PATH=$JAVA_HOME/bin:$ANT_HOME/bin:$MAVEN_HOME/bin:$PATH<br />
export JAVA_HOME MAVEN_HOME ANT_HOME CVSROOT PATH<br />
</big></em></code></p>
<p>3) Checking out the GlassFish source and building from scratch or download the source bundle from here</p>
<p>1. The first step is to checkout the module dependencies and common files used in the build system and edit the properties file.<br />
<code><em><big><br />
$mkdir workspace<br />
$cd workspace<br />
$cvs -d :pserver:@cvs.dev.java.net:/cvs co -r SJSAS91_UR1_BRANCH glassfish/bootstrap<br />
</big></em></code><br />
This will checkout project.xml, maven.xml, project.properties, and common files referenced from project.xml.<br />
Edit glassfish/bootstrap/project.properties for the following properties name value:<br />
<code><em><big><br />
glassfish.os.name=Darwin<br />
glassfish.cvs.username=<br />
</big></em></code><br />
In Default, glassfish project will install at ${glassfish.home} , if you want to install other path you must change ${glassfish.home} in file project.properties<br />
<code><em><big><br />
${glassfish.home}=/usr/local/glassfish<br />
</big></em></code><br />
2. Next checkout the sources.<br />
<code><em><big><br />
$cd glassfish/bootstrap<br />
$maven checkout<br />
</big></em></code></p>
<p>Edit /glassfish/appserv-core-ee/appserv-core/build.xml<br />
And change source from &#8220;${javac.source}&#8221; to &#8220;1.5&#8243;</p>
<p><code><em><big><br />
$vi /glassfish/appserv-core-ee/appserv-core/build.xml</big></em></code></p>
<p>source=&#8221;1.5&#8243;</p>
<p>3. Bootstrap the server image (a collection of  image and jar files used to run glassfish).<br />
<code><em><big><br />
$maven bootstrap-all<br />
or<br />
$maven bootstrap (only if you have build before)<br />
</big></em></code></p>
<p>4. Build the checked out source code.<br />
<code><em><big><br />
$maven build<br />
</big></em></code></p>
<p>5. Configure the GlassFish Server runtime. This step will create the asadmin script, run create-domain, etc which are needed to run the GlassFish server.<br />
<code><em><big><br />
$maven configure-runtime<br />
</big></em></code></p>
<p>6. Starting up the server using the asadmin command in /publish/bin directory.<br />
<code><em><big><br />
/publish/bin/asadmin start-domain<br />
</big></em></code></p>
<p>7. Install you server, Edit setup.xml to set a port ant username and password<br />
<code><em><big><br />
$cd /publish/gashfish<br />
$chmod -R +x lib/ant/bin<br />
$lib/ant/bin/ant -f setup.xml<br />
</big></em></code><br />
7. Start accessing the newly compile build GlassFish (Java EE).<br />
From any browser:</p>
<p>http://hostname:4848</p>
<p>http://hostname:8080</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.jiramot.info/compile-glassfish-on-freebsd-jdk-15/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

