You need to be Payday Loans UK Why would you

S.M.A.R.T. for FreeBSD (smartmontools)

S.M.A.R.T. (Self-Monitoring hdd, Analysis, and Reporting Technology).
This monitoring system support practically all hdd disks.
You have to install smartmontools for working with smart on FreeBSD. I suggest you have alredy installed it.

#smartctl -a /dev/ad1

This command show you many various indicatos about your disk (rate of hardware read errors, count of reallocated sectors, hdd temperature etc)

You also can run smartd daemon with will ask disks one time per 30minutes

#cp /usr/local/etc/smartd.conf.sample /usr/local/etc/smartd.conf
#vim /usr/local/etc/smartd.conf:
/dev/ad0 -S on -o on -a -I 194 -m admin@howtobsd.com
/dev/ad4 -S on -o on -a -I 194 -m admin@howtobsd.com

add to /etc/rc.conf:

usr/local/etc/>echo 'smartd_enable="YES"' >> /etc/rc.conf
/usr/local/etc/>echo 'smartd_flags="-l local2 --interval=300"' >> /etc/rc.conf

#/usr/local/etc/rc.d/smartd start

That is all!

Problem with svn: Cannot negotiate authentication mechanism

I have installed svn server on FreeBSD with sasl authentication. Here is config of my repository:

[general]
anon-access = none
auth-access = write
realm = project

[sasl]
use-sasl = true
min-encryption = 128
max-encryption = 256

I have face the challenge when I tried to “svn checkout” repository from the Fedora 8:

#svn checkout svn://192.168.1.5/project
#svn: Cannot negotiate authentication mechanism

In my case it means, that subversion was installed without Cyrus SASL authentication. You can check it:
#svn --version
svn, version 1.4.4 (r25188)
compiled Sep 2 2007, 14:30:15

Copyright (C) 2000-2006 CollabNet.
Subversion is open source software, see http://subversion.tigris.org/
This product includes software developed by CollabNet (http://www.Collab.Net/).
The following repository access (RA) modules are available:
* ra_dav : Module for accessing a repository via WebDAV (DeltaV) protocol.
- handles 'http' scheme
- handles 'https' scheme
* ra_svn : Module for accessing a repository using the svn network protocol.
- handles 'svn' scheme

* ra_local : Module for accessing a repository on local disk.
- handles 'file' scheme

Subversion with Cyrus SASL authentication available only from the 1.5 version
So, if you have subversion older version than 1.5 – “Cannot negotiate authentication mechanism“- you have to update subversion.
Fedora 8 is not supports anymore. And if you want use svn with Cyrus SASL authentication you have to upgrade Fedora or build rpm package with new version subversion.

How to append Cityes statistic in awstats (GeoLiteCity)

I suppose you have already installed awstats statistic, GeoIP plagin etc..

change default script which update database file about countries (GeoIP.dat):

# vim /usr/local/bin/geoipupdate.sh

#!/bin/sh
cd /tmp
fetch http://www.maxmind.com/download/geoip/database/GeoIP.dat.gz
fetch http://www.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
fetch http://www.maxmind.com/download/geoip/database/asnum/GeoIPASNum.dat.gz

gunzip GeoIP.dat.gz
gunzip GeoLiteCity.dat.gz
gunzip GeoIPASNum.dat.gz

mv -f GeoIP.dat /usr/local/share/GeoIP/
mv -f GeoLiteCity.dat /usr/local/share/GeoIP/
mv -f GeoIPASNum.dat /usr/local/share/GeoIP/

I mark string wich I’ve added.

Run script and put in /etc/crontab if you want always keep base in actual condition.

after that add in awstats config your site:
# vim /usr/local/etc/awstats/awstats.howtobsd.info.conf

#LoadPlugin="geoip"
LoadPlugin="geoip GEOIP_STANDARD /usr/local/share/GeoIP/GeoIP.dat"
LoadPlugin="geoip_city_maxmind GEOIP_STANDARD /usr/local/share/GeoIP/GeoLiteCity.dat"
LoadPlugin="geoip_org_maxmind GEOIP_STANDARD /usr/local/share/GeoIP/GeoIPASNum.dat"

awstats statistic before:

awstats-before

awstats statistic after:

awstats-after

Problem with awstats:Can’t locate Geo/IP.pm in @INC

The problem:
Error: Plugin load for plugin 'geoip' failed with return code: Error: Can't locate Geo/IP.pm in @INC (@INC contains: /usr/local/lib/perl5/5.10.1/BSDPAN /usr/local/lib/perl5/site_perl/5.10.1/mach /usr/local/lib/perl5/site_perl/5.10.1 /usr/local/lib/perl5/5.10.1/mach /usr/local/lib/perl5/5.10.1 . /usr/local/www/awstats/cgi-bin/lib /usr/local/www/awstats/cgi-bin/plugins) at (eval 4) line 1. Can't locate Geo/IP/PurePerl.pm in @INC (@INC contains: /usr/local/lib/perl5/5.10.1/BSDPAN /usr/local/lib/perl5/site_perl/5.10.1/mach /usr/local/lib/perl5/site_perl/5.10.1 /usr/local/lib/perl5/5.10.1/mach /usr/local/lib/perl5/5.10.1 . /usr/local/www/awstats/cgi-bin/lib /usr/local/www/awstats/cgi-bin/plugins) at (eval 5) line 1. Error: Need Perl module Geo::IP or Geo::IP::PurePerl

solution(as root):
#cpan Geo::IP::PurePerl Geo::IP

vim – howto delete blank lines

You can use :g/^\s*$/d in the vim redactor for cleaning file from blank lines

Ncftp – ftp client for freebsd(ncftpput).

Ncftp is good ftp client for freebsd

- install ncftp freebsd:

#cd /usr/ports/ftp/ncftp3 && make install clean
#rehash

create ftp config file:

#touch /home/config/ftp.conf

– add information about ftp-server to /home/config/ftp.conf:

host ftp.howtobsd.com
user ftpuser
pass ftpfassword

and finally wonderful command:

ncftpput -f /home/anton/ftp.conf /backups /backup/forupload/*

/home/anton/ftp.conf- is ftp-connection information
/backups – folder on ftp-server
/backup/forupload/* – all files from this folder upload to ftp server

I successfully use it for delayed uploadding backups (ftp remote backup)

Backup freebsd howto with fsbackup

Fsbackup is a good and simple freebsd backup software for backuping your information.
When you finish read this article you will be able to backup on freebsd your data automatically on the local directory or remote ftp server.

1.First of all we are going to install port fsbackup:

#cd /usr/ports/sysutils/fsbackup && make install clean

this is create directory /usr/local/fsbackup/ with scripts and config files

2.Let’is go to explore scripts and configs:

cache/ - directory for temporary hash
cfg_example - config example a good described and should be intuitive understandable. Follow I give my working config.
create_backup.sh – script running backup. You have to add it in /etc/crontab for automatically backup.
fsbackup.pl – it is a general sript of fsbackup
scripts/fsrestore.sh – restore you data
scripts/mysql_backup.sh – create backup MySQL database
scripts/pgsql_backup.sh – create backup PostgreSQL database
scripts/sqlite_backup.sh – create backup SQLLite database
scripts/sysbackup.sh – store system configuration files and information about installed packages
scripts/sysrestore.sh – reinstall packages stored by sysbackup.sh

If you want use any from this scripts (for example mysql_backup.sh and sysbackup.sh), you have to define it in the create_backup.sh start script (put “1″):

backup_mysql=1
backup_pgsql=0
backup_sqlite=0
backup_sys=1

Don’t forget put in this scripts your data. For example for properly storing mysql you have to fill your data such as:
backup_mysqluser="backuper"
backup_mysqlpassword="54dD1f6y7wfM959fM"
backup_path="/backup/mysql"

3.You also can separate your backups. For example your need to store mail in the one place (ftp-server or directory) while www-dir in the other:
Create two different config files by analogy with cfg_example (mail.conf and www.conf) and define it in start scripts directory: config_files=”mail.conf www.conf” -> create_backup.sh

4.This is promised my working config that store virtual mail folders:

$cfg_backup_name = "howtobsd_mail";
$cfg_cache_dir = "/usr/local/fsbackup/cache";
$prog_md5sum = "md5sum -b";
$prog_tar = "/usr/bin/tar";
$prog_ssh = "/usr/local/bin/ssh -i /usr/local/fsbackup/backup.prv";
$prog_rm = "/bin/rm";
$prog_gzip = "/usr/bin/gzip";
$cfg_checksum = "timesize";
$cfg_backup_style = "backup";
$cfg_increment_level = 16;
$cfg_save_old_backup = 1;
#$cfg_type = "remote_ftp";
$cfg_type = "local";
$cfg_remote_host="x.x.x.x";
$cfg_remote_password="backuper";
$cfg_remote_login="backuper";
$cfg_remote_path="/storage/backup/mail";
$cfg_local_path = "/backup/mail";
$cfg_time_limit = 0;
$cfg_size_limit = 100000;
$cfg_maximum_archive_size = 0;
$cfg_root_path = "/";
$cfg_stopdir_prune=0;
$cfg_verbose = 2;
__DATA__
/usr/local/fsbackup
f!\.core$
f!^core$
f!\.o$
f!\.log$
d!\.snap
# Users
f!.*\.avi$
f!.*\.mpeg$
f!.*\.mpg$
f!.*\.mp3$
#logs
f!/var/log/.*\.1\.bz2
f!/var/log/.*\.2\.bz2
f!/var/log/.*\.3\.bz2
f!/var/log/.*\.4\.bz2
f!/var/log/.*\.5\.bz2
f!/var/log/.*\.6\.bz2
f!/var/log/.*\.7\.bz2
f!/var/log/.*\.8\.bz2
f!/var/log/.*\.9\.bz2
f!restoresymtable
#importennt!
/var/mail/virtual

This config describe local type. I prefer use ncftp for uploading backups to remote server.
I use “backup style” (increment) with cfg_increment_level = 16 – it’s mean that every 16 backup will be full (other only incremental). So, approximate twice on the month it do a full backup.

5.If you want use ftp remote backup type change this strings:

$cfg_type = "remote_ftp";
$cfg_remote_host = "ftp.server.com";
$cfg_remote_login = "ftpuser";
$cfg_remote_path = "tmp";
$cfg_remote_password = "ftppassword";

Check rights on the remote folder.
Security. If it possible deny port 21 for all exept your servers IP. If you are paranoiac or level security for your data is so high – use pgp encryption or vpn :) .

6. Finally, when you have finished configure add running start script to /etc/crontab:
10 1 * * * root /usr/local/fsbackup/create_backup.sh | mail -s "howtobsd backup report" root
Storing starting at 1:10 and sends reports to mail.

The problem with mod_ssl: Undefined symbol “SSL_get_servername”

If you have a some problem:

Invalid command 'SSLEngine', perhaps misspelled or defined by a module not included in the server configuration

check the string in httpd.conf LoadModule ssl_module libexec/apache22/mod_ssl.so – it’s shouldn’t be comment

After update openssl and apache it turns out that apache can’t start:

Syntax error on line 68 of /usr/local/etc/apache22/httpd.conf: Cannot load /usr/local/libexec/apache22/mod_ssl.so into server: /usr/local/libexec/apache22/mod_ssl.so: Undefined symbol "SSL_get_servername"

The solution is rebuilt apache with WITH_OPENSSL_PORT:

echo 'WITH_OPENSSL_PORT=yes' >> /etc/make.conf

Update php5-* without portupgrade “php5-*”

The following solution update php5-* without portupgrade “php5-*”

For example if you lose db with information about installed ports

There is a simple solution to deinstal\reinstall\install extention php5

I suppose you’ve already installed (updated) php5.
create script:

#touch php5_update.sh
#vim php5_update.sh

and past this:

#!/bin/sh
grep -oE '=[a-z]+' /usr/local/etc/php/extensions.ini | \
sed -E 's/^./php5-/' | \
while read pkg;
do {
cd /usr/ports;
cd `make quicksearch name="^$pkg-" | \
grep -oE '/usr/ports/.+$'` && make install;
} done;

Don’t forget

#chmod +x php5_update.sh

Make shure that your /usr/local/etc/php/extensions.ini have information about needed extentions and start:

#./php5_update.sh

You can change script for you aims, For example you can change make reinstall to make deinstal or make install if you want delete of install needed extentions.

PS: I advise use portupgrade “php5-*” if it possible in your case.

With this method I’ve solved problem with php when all php scripts works with big delays (about 60sec) even command php -r ‘echo “test string \n”;’

[Tue Sep 01 16:19:21 2009] [warn] FastCGI: (dynamic) server “/xxx/www.cgi/php-fcgi.sh” started (pid 89108)
[Tue Sep 01 16:19:25 2009] [warn] FastCGI: (dynamic) server “/xxx/www.cgi/php-fcgi.sh” started (pid 89113)
[Tue Sep 01 16:19:28 2009] [warn] FastCGI: (dynamic) server “/xxx/www.cgi/php-fcgi.sh” started (pid 89118)
[Tue Sep 01 16:19:31 2009] [warn] FastCGI: (dynamic) server “/xxx/www.cgi/php-fcgi.sh” started (pid 89124)
[Tue Sep 01 16:19:34 2009] [warn] FastCGI: (dynamic) server “/xxx/www.cgi/php-fcgi.sh” started (pid 89129)
[Tue Sep 01 16:19:37 2009] [warn] FastCGI: (dynamic) server “/xxx/www.cgi/php-fcgi.sh” started (pid 89135)
[Tue Sep 01 16:19:40 2009] [warn] FastCGI: (dynamic) server “/xxx/www.cgi/php-fcgi.sh” started (pid 89140)
[Tue Sep 01 16:19:43 2009] [warn] FastCGI: (dynamic) server “/xxx/www.cgi/php-fcgi.sh” started (pid 89145)
[Tue Sep 01 16:19:46 2009] [warn] FastCGI: (dynamic) server “/xxx/www.cgi/php-fcgi.sh” started (pid 89150)
[Tue Sep 01 16:19:49 2009] [warn] FastCGI: scheduled the start of the last (dynamic) server “/xxx/www.cgi/php-fcgi.sh” process: reached dynamicMaxClassProcs (10)
[Tue Sep 01 16:19:49 2009] [warn] FastCGI: (dynamic) server “/xxx/www.cgi/php-fcgi.sh” started (pid 89155)

portupgrade “php5-*” in my case didn’t helped me. My php-extentions was separately installed at the different times. I was been needing deinstall all php5-extention. This script good solve it.

How to move FreeBSD system from one hdd to another.

It’s can be useful, when you current hard drive disk too small or going out of order.
I’ve moved my FreeBSD system with this simple method twice. At last I’ve moved System from production server. New hdd has added in software RAID-1 and work correct.So, I think you won’t have some kind of problem. Any way, if something will wrong you always can use your previous hdd.
Let’s start.

1)Shut down your FreeBSD:
#halt

and swich off computer from power

2)Connect your new hdd, swich on computer and make shure that hdd is detected (in BIOS) and start booting system.
3)For example your new hdd has detected like this: /dev/ad4
4)make directories for points for mounting yours partitions:

#mkdir /mnt/root && mkdir /mnt/var && mkdir /mnt/usr

5) Start up sysinstall program:
#sysinstall
choose Configure-> Fdisk-> ad4 (carefully)
create freeBSD slice on the all disk space. Press s (set bootable), press w (write changes). And choose “Standard Install a standard MBR” and press “YES”
Go to the Label choose ad4 press ‘a’ (auto-defaults for all), it is auto create partitions for you. You can create partitions yourself (if you need special partition size). After that you have to select mount points. For every partition press ‘m’ and insert mount point (for exemple in my partition ad4s1e mount point “/mnt/usr”), when you finish, press ‘w’ (write changes). If you create partitions by hand – you should be shure that your root partition has created with letter “a” like this: ad4s1a. You can obtain it in thw next trick. Firstly create partinion with mount point ‘/’ – only in this case partition will be created by Label with letter ‘a’. And after that you need change mount point partition ad4s1a in ‘/mnt/root/’. I advise you create partition the same in your previous disk (see in /etc/fstab). Don’t forget create partitions that were in your previous disk (/tmp and others) After that program create partitions and mount it in your points – /mnt/root, /mnt/var, mkdir /mnt/usr.

6) Check your partition and mount points:
#df
7) Now you are ready for magic commands:
# cd / ; pax -p eme -X -rw . /mnt/root
# cd /var; pax -p eme -X -rw . /mnt/var
# cd /usr; pax -p eme -X -rw . /mnt/usr

8)If letters partitions in your new hdd are not conform with letters partitions your previous hdd you must fix it in you new fstab: /mnt/root/etc/fstab
Carefully examine your fstab and output df. If your new hdd take the place of previous hdd (replace) and letters of partitions the same in the both hdds. You don’t have to change mnt/root/etc/fstab, becose when you replace you old hdd pertition will be correct for you new hdd. But if your partitions were changed – edit /mnt/root/etc/fstab. For example if partiotion /var has lable /dev/ad0s1f and became /dev/ad0s1g you have to change in /mnt/root/etc/fstab from ad0s1f to ad0s1g

9)Shut down…swich off… replace hdd..swich on…enjoy