Freebie

The Memorandum of Me



FreeBSD 8 and GlassFish V2


After 5 years of noactivity. I finish my new page about Installing GlassFishV2 on FreeBSD8 AMD 64.

Setup FreeBSD 6 on IBM Thinkpad T42


Access FreeBSD disk from Windows XP


My notebook is dual-boot sometime I want some files that I save on FreeBSD partition when I work on Windows XP. Until I found FFS File System Driver for Windows, the steps to get that file is reboot the machine in FreeBSD, copy those files to FAT32 partition and then reboot back to Windows XP.

FFS File System Driver for Windows and it small FFS Manager program allow me to got a read-only access to my FreeBSD partition. Life is a lot easier by then.



How to install FORBIDDEN ports on FreeBSD


Sometime you may want to install a FORBIDDEN port (a port with security vulnerabilities) on your system. In my case, I want to install www/awstats 6.5 ports with has a security vulnerability if the update of the stats via web front-end is allowed but I don't use this feature -- so it fine for me to install this port.

Unfortunely, there is no clean way on FreeBSD to force install the FORBIDDEN port. You must edit the file /usr/ports/Mk/bsd.port.mk to comment out the line the prevent installation of FORBIDDEN port.

.elif defined(FORBIDDEN)
IGNORE=        is forbidden: ${FORBIDDEN}
.endif

-->

.elif defined(FORBIDDEN)
#IGNORE=        is forbidden: ${FORBIDDEN}
.endif
Don't forget to remove the comment after you install the port.



Use FETCH_CMD to use local copy of distfiles


We have many FreeBSD server on our LAN which we design not to use package to install the port (this may be not the fastest but it give most flexibility). The problem of this method is , everytime me install the port, it try to download a source file from the internet which are very slow.

We solve this proble by write a shell small (ssh-fetch.sh) that use ssh to fetch the source file from the /usr/ports/distfiles on our local server "t42.net0.intranet" using user "vpn"

On the server "t42.net0.intranet" side, we add the new user "vpn" and allow root from remote machine to login without password using ssh publickey authentication. Which can be done by:

  1. Run "ssh-keygen -t rsa" as root on the client machine to create a public/private key pair in /root/.ssh. Don't enter the password when ssh-keygen ask for the password, just press ENTER
  2. Copy the content of /root/.ssh/id_rsa.pub and append it to the file /home/vpn/.ssh/authorized_keys2. This will allow root from client machine to login to "vpn@t42.net0.intranet" without the password

The last step before use ssh-fetch.sh with FreeBSD ports is to set the environ variable FETCH_CMD to ssh-fetch.sh. For example

#setenv FETCH_CMD /home/admin/bin/ssh-fetch.sh
#cd /usr/ports/databases/mysql41-server
#make install clean
#portupdate -f rsync



Inplace replace in Unix


As an admin or programmer , sometime you may want to replace words on many files at once. For example, I want to replace the width of every textarea control on this size from 70 characters width to 60 characters ('cols=70' to 'cols=60') . If you are sure that the original text are unique in this context (use grep to check the cardidate first), you can use find,xargs and perl to replace the word:



How to modify JavaScript confirm/alert box button?


Unfortunely the answer is "it is impossible",but, there is a workaround solution using CSS and JavaScript. The outline of the solution are:

  1. Create a hidden alert-div in your page.
  2. When you need the alert box,disable all controls in the form and show the hidden alert-div.
  3. After user press a button in the alert-div, hide the alert-div and enable all controls in the form.



Reorganization of my homepage


My old personal page is a mess , therefore I reorganize my page as you see it now. The look and feel is copy from K2 for Blogger.



FreeBSD 6 installation guildline


First part of FreeBSD 6 installation guildline. This is the first document I wrote with FreeBSD Document sgml tools.

FreeBSD 6 installation



SquirrelMail+Courier-imap with Large Inbox


If you has a very large Inbox (+1000 mails). You should enable SquirrelMail to use server side mail sorting which are faster and use less resource. See SquirrelMailPerformance for more detail.



PostgreSQL don't support IPV6 by default


If you enable IPV6 in the OS and have IPV6 entry for localhost (::1 localhost localhost.my.domain) before IPV4 entry (127.0.0.1 localhost localhost.my.domain) -- which is default for FreeBSD. PostgreSQL will report error if you try to connect with "localhost" (i.e psql -h localhost ). The solution, swap IPV6 and IPV4 entries of localhost.







About Me


  • I'm Chatchawan Wongsiriprasert
  • From Thailand
  • A programmer/SysAdmin.
  • My profile