Friday, December 28, 2007

pkg_add and an old FreeBSD 5.4 installation

Hellllo.

Just before the New Years, I got this need to upgrade our software on one of our servers. It requires some packages, and so I went to install them.

As I already knew, I was out of luck with pkg_add -r, since the files for FreeBSD 5.4 aren't on FreeBSD's FTP server anymore for a while already.

Minutes later, aunt Google came to help, suggesting that I read FreeBSD manual
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/packages-using.html

shortly, the solution was:
setenv PACKAGESITE ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-5-stable/Latest/

:)

Tuesday, December 25, 2007

nginx could not build the server_names_hash hash

When restarting nginx, suddenly I came accross this error message:

could not build the server_names_hash hash, you should increase server_names_hash_bucket_size: 32

Now, that's solved pretty easily - by increasing server_names_hash_bucket in config file to a bigger value. According to author, Igor Sysoev, even p4 can easily handle value of a 128.

So I put
server_names_hash_bucket_size 128;
in nginx.conf, and everything works fine.



Friday, November 9, 2007

Pass real IP for backend webserver

The problem: when nginx is serving front end in two layer webserver, with apache on backend, apache doesn't see clients ip address, just 127.0.0.1 for everybody.

The solution: install either mod_realip (apache 1.3.x only) or mod_rpaf (both apache 1.3.x and 2).

http://sysoev.ru/mod_realip/ - mod_realip
http://stderr.net/apache/rpaf/ - mod_rpaf

http://nginx.info/index.pl/ru/articles

Tuesday, October 30, 2007

After MySQL installation, do

mysql_install_db.

It wasn't so for some time, but now, for reasons unknown to me, it has to be done under FreeBSD.

more on the subject http://dev.mysql.com/doc/refman/5.0/en/unix-post-installation.html

also, chmod 777 /var/tmp.

Turn on SMART capability on a HDD

smartctl -s on /dev/da0

A nice network monitoring tool

A nice network monitoring tool is Ntop. Has its own webserver, and pretty good stats, to see which host is doing lots of traffic, what traffic it is, etc. Great!

DHCP - assign a fixed ip adress to a particular host

Been a while.. So, today I had to assign a fixed ip adress to one particular host, 'cause I had to make host-specific firewall rules, and make sure user doesn't get around them as easily as getting a new DHCP ip address. Here's a config I used (thanks to wikipedia)

host saturn {
hardware ethernet 00:50:04:53:F8:D2;
fixed-address 192.168.42.3;
}

Sunday, June 24, 2007

How to prevent Outlook Express from automatically displaying messages

Not FreeBSD related at all of course, but oh well.. let's have it in my knowledge base. :)

An user called me with a problem - he couldn't delete a message from his Outlook Express, because it was too big, and his computer would simply crash when trying to open it. The solution was

1) turn off preview pane - View->Layout...->uncheck "Show preview pane"
2) better safe than sorry, perform a correct "Compact folders" procedure.

Wednesday, June 13, 2007

SMART disk monitoring

Oh, the drama. When it comes to HDD going down, it's gloves off.

So, to spot bad HDD in a timely manner, I came across the following advice.

Install /usr/ports/systutils/smartmon

and configure it like this (example)
/dev/ad6 -d ata -a -m your@mail.com -M once -s L/../../1/13

this will test device /dev/ad6, -d = device type, -a = all the parameters I need, -m - mail to send report to, M = once - send mail only once -s = perform test on mondays, 13 o'clock.

Basically that's it.

Sendmail SMTP authorization & secure connection

Today, I had to set up SMTP authorization on my FreeBSD 5.4 box. And, of course, since system username & password gets transfered, secure connection, in my opinion (yea, even in my opinion), is a must. Mail users, however, are set to nologin, but better be on the safe side, I guess.

Here's an excellent guide I found with google's help.

http://www.puresimplicity.net/~hemi/freebsd/sendmail.html

Of course, I opted for copy/paste first (as probably all of us do, some just don't admit it)

It was pretty fine, till the time come to restart sendmail. It failed with a message that port is already in use (courtesy of /var/log/maillog). Long story short, I had to comment out
DAEMON_OPTIONS(`Port=smtp, Name=MTA')dnl
from configuration file (probably because it was defined elsewhere but I didn't bother to look) and it started working.

A note - For reasons beyond a mere mortals understanding, Thunderbird 1.5.x.x (OF COURSE I didn't wrote down the exact number) doesn't work with this configuration. However, 2.0 works perfectly. As does Outlook Express. I don't know about other clients, haven't tried. So far so good. There are no angry calls from users, so I'm calling it a day.

Tuesday, June 12, 2007

PACKAGESITE for pkg_add -r

As always, this hint is for those who like to take shortcuts, not investigate properly yadayada :D

Problem
: FreeBSD installed a while ago, and now a need arouses to pkg_add some package. Of course, the original release doesn't have that nice pub/FreeBSD/ports/i386/packages-6.0-release/Latest/ directory anymore.

Notes: Of course, this can only be done (I think, since I'm the lame admin) for close releases, and most certainly for one release - 4, 5, or 6..

/bin/sh
export PACKAGESITE="ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-6.2-release/Latest/"

(of course, replace 6.2 with whatever is needed)
pkg_add -r happily.