Archive for the FreeBSD Category

Nagios Installation on FreeBSD-9.0

Posted in FreeBSD on June 19, 2012 by kiranopatil

Nagios installation on FreeBSD-9.0


Install Mysql Server 5.5 from ports

 # cd /usr/ports/databases/mysql55-server

# make

# make install clean


To start mysql service, Add the below line to /etc/rc.conf


# ee /etc/rc.conf

Start mysql server using below mentioned command

#/usr/local/etc/rc.d/mysql-server start

Make mysql admin password

Set the mysql admin password as “nagios”

# mysqladmin -u root -p password nagios

(mysqladmin -u root password “newpassword”)

Log in to mysql console to check if the password was set proprely using below mentioned command

# mysql –u root –p

Type the password

You can exit from the prompt by typing “exit” command

Install  Apache  from ports

# cd /usr/ports/www/apache22

# make

# make install clean

Enable mysql-support in the blue screen

Enable and launch the apache service

Add the below line to /etc/rc.conf


# ee /etc/rc.conf

Start Apache service:

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

Test the apache page http://ip or http://hostname

Install  PHP and  php-extention

# cd /usr/ports/lang/php52

# make

# make install clean

Make sure to enable apache module in the install Step (Blue screen)

# cd /usr/ports/lang/php52-extensions

# make

# make install clean

Select sessions and mysql support in the configurations options (Blue screen)

Php Configuration

Settings for PHP are stored in the /usr/local/etc/php.ini file.

Use the following command

# cp /usr/local/etc/php.ini-dist /usr/local/etc/php.ini

Also Apache needs to be configured, so it can use php.

# cd /usr/local/etc/apache22/

# ee httpd.conf

Scroll down to the end of the /usr/local/etc/apache22/httpd.conf and add the following lines.

DirectoryIndex index.php index.html index.htm

AddType application/x-httpd-php .php

AddType application/x-httpd-php-source .phps

Save and exit.

Test PHP

Restart   apache  to check if  you  have  any  errors

# /usr/local/etc/rc.d/apache22 restart


Performing sanity check on apache22 configuration:

Syntax OK

Stopping apache22.

Waiting for PIDS: 61539.

Performing sanity check on apache22 configuration:

Syntax OK

Starting apache22.

Check  phpinfo page

To test the php run the following command to create a php file in the

# echo “<? phpinfo(); ?>” >> /usr/local/www/apache22/data/test.php

Now check the page http://ip/test.php

Install Nagios:

# cd /usr/ports/net-mgmt/nagios

# make

# make install clean

And use default installation, in installation screen of nagios plugins don’t forget to add NETSNMP to Nagios group and user.

Enable nagios  to  start  with  boot

Add the below line to /etc/rc.conf


# ee /etc/rc.conf

Now copy the sample page to the configuration files

# cd /usr/local/etc/nagios/

# cp cgi.cfg-sample cgi.cfg

# cp nagios.cfg-sample nagios.cfg

# cp resource.cfg-sample resource.cfg

Navigate to the /usr/local/etc/nagios/objects/ and do the  same :

# cd /usr/local/etc/nagios/objects/

# cp commands.cfg-sample commands.cfg

# cp contacts.cfg-sample contacts.cfg

# cp localhost.cfg-sample localhost.cfg

# cp printer.cfg-sample printer.cfg

# cp switch.cfg-sample switch.cfg

# cp templates.cfg-sample templates.cfg

# cp timeperiods.cfg-sample timeperiods.cfg

Now check you nagios configurations errors using following command


#  nagios -v  /usr/local/etc/nagios/nagios.cfg

You can create a password for the nagios web interface using the following command:

# htpasswd -c /usr/local/etc/nagios/htpasswd.users nagiosadmin

16-Now add Nagios to your apache configuration:

# ee /usr/local/etc/apache22/httpd.conf 

And at the end of the file add:


ScriptAlias /nagios/cgi-bin/ /usr/local/www/nagios/cgi-bin/

Alias /nagios /usr/local/www/nagios/

<Directory /usr/local/www/nagios>

Options ExecCGI

AllowOverride None

Order allow,deny

Allow from all

AuthName “Nagios Access”

AuthType Basic

AuthUSerFile /usr/local/etc/nagios/htpasswd.users

Require valid-user


<Directory /usr/local/www/nagios/cgi-bin>

Options ExecCGI

AllowOverride None

Order allow,deny

Allow from all

AuthName “Nagios Access”

AuthType Basic

AuthUSerFile /usr/local/etc/nagios/htpasswd.users

Require valid-user



Save the configuration and exit

17-Restart apache to check if any errors

# /usr/local/etc/rc.d/apache22 restart

Now  open your  nagios  page  with  Http://ip/nagios and  insert  your  login and  password created  before


Convert a man page to pdf

Posted in FreeBSD on May 3, 2012 by kiranopatil

Convert a man page to pdf

man -t ndisgen | ps2pdf – > ndisgen.pdf

Install Webmin Application on FreeBSD

Posted in FreeBSD on December 10, 2011 by kiranopatil

Install Webmin Application on FreeBSD

Webmin is a web-based interactive tool used for remote administration work for UNIX & Linux systems. It is very useful tool for administrators.

To Install Webmin, First you need to update the ports

#portsnap fetch update

Execute Webmin command

# cd /usr/ports/sysutils/webmin

# make install clean

Configure Webmin the service

# vi /etc/rc.conf

Add following line


Save and close the file.You need to run the Script to setup various configure files

# cd /usr/local/lib/webmin/

# ./



*            Welcome to the Webmin setup script, version 1.570        *


Webmin is a web-based interface that allows Unix-like operating

systems and common Unix services to be easily administered.

Installing Webmin in /usr/local/lib/webmin …


Webmin uses separate directories for configuration files and log files.

Unless you want to run multiple versions of Webmin at the same time

you can just accept the defaults.

Log file directory [/var/log/webmin]: (Default press Enter Button)


Webmin is written entirely in Perl. Please enter the full path to the

Perl 5 interpreter on your system.

Full path to perl (default /usr/bin/perl): (Default press Enter Button)

Testing Perl …

Perl seems to be installed ok


Operating system name:    FreeBSD

Operating system version: 8.0


Webmin uses its own password protected web server to provide access

to the administration programs. The setup script needs to know :

– What port to run the web server on. There must not be another

web server already using this port.

– The login name required to access the web server.

– The password required to access the web server.

– If the webserver should use SSL (if your system supports it).

– Whether to start webmin at boot time.

Web server port (default 10000): (Default press Enter Button)

Login name (default admin): (Default press Enter Button)

Login password: (Type the password )

Password again: (Type the password )

Use SSL (y/n):  (Type if you want SSL press y or n)


Creating web server config files..


Creating access control file..


Creating start and stop scripts..


Copying config files..


Changing ownership and permissions ..


Running postinstall scripts ..

PID file /var/log/webmin/ does not exist

: Permission denied

syslog-ng: not found

: Permission denied


Enabling background status collection ..

PID file /var/log/webmin/ does not exist


To start the Webmin service.

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

Run any browser, type the server name or IP with respective of  :10000.


Login page.


Network Bandwidth & Traffic Monitoring

Posted in FreeBSD on September 29, 2011 by kiranopatil

Go through the steps to install darkstat package on FreeBSD

# cd /usr/ports/net-mgmt/darkstat

# make # make install clean

Enable darkstat at boot time add the following lines to

/etc/rc.conf: darkstat_enable=”YES”


Change the darkstat_interface to point your network interface Add the following lines to /etc/rc.conf:





Now the darkstat installed and configured let’s start it:

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

To check darkstat daemon status:

# /usr/local/etc/rc.d/darkstat status

By Default it works on 667 port, to check the Network traffic

Here you go


Enable or Disable Root Login for SSH

Posted in FreeBSD on September 20, 2011 by kiranopatil

Enable or Disable Root Login for SSH


to enable root login

vi sshd_config

PermitRootLogin yes

to disable root login

vi sshd_config

PermitRootLogin no

After you do the changes, save and exit
Then restart sshd service
/etc/rc.d/sshd restart

On Linux

/etc/init.d/sshd restart

Installing GNOME in FreeBSD

Posted in FreeBSD on September 20, 2011 by kiranopatil

Installing GNOME in FreeBSD
Here is the few steps must follow to install GNOME on Freebsd.
I. Install required packages for gnome
# pkg_add -v -r xorg
# pkg_add -v -r gnome2
II. Add these lines in
III. add this line in /etc/fstab:
proc /proc procfs rw 0 0
IV. Reboot.