Tuesday, October 5, 2010

Cacti Network Graphing Tool RedHat / CentOS / Fedora Install and Configure


Cacti is a network graphing tool similar to MRTG. How do I install and configure common options to collect SNMP data and various other data (such as system load, network link status, hard disk space, logged in users etc) into an RRD?

From the official project site:
Cacti is a complete frontend to RRDTool, it stores all of the necessary information to create graphs and populate them with data in a MySQL database. The frontend is completely PHP driven. Along with being able to maintain Graphs, Data Sources, and Round Robin Archives in a database, cacti handles the data gathering. There is also SNMP support for those used to creating traffic graphs with MRTG.

Required software(s)

You need to install the following software on RHEL / Fedora / CentOS Linux:
  1. MySQL Server : Store cacti data.
  2. NET-SNMP server - SNMP (Simple Network Management Protocol) is a protocol used for network management.
  3. PHP with net-snmp module - Access SNMP data using PHP.
  4. Apache / lighttpd / ngnix webserver : Web server to display graphs created with PHP and RRDTOOL.

Install the software

First  to install mysql, apache and php:
# yum install mysql-server mysql php-mysql php-pear php-common php-gd php-devel php php-mbstring php-cli php-snmp php-pear-Net-SMTP php-mysql httpd

Configure MySQL server

First, set root password:
# mysqladmin -u root password NEWPASSWORD

Create cacti MySQL database

Create a database called cacti, enter:
# mysql -u root -p -e 'create database cacti'
Create a user called cacti with a password called catipass, enter:
# mysql -u root -p
mysql> GRANT ALL ON cacti.* TO cacti@localhost IDENTIFIED BY 'catipass;
mysql> FLUSH privileges;
mysql> \q

Install snmpd

Type the following command to install net-snmpd
# yum install net-snmp-utils php-snmp net-snmp-libs
Configure snmpd, open /etc/snmp/snmpd.conf
# vi /etc/snmp/snmpd.conf
Append / modify it as follows (see snmpd.conf man page for details):
com2sec local     localhost           public
group MyRWGroup v1         local
group MyRWGroup v2c        local
group MyRWGroup usm        local
view all    included  .1                               80
access MyRWGroup ""      any       noauth    exact  all    all    none
syslocation Unknown (edit /etc/snmp/snmpd.conf)
syscontact Root  (configure /etc/snmp/snmp.local.conf)
pass .1.3.6.1.4.1.4413.4.1 /usr/bin/ucd5820stat
Save and close the file. Turn on snmpd service:
# /etc/init.d/snmpd start
# chkconfig snmpd on

Make sure you are getting information from snmpd:
# snmpwalk -v 1 -c public localhost IP-MIB::ipAdEntIfIndex
Sample ouptut:
IP-MIB::ipAdEntIfIndex.10.10.9.108 = INTEGER: 2
IP-MIB::ipAdEntIfIndex.67.yy.zz.eee = INTEGER: 3
IP-MIB::ipAdEntIfIndex.127.0.0.1 = INTEGER: 1

Install cacti

First, make sure EPEL repo is enabled. Type the following command to install cacti:
# yum install cacti

Install cacti tables

Type the following command to find out cacti.sql path:
# rpm -ql cacti | grep cacti.sql
Sample output:
/var/www/cacti/cacti.sql
Type the following command to install cacti tables (you need to type the cacti user password):
# mysql -u cacti -p cacti < /usr/share/doc/cacti-0.8.7g/cacti.sql

Configure cacti

Open /etc/cacti/db.php file, enter:
# vi /etc/cacti/db.php
Make changes as follows:
 
/* make sure these values refect your actual database/host/user/password */
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cacti";
$database_password = "cactipass";
$database_port = "3306";
 
Save and close the file.

Configure httpd

Open /etc/httpd/conf.d/cacti.conf file, enter:
# vi /etc/httpd/conf.d/cacti.conf
You need to update allow from line. Either set to ALL or your LAN subnet to allow access to cacti:
 
#
# Cacti: An rrd based graphing tool
#
Alias /cacti    /usr/share/cacti
  Directory /usr/share/cacti 
Order Deny,Allow
        Deny from all
        Allow from 10.0.0.0/8 
Directory
 
Another option is create /usr/share/cacti/.htaccess file and password protect the directory. Finally, restart httpd:
# service httpd restart

Setup cacti cronjob

Open /etc/cron.d/cacti file, enter:
# vi /etc/cron.d/cacti
Uncomment the line:
*/5 * * * *     cacti   /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1
Save and close the file.

Run cacti installer

Now cacti is ready to install. Fire a webbrowser and type the url:
http://your.example.com/cacti/
OR
http://your.server.ip.address/cacti/
Just follow on screen instructions. The default username and password for cacti is admin / admin. Upon first login, you will be force to change the default password.

How do I configure SNMP data collection?

SNMP can be used to monitor server traffic. Once installed login to cacti.
=> Click on Devices
=> Select Localhost
=> Make sure SNMP options are selected as follows:
Fig.01: SNMP configuration
Fig.01: SNMP configuration
Finally, click on Save button.

How do I create SNMP graphs?

Click on "Create Graphs for this Host" link on top right side.
Select SNMP - Interface Statistics
Select a graph type (such as In/Out bytes with total bandwidth)
Finally, click on Create button.

How do I view graphs?

To view graphs click on Graphs tab. Here is sample graph from one my own box:
Fig.02: Cacti in Action - Memory, CPU and Network Usage
Fig.02: Cacti in Action - Memory, CPU and Network Usage

(Fig.02: Cacti in action)
Fig.03: Cacti in Action Disk, Load average and User stats
Fig.03: Cacti in Action Disk, Load average and User stats

MySQLTuner - High-performance MySQL optimization script

Running MySQLTuner:

MySQLTuner using the following command
# wget http://mysqltuner.com/mysqltuner.pl
To run the script, simply make it executable and run it:
# chmod +x mysqltuner.pl
# ./mysqltuner.pl
Enter your administrative username and password
Output you can see as follows

Bandwidth Monitoring Tools For CentOS /RHEL / Fedora.


Bandwidthd
BandwidthD tracks usage of TCP/IP network subnets and builds html files with graphs to display utilization. Charts are built by individual IPs, and by default display utilization over 2 day, 8 day, 40 day, and 400 day periods. Furthermore, each ip address’s utilization can be logged out at intervals of 3.3 minutes, 10 minutes, 1 hour or 12 hours in cdf format, or to a backend database server. HTTP, TCP, UDP, ICMP, VPN, and P2P traffic are color coded.
Project Home Page :- http://bandwidthd.sourceforge.net/
Bmon
bmon is a portable bandwidth monitor and rate estimator running on various operating systems. It supports various input methods for different architectures. Various output modes exist including an interactive curses interface,lightweight HTML output but also formatable ASCII output.
Bwbar
bwbar is a small C-based program for Linux-based machines which produces bandwidth usage statistics for a network interfaces. It was originally written by H. Peter Anvin, and I (Brian Towne) modified it somewhat to better suit my needs. The original program was released under the GPL. A number of people have asked for the modified program and its source, so I have created this page.
bwm
This is a very tiny bandwidth monitor (not X11). Can monitor up to 16 interfaces in the in the same time, and shows totals too.
bwm-ng
small and simple console-based bandwidth monitor.Bandwidth Monitor NG is a small and simple console-based live bandwidth monitor.
Project Home Page :- http://www.gropp.org/?id=projects&sub=bwm-ng
Cacti
Cacti is a complete network graphing solution designed to harness the power of RRDTool’s data storage and graphing functionality. Cacti provides a fast poller, advanced graph templating, multiple data acquisition methods, and user management features out of the box. All of this is wrapped in an intuitive, easy to use interface that makes sense for LAN-sized installations up to complex networks with hundreds of devices.
Project Home Page :- http://cacti.net/
cbm
cbm — the color bandwidth meter — is a small program to display the traffic currently flowing through your network devices.
dstat
Dstat is a versatile replacement for vmstat, iostat, netstat, nfsstat and ifstat. Dstat overcomes some of their limitations and adds some extra features, more counters and flexibility. Dstat is handy for monitoring systems during performance tuning tests, benchmarks or troubleshooting.
Project Home Page :- http://dag.wieers.com/home-made/dstat/
EtherApe
EtherApe is a graphical network monitor for Unix modeled after etherman. Featuring link layer, ip and TCP modes, it displays network activity graphically. Hosts and links change in size with traffic. Color coded protocols display.
Project Home Page :- http://etherape.sourceforge.net/
gdesklets
gDesklets is a system for bringing mini programs (desklets), such as weather forecasts, news tickers, system information displays, or music player controls, onto your desktop, where they are sitting there in a symbiotic relationship of eye candy and usefulness. The possibilities are really endless and they are always there to serve you whenever you need them, just one key-press away. The system is not restricted to one desktop environment, but currently works on most of the modern Unix desktops (including GNOME, KDE, Xfce).
Project Home Page :- http://www.gdesklets.de/
GKrellM
GKrellM is a single process stack of system monitors which supports applying themes to match its appearance to your window manager, Gtk, or any other theme.
Project Home Page :- http://members.dslextreme.com/users/billw/gkrellm/gkrellm.html
ipband
ipband is a pcap based IP traffic monitor. It tallies per-subnet traffic and bandwidth usage and starts detailed logging if specified threshold for the specific subnet is exceeded. If traffic has been high for a certain period of time, the report for that subnet is generated which can be appended to a file or e-mailed. When bandwidth usage drops below the threshold, detailed logging for the subnet is stopped and memory is freed.
Project Home Page :- http://ipband.sourceforge.net/
iftop
iftop does for network usage what top does for CPU usage. It listens to network traffic on a named interface and displays a table of current bandwidth usage by pairs of hosts. Handy for answering the question “why is our ADSL link so slow”.
Project Home Page :- http://www.ex-parrot.com/pdw/iftop/
iperf
Iperf is a tool to measure maximum TCP bandwidth, allowing the tuning of various parameters and UDP characteristics. Iperf reports bandwidth, delay jitter, datagram loss.
ipfm
IP Flow Meter (IPFM) is a bandwidth analysis tool, that measures how much bandwidth specified hosts use on their Internet link.
Project Home Page :- http://robert.cheramy.net/ipfm/
ifstat
ifstat is a tool to report network interfaces bandwith just like vmstat/iostat do for other system counters.
Project Home Page :- http://gael.roualland.free.fr/ifstat/
ibmonitor
ibmonitor is an interactive linux console application which shows bandwidth consumed and total data transferred on all
interfaces.
Project Home Page :- http://ibmonitor.sourceforge.net/
ipaudit
IPAudit monitors network activity on a network by host, protocol and port.IPAudit listens to a network device in promiscuous mode, and records every connection between two ip addresses. A unique connection is determined by the ip
addresses of the two machines, the protocol used between them, and the port numbers (if they are communicating via udp or tcp).
Project Home Page :- http://ipaudit.sourceforge.net/
IPTraf
IPTraf is a console-based network statistics utility for Linux. It gathers a variety of figures such as TCP connection packet and byte counts, interface statistics and activity indicators, TCP/UDP traffic breakdowns, and LAN station packet and byte counts.
Project Home Page :- http://iptraf.seul.org/
IFStatus
IFStatus was developed for Linux users that are usually in console mode. It is a simple, easy to use program for displaying commonly needed / wanted statistics in real time about ingoing and outgoing traffic of multiple network interfaces that is usually hard to find, with a simple and effecient view. It is the substitute for PPPStatus and EthStatus projects.
jnettop
Jnettop is a traffic visualiser, which captures traffic going through the host it is running from and displays streams sorted by bandwidth they use.
Project Home Page :- http://jnettop.kubs.info/wiki/
MRTG
The Multi Router Traffic Grapher (MRTG) is a tool to monitor the traffic load on network links. MRTG generates HTML pages containing PNG images which provide a LIVE visual representation of this traffic.
Project Home Page :- http://oss.oetiker.ch/mrtg/
moodss
moodss is a graphical monitoring application. It is modular so that the code accessing the monitored objects is completely separate from the application core. The core takes care of managing modules (loading and unloading),displaying modules data through sortable tables and diverse graphical viewers, handling user set threshold conditions with email alerts, recording and browsing data history from a database.moodss can even predict the future, using sophisticated statistical methods and artificial neural networks, and therefore be used for capacity planning.
Project Home Page :- http://moodss.sourceforge.net/
monitord
A lightweight (distributed?) network security monitor for TCP/IP+Ethernet LANs. It will capture certain network events and record them in a relational database. The recorded data will be available for analysis through a CGI based interface.
Project Home Page :- http://sourceforge.net/projects/monitord/
Netmrg
NetMRG is a tool for network monitoring, reporting, and graphing. Based on RRDTOOL, the best of open source graphing
systems, NetMRG is capable of creating graphs of any parameter of your network.
Project Home Page :- http://www.netmrg.net
nload
nload is a console application which monitors network traffic and bandwidth usage in real time. It visualizes the in-and outgoing traffic using two graphs and provides additional info like total amount of transfered data and min/max network usage.
Project Home Page :- http://www.roland-riegel.de/nload/index.html
ntop
ntop shows the current network usage. It displays a list of hosts that are currently using the network and reports information concerning the IP (Internet Protocol) and Fibre Channel (FC) traffic generated by each host. The traffic is sorted according to host and protocol. Default protocol list (this is user configurable).
Project Home Page :- http://www.ntop.org
netspeed
Netspeed is just a little GNOME-applet that shows how much traffic occurs on a specified network device (for example eth0). You get the best impression of it, if you look at the screenshots below.
Netwatch
Netwatch is a Linux program created to aid in monitoring Network Connections. It is based on a program called “statnet” but has been substantially modified for its Ethernet emphasis. It is a dynamic program which displays the Ethernet status based each the connection’s activity. It has the capability of monitoring hundreds of site statistics simultaneously. The connection’s port number (Well Known Service) and destination address are available as well. There are options which allow router statistics to be measured on simple networks (with one router). External network communication is counted and transfer rates are displayed.
Project Home Page :- http://www.slctech.org/~mackay/netwatch.html
NOCOL
NOCOL is a popular system and network monitoring (network management) software that runs on Unix systems and can
monitor network and system devices. It uses a very simple architecture and is very flexible for adding new network management modules
Project Home Page :- http://www.netplex-tech.com/nocol/
NeTraMet
NeTraMet is an open-source (GPL) implementation of the RTFM architecture for Network Traffic Flow Measurement,
developed and supported by Nevil Brownlee at the University of Auckland. Nevil also developed a version of NeTraMet
which uses the CoralReef library to read packet headers. This ‘CoralReef NeTraMet meter’ can work with any CoralReef
data source; it has been tested on both CAIDA and NLANR trace files, and on DAG and Apptel ATM interface cards.
Project Home Page :- http://freshmeat.net/projects/netramet/
NetPIPE
NetPIPE is a protocol independent performance tool that visually represents the network performance under a variety of
conditions. It performs simple ping-pong tests, bouncing messages of increasing size between two processes, whether
across a network or within an SMP system. Message sizes are chosen at regular intervals, and with slight perturbations, to provide a complete test of the communication system. Each data point involves many ping-pong tests to provide an accurate timing. Latencies are calculated by dividing the round trip time in half for small messages ( <64 Bytes ).
Project Home Page :- http://www.scl.ameslab.gov/netpipe/
netperf
Netperf is a benchmark that can be use to measure various aspect of networking performance. The primary foci are bulk
(aka unidirectional) data transfer and request/response performance using either TCP or UDP and the Berkeley Sockets interface. As of this writing, the tests available either unconditionally or conditionally
Project Home Page :- http://www.netperf.org/netperf/
potion
This is a console utility which will listen on an interface using libpcap, aggregate the traffic into flows and display the top (as many as can fit on your screen) flows with their average throughput. A flow is identified ip protocol, source ip, source port, destination ip, destination port, and type of service flag.
pktstat
Display a real-time list of active connections seen on a network interface, and how much bandwidth is being used by what. Partially decodes HTTP and FTP protocols to show what filename is being transferred. X11 application names are also shown. Entries hang around on the screen for a few seconds so you can see what just happened. Also accepts filter expressions á la tcpdump.
Project Home Page :- http://www.adaptive-enterprises.com.au/~d/software/pktstat/
RTG
RTG is a flexible, scalable, high-performance SNMP statistics monitoring system. It is designed for enterprises and service providers who need to collect time-series SNMP data from a large number of targets quickly. All collected data is inserted into a relational database that provides a common interface for applications to generate complex queries and reports. RTG includes utilities that generate configuration and target files, traffic reports, 95th percentile reports and graphical data plots. These utilities may be used to produce a web-based interface to the data.
Project Home Page :- http://rtg.sourceforge.net/
speedometer
Monitor network traffic or speed/progress of a file transfer. The program can be used for cases like: how long it will take for my 38MB transfer to finish, how quickly is another transfer going, How fast is the upstream on this ADSL line and how fast can I write data to my filesystem.
Project Home Page :- http://excess.org/speedometer/
Spong
Spong is a simple system-monitoring package written in Perl. It features client based monitoring, monitoring of network services, results displayed via the Web or console, history of problems, and flexible messaging when problems occur.
Project Home Page :- http://spong.sourceforge.net/
slurm
slurm started as a pppstatus port to FreeBSD. As I ripped off several functions
SNIPS
SNIPS (System & Network Integrated Polling Software) is a system and network monitoring software that runs on Unix systems and can monitor network and system devices. It is capable of monitoring DNS, NTP, TCP or web ports, host performance, syslogs, radius servers, BGP peers, etc. New monitors can be added easily (via a C or Perl API).
Project Home Page :- http://www.navya.com/software/snips/
tcpflow
tcpflow is a program that captures data transmitted as part of TCP connections (flows), and stores the data in a way
that is convenient for protocol analysis or debugging. A program like tcpdump shows a summary of packets seen on the
wire, but usually doesn’t store the data that’s actually being transmitted. In contrast, tcpflow reconstructs the actual data streams and stores each flow in a separate file for later analysis. tcpflow understands TCP sequence numbers and will correctly reconstruct data streams regardless of retransmissions or out-of-order delivery.
Project Home Page :- http://www.circlemud.org/~jelson/software/tcpflow/
vnstat
vnStat is a network traffic monitor for Linux that keeps a log of daily network traffic for the selected interface(s).vnStat isn’t a packet sniffer. The traffic information is analyzed from the /proc -filesystem, so vnStat can be used without root permissions. However at least a 2.2.x kernel is required.
Project Home Page :- http://humdi.net/vnstat/
WMND
Shows a graph of incoming/outgoing traffic, activity indicators for rx/tx and current/maximum rate for rx/tx in bytes or packets.Tailored for use with WindowMaker, it will as well work with any other window manager though.
Project Home Page :- http://dockapps.org/file.php/id/178


Tuesday, September 28, 2010

Memory use by which process Centos / RHEL /Fedora

#ps aux | awk '{if ($5 != 0 ) print $2,$5,$6,$11}' | sort -k2n

Wednesday, September 22, 2010

5 Step Jboss set up RHEL/Cent OS 5.X

Step:1:-  yum install mysql mysql-server java-1.6.0-openjdk -y
Step:2:- service mysqld start
Step:3:- wget  http://sourceforge.net/projects/jboss/files/JBoss/JBoss-6.0.0.M4/jboss-as-
distribution-6.0.0.20100721-M4.zip/download
Step:4:- unzip jboss-as-distribution-6.0.0.20100721-M4.zip
Step:5:- /opt/jboss/bin/run.sh

http://yourdomain.com:8080 

Monday, September 20, 2010

Install Latest postgresql using yum from pgsqlrpms


[root@ip-173-201-21-11 ~]# wget http://yum.pgsqlrpms.org/reporpms/8.4/pgdg-centos-8.4-2.noarch.rpm
[root@ip-173-201-21-11 ~]# rpm -ivh pgdg-centos-8.4-2.noarch.rpm
[root@ip-173-201-21-11 ~]# yum install postgresql postgresql-devel postgresql-server postgis pgadmin postgresql-contrib
[root@ip-173-201-21-11 ~]# chkconfig postgresql on
[root@ip-173-201-21-11 ~]# service postgresql initdb
[root@ip-173-201-21-11 ~]# chkconfig postgresql on && service postgresql start
[root@ip-173-201-21-11 ~]# psql --version
psql (PostgreSQL) 8.4.4
contains support for command-line editing

#########################################
vi /var/lib/pgsql/data/postgresql.conf
# – Connection Settings -
listen_addresses = ‘*’
port = 5432

CPULOAD and send email to admin

This script is very useful for system admins, it checks Cpuload and get info of which process takes the cpuload, if cpuload is or above 70%  it sends alert email to admin
==============================
#!/bin/bash
# Shell script to monitor or watch the high cpu-load
# It will send an email to $ADMIN, if the (cpu load is in %) percentage
# of cpu-load is >= 70%
# If you have any suggestion or question please email to raviindiangnu org
# set admin email so that you can get email
# set alert level 70% is default
# you can set it to string LOAD with your value

AWK=/bin/awk
SAR=/usr/bin/sar
GREP=/bin/grep
TR=/usr/bin/tr
HEAD=/usr/bin/head
PS=/bin/ps
SORT=/bin/sort
HOSTNAME=yeswedeal.com
SED=/bin/sed
LOAD=70
CAT=/bin/cat
MAILFILE=/tmp/mailviews$$
MAILER=/bin/mail
mailto=”rajatjpatel@yeswedeal.com”
for path in $PATHS
do
CPU_LOAD=`$SAR -P ALL 1 2 | $GREP ‘Average.*all’ | $AWK -F” ” ‘{ print 100.0 -$NF}’`
echo $CPU_LOAD
if [[ $CPU_LOAD > $LOAD ]];
then
PROC=`$PS -eo pcpu,pid -o comm= | $SORT -k1 -n -r | $HEAD -1`
echo “Please check your processess on ${HOSTNAME} the value of cpu load is $CPU_LOAD % & $PROC” > $MAILFILE
$CAT $MAILFILE | $MAILER -s “CPU Load is $CPU_LOAD % on ${HOSTNAME}” $mailto
fi
done
=============================
After  end of  schedule cron job for this script like below
*/30 * * * * /bin/sh /root/cpuload.sh >/dev/null 2>&1

How to install GeoIP and mod_geoip2 on RHEL/Cent OS for apache

How to install GeoIP and mod_geoip2 on centos for apache
1) yum install GeoIP GeoIP-devel GeoIP-data zlib-devel
2) mkdir /usr/local/share/GeoIP
3) Download the latest Country and City database files from maxmind
cd /usr/local/share/GeoIP
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
gunzip GeoIP.dat.gz
gunzip GeoLiteCity.dat.gz
4) yum install httpd-devel apr-devel
5) wget http://geolite.maxmind.com/download/geoip/api/mod_geoip2/
6) tar xvzf mod_geoip2_1.2.5.tar.gz && cd mod_geoip2_1.2.5
7) apxs -i -a -L/usr/lib64 -I/usr/include -lGeoIP -c mod_geoip.c
8) Enabling mod-geoip
Nothing’s going to work unless mod-geoip is enabled in your apache configuration. You’ll need the following lines in your httpd.conf file (located on CentOS systems at /etc/httpd/conf/httpd.conf)
IfModule mod_geoip.c
GeoIPEnable On
GeoIPDBFile /usr/local/share/GeoIP/GeoIP.dat Standard
GeoIPDBFile /usr/local/share/GeoIP/GeoLiteCity.dat Standard
IfModule
9) Restart Apache so your changes will take effect by entering the following command.
#/etc/init.d/httpd restart
10) /usr/local/bin/geoipupdate

Wednesday, September 15, 2010

Install tomcat6 in 3 step Cent OS

cd /etc/yum.repos.d
wget 'http://www.jpackage.org/jpackage50.repo'
yum install tomcat6 tomcat6-webapps tomcat6-admin-webapps
service tomcat6 start
 http://localhost:8080

Thursday, September 9, 2010

Installation and configuration wordpress in 5 min

rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm

yum install mysql mysql-server httpd php php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc phpmyadmin

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
rightscale-epel                                          |  951 B     00:00    
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package httpd.i386 0:2.2.3-31.el5.centos.4 set to be updated
---> Package mysql.i386 0:5.0.77-4.el5_4.2 set to be updated
--> Processing Dependency: perl(DBI) for package: mysql
---> Package mysql-server.i386 0:5.0.77-4.el5_4.2 set to be updated
--> Processing Dependency: perl-DBD-MySQL for package: mysql-server
---> Package php.i386 0:5.2.4-el5.centos set to be updated
--> Processing Dependency: php-common = 5.2.4-el5.centos for package: php
--> Processing Dependency: php-cli = 5.2.4-el5.centos for package: php
---> Package php-gd.i386 0:5.2.4-el5.centos set to be updated
---> Package php-imap.i386 0:5.2.4-el5.centos set to be updated
--> Processing Dependency: libc-client.so.1 for package: php-imap
---> Package php-ldap.i386 0:5.2.4-el5.centos set to be updated
---> Package php-mysql.i386 0:5.2.4-el5.centos set to be updated
--> Processing Dependency: php-pdo for package: php-mysql
---> Package php-odbc.i386 0:5.2.4-el5.centos set to be updated
--> Processing Dependency: libodbcpsql.so.2 for package: php-odbc
--> Processing Dependency: libodbc.so.1 for package: php-odbc
---> Package php-pear.noarch 1:1.4.9-6.el5 set to be updated
--> Processing Dependency: php-devel for package: php-pear
---> Package php-xml.i386 0:5.2.4-el5.centos set to be updated
--> Processing Dependency: libexslt.so.0 for package: php-xml
--> Processing Dependency: libxslt.so.1 for package: php-xml
---> Package php-xmlrpc.i386 0:5.2.4-el5.centos set to be updated
---> Package phpMyAdmin.noarch 0:2.11.10-1.el5 set to be updated
--> Processing Dependency: php-mcrypt >= 4.1.0 for package: phpMyAdmin
--> Processing Dependency: php-mbstring >= 4.1.0 for package: phpMyAdmin
--> Running transaction check
---> Package libc-client.i386 0:2004g-2.2.1 set to be updated
---> Package libxslt.i386 0:1.1.17-2.el5_2.2 set to be updated
---> Package perl-DBD-MySQL.i386 0:3.0007-2.el5 set to be updated
---> Package perl-DBI.i386 0:1.52-2.el5 set to be updated
---> Package php-cli.i386 0:5.2.4-el5.centos set to be updated
---> Package php-common.i386 0:5.2.4-el5.centos set to be updated
---> Package php-devel.i386 0:5.2.4-el5.centos set to be updated
---> Package php-mbstring.i386 0:5.2.4-el5.centos set to be updated
---> Package php-mcrypt.i386 0:5.2.4-el5.centos set to be updated
--> Processing Dependency: libmcrypt.so.4 for package: php-mcrypt
---> Package php-pdo.i386 0:5.2.4-el5.centos set to be updated
---> Package unixODBC.i386 0:2.2.11-7.1 set to be updated
--> Running transaction check
---> Package libmcrypt.i386 0:2.5.8-4.el5.centos set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package           Arch      Version                   Repository          Size
================================================================================
Installing:
 httpd             i386      2.2.3-31.el5.centos.4     updates            1.2 M
 mysql             i386      5.0.77-4.el5_4.2          updates            4.8 M
 mysql-server      i386      5.0.77-4.el5_4.2          updates            9.8 M
 php               i386      5.2.4-el5.centos          rightscale-epel    3.6 M
 php-gd            i386      5.2.4-el5.centos          rightscale-epel    319 k
 php-imap          i386      5.2.4-el5.centos          rightscale-epel    103 k
 php-ldap          i386      5.2.4-el5.centos          rightscale-epel     56 k
 php-mysql         i386      5.2.4-el5.centos          rightscale-epel    261 k
 php-odbc          i386      5.2.4-el5.centos          rightscale-epel    112 k
 php-pear          noarch    1:1.4.9-6.el5             base               344 k
 php-xml           i386      5.2.4-el5.centos          rightscale-epel    309 k
 php-xmlrpc        i386      5.2.4-el5.centos          rightscale-epel    129 k
 phpMyAdmin        noarch    2.11.10-1.el5             epel               4.2 M
Installing for dependencies:
 libc-client       i386      2004g-2.2.1               base               516 k
 libmcrypt         i386      2.5.8-4.el5.centos        extras             116 k
 libxslt           i386      1.1.17-2.el5_2.2          base               485 k
 perl-DBD-MySQL    i386      3.0007-2.el5              base               148 k
 perl-DBI          i386      1.52-2.el5                base               600 k
 php-cli           i386      5.2.4-el5.centos          rightscale-epel    2.6 M
 php-common        i386      5.2.4-el5.centos          rightscale-epel    352 k
 php-devel         i386      5.2.4-el5.centos          rightscale-epel    553 k
 php-mbstring      i386      5.2.4-el5.centos          rightscale-epel    1.3 M
 php-mcrypt        i386      5.2.4-el5.centos          rightscale-epel     44 k
 php-pdo           i386      5.2.4-el5.centos          rightscale-epel    157 k
 unixODBC          i386      2.2.11-7.1                base               832 k

Transaction Summary
================================================================================
Install     25 Package(s)        
Update       0 Package(s)        
Remove       0 Package(s)        

Total download size: 33 M
Is this ok [y/N]: y
Downloading Packages:
(1/25): php-mcrypt-5.2.4-el5.centos.i386.rpm             |  44 kB     00:00    
(2/25): php-ldap-5.2.4-el5.centos.i386.rpm               |  56 kB     00:00    
(3/25): php-imap-5.2.4-el5.centos.i386.rpm               | 103 kB     00:00    
(4/25): php-odbc-5.2.4-el5.centos.i386.rpm               | 112 kB     00:00    
(5/25): libmcrypt-2.5.8-4.el5.centos.i386.rpm            | 116 kB     00:00    
(6/25): php-xmlrpc-5.2.4-el5.centos.i386.rpm             | 129 kB     00:00    
(7/25): perl-DBD-MySQL-3.0007-2.el5.i386.rpm             | 148 kB     00:00    
(8/25): php-pdo-5.2.4-el5.centos.i386.rpm                | 157 kB     00:00    
(9/25): php-mysql-5.2.4-el5.centos.i386.rpm              | 261 kB     00:00    
(10/25): php-xml-5.2.4-el5.centos.i386.rpm               | 309 kB     00:00    
(11/25): php-gd-5.2.4-el5.centos.i386.rpm                | 319 kB     00:00    
(12/25): php-pear-1.4.9-6.el5.noarch.rpm                 | 344 kB     00:00    
(13/25): php-common-5.2.4-el5.centos.i386.rpm            | 352 kB     00:00    
(14/25): libxslt-1.1.17-2.el5_2.2.i386.rpm               | 485 kB     00:00    
(15/25): libc-client-2004g-2.2.1.i386.rpm                | 516 kB     00:00    
(16/25): php-devel-5.2.4-el5.centos.i386.rpm             | 553 kB     00:00    
(17/25): perl-DBI-1.52-2.el5.i386.rpm                    | 600 kB     00:00    
(18/25): unixODBC-2.2.11-7.1.i386.rpm                    | 832 kB     00:00    
(19/25): httpd-2.2.3-31.el5.centos.4.i386.rpm            | 1.2 MB     00:00    
(20/25): php-mbstring-5.2.4-el5.centos.i386.rpm          | 1.3 MB     00:00    
(21/25): php-cli-5.2.4-el5.centos.i386.rpm               | 2.6 MB     00:00    
(22/25): php-5.2.4-el5.centos.i386.rpm                   | 3.6 MB     00:00    
(23/25): phpMyAdmin-2.11.10-1.el5.noarch.rpm             | 4.2 MB     00:00    
(24/25): mysql-5.0.77-4.el5_4.2.i386.rpm                 | 4.8 MB     00:00    
(25/25): mysql-server-5.0.77-4.el5_4.2.i386.rpm          | 9.8 MB     00:00    
--------------------------------------------------------------------------------
Total                                            15 MB/s |  33 MB     00:02    
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : php-common                                              1/25
  Installing     : perl-DBI                                                2/25
  Installing     : mysql                                                   3/25
  Installing     : php-cli                                                 4/25
  Installing     : php-pdo                                                 5/25
  Installing     : httpd                                                   6/25
  Installing     : php                                                     7/25
  Installing     : php-mysql                                               8/25
  Installing     : perl-DBD-MySQL                                          9/25
  Installing     : php-mbstring                                           10/25
  Installing     : libc-client                                            11/25
  Installing     : unixODBC                                               12/25
  Installing     : libxslt                                                13/25
  Installing     : libmcrypt                                              14/25
  Installing     : php-mcrypt                                             15/25
  Installing     : php-xml                                                16/25
  Installing     : php-odbc                                               17/25
  Installing     : php-imap                                               18/25
  Installing     : mysql-server                                           19/25
  Installing     : php-gd                                                 20/25
  Installing     : php-ldap                                               21/25
  Installing     : php-xmlrpc                                             22/25
  Installing     : php-devel                                              23/25
  Installing     : phpMyAdmin                                             24/25
  Installing     : php-pear                                               25/25

Installed:
  httpd.i386 0:2.2.3-31.el5.centos.4      mysql.i386 0:5.0.77-4.el5_4.2       
  mysql-server.i386 0:5.0.77-4.el5_4.2    php.i386 0:5.2.4-el5.centos         
  php-gd.i386 0:5.2.4-el5.centos          php-imap.i386 0:5.2.4-el5.centos    
  php-ldap.i386 0:5.2.4-el5.centos        php-mysql.i386 0:5.2.4-el5.centos   
  php-odbc.i386 0:5.2.4-el5.centos        php-pear.noarch 1:1.4.9-6.el5       
  php-xml.i386 0:5.2.4-el5.centos         php-xmlrpc.i386 0:5.2.4-el5.centos  
  phpMyAdmin.noarch 0:2.11.10-1.el5     

Dependency Installed:
  libc-client.i386 0:2004g-2.2.1          libmcrypt.i386 0:2.5.8-4.el5.centos  
  libxslt.i386 0:1.1.17-2.el5_2.2         perl-DBD-MySQL.i386 0:3.0007-2.el5   
  perl-DBI.i386 0:1.52-2.el5              php-cli.i386 0:5.2.4-el5.centos      
  php-common.i386 0:5.2.4-el5.centos      php-devel.i386 0:5.2.4-el5.centos    
  php-mbstring.i386 0:5.2.4-el5.centos    php-mcrypt.i386 0:5.2.4-el5.centos   
  php-pdo.i386 0:5.2.4-el5.centos         unixODBC.i386 0:2.2.11-7.1           

Complete!
[root@domU-12-31-39-13-CD-47 ~]# service httpd restart
Stopping httpd:                                            [FAILED]
Starting httpd:                                            [  OK  ]
[root@domU-12-31-39-13-CD-47 ~]# service mysqld restart
Stopping MySQL:                                            [FAILED]
Initializing MySQL database:  Installing MySQL system tables...
100909 12:57:03 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295
100909 12:57:03 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295
OK
Filling help tables...
100909 12:57:03 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295
100909 12:57:03 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h domU-12-31-39-13-CD-47 password 'new-password'

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/bin/mysqlbug script!

The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
                                                           [  OK  ]
Starting MySQL:                                            [  OK  ]
[root@domU-12-31-39-13-CD-47 ~]#

vi /etc/httpd/conf.d/phpMyAdmin.conf

# phpMyAdmin - Web based MySQL browser written in php
#
# Allows only localhost by default
#
# But allowing phpMyAdmin to anyone other than localhost should be considered
# dangerous unless properly secured by SSL

Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin
#Directory /usr/share/phpMyAdmin
#   order deny,allow
#   deny from all
#   allow from 127.0.0.1
#   allow from ::1
#Directory

# This directory does not require access over HTTP - taken from the original
# phpMyAdmin upstream tarball
#
Directory /usr/share/phpMyAdmin/libraries
    Order Deny,Allow
    Deny from All
    Allow from None
Directory

# This configuration prevents mod_security at phpMyAdmin directories from
# filtering SQL etc.  This may break your mod_security implementation.
#
#IfModule mod_security.c
#    Directory /usr/share/phpMyAdmin
#        SecRuleInheritance Off
#    Directory
#IfModule

http://youdomain.com/phpmyadmin

wget http://wordpress.org/latest.zip

unzip latest.zip
cd wordpress
cp -a * /var/www/html

configure wordpress
cd /var/www/html
mv wp-config-sample.php wp-config.php
vim wp-config.php
.- edit in this line -.

define('DB_NAME', 'wordpress_db');
define('DB_USER', 'root');
define('DB_PASSWORD', 'password');

install on web browser
open your web browser and goto url:

http://yourdomain/

http://i56.tinypic.com/1zpqsts.png

http://i53.tinypic.com/287ojlv.jpg

http://i52.tinypic.com/110aa7k.jpg

http://i55.tinypic.com/24173wm.jpg

http://i51.tinypic.com/35b5n35.jpg

Tuesday, September 7, 2010

vtiger Installation On CentOS 5.x

vtiger Installation On CentOS 5.x

vtiger is the CRM / complete tracking solution I have looked for and needed for 10 years!!! An all-in-one tracking everything organic package that ties everything together - because every task has many things associated with it, and vtiger works the way people think.
I will install vtiger in the /var/www/html/vtigercrm directory on a CentOS 5.x (i386) system where /var/www/html is the document root of the web site where I install vtiger.
vtiger can be installed as follows:
rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mapserver php-mbstring php-mcrypt php-mssql php-snmp php-soap php-tidy phpmyadmin mysql mysql-server httpd libpng libpng-devel libjpeg libjpeg-devel freetype freetype-devel zlib xFree86-dev openssl openssl-devel krb5-devel imap-2004d
php.ini configuration:
Variable Value
allow_call_time_pass_reference on
error_reporting E_WARNING & ~E_NOTICE
safe_mode off
display_errors on
file_uploads on
max_execution_time 600
memory_limit 64M
log_errors off
output_buffering on
register_globals off
short_open_tag on
wget http://sourceforge.net/projects/vtigercrm/files/vtiger%20CRM%205.1.0/vtigercrm-5.1.0.tar.gz
tar -xvzf vtigercrm-5.1.0.tar.gz
chmod -R a+rw /var/www/html/vtigercrm
Open a browser - you can access the vtiger installer under:
http:///vtigercrm/install.php
Click to enlarge

Click to enlarge

Click to enlarge

Click to enlarge

Click to enlarge

Click to enlarge

Click to enlarge

Click to enlarge

Click to enlarge

Wednesday, September 1, 2010

Squid Proxy Cache Server Installation and Configuration


Squid is a proxy caching server. If you are Linux sysadmin, you can use squid to control internet access at your work environment.
This beginners guide will give a jump-start on how to setup squid on Linux to restrict internet access in an network.

Install Squid

You should install the following three squid related packages on your system.
  • squid
  • squid-common
  • squid-langpack
On Debian and Ubuntu, use aptitude to install squid as shown below. On CentOS, use yum to install the squid package.
$ yum install squid

Check Configuration and Startup scripts

Apart from installing the squid related packages, it also creates the /etc/squid/squid.conf and /etc/init.d/squid startup script.
By default Squid runs on 3128 port. You can verify this from the squid.conf file. You can also set the visible_hostname parameter in your squid.conf, which will be used in error_log. If you don’t define, squid gets the hostname value using gethostname() function.
# vim /etc/squid/squid.conf
visible_hostname ubuntuserver
httpd_port 3128
Note: The http port number (3128) specified in the squid.conf should be entered in the proxy setting section in the client browser. If squid is built with SSL, you can use https_port option inside squid.conf to define https squid.

Start Squid and View Logs

Start the Squid proxy caching server as shown below.
# service squid start
squid start/running, process 11743
Squid maintains three log files (access.log, cache.log and store.log) under /var/log/squid directory.
From the /var/log/squid/access.log, you can view who accessed which website at what time. Following is the format of the squid access.log record.
time elapsed remotehost code/status bytes method URL rfc931     peerstatus/peerhost
To disable logging in squid, update the squid.conf with the following information.
# to disable access.log
cache_access_log /dev/null

# to disable store.log
cache_store_log none

# to disable cache.log
cache_log /dev/null

Squid Usage 1: Restrict Access to Specific Websites

This is how you can restrict folks from browsing certain website when they are connected to your network using your proxy server.
Create a file called restricted_sites and list all sites that you would want to restrict the access.
# vim /etc/squid/restricted_sites
www.youtube.com
mail.yahoo.com
www.hotmail.com
www.gmail.com 

Modify the squid.conf to add the following.
# vim /etc/squid/squid.conf
acl RestrictedSites  dstdomain "/etc/squid/restricted_sites"
http_access deny RestrictedSites

Squid Usage 2: Allow Access to Websites Only During Specific Time

Some organization might want to allow employees to surf or download from the internet only during specific timeperiods.
The squid.conf configuration shown below will allow internet access for employees only between 9:00AM and 18:00 during weekdays.
# vim /etc/squid/squid.conf
acl official_hours time M T W H F 09:00-18:00
http_access deny all
http_access allow official_hours

Squid Usage 3 : Restrict Access to Particular Network

Instead of restricting specific sites, you can also provide access only to certain network and block everything else. The example below, allows access only to the 192.168.10.* internal network.
# vim /etc/squid/squid.conf
acl branch_offices src 192.168.10.0/24
http_access deny all
http_access allow branch_offices

Squid Usage 4 : Use Regular Expression to Match URLs

You can also use regular expression to allow or deny websites.
First create a blocked_sites files with a list of keywords.
# cat /etc/squid/blocked_sites
soccer
movie
www.example.com
Modify the squid.conf to block any sites that has any of these keywords in their url.
# vim /etc/squid/squid.conf
acl blocked_sites url_regex -i "/etc/squid/blocked_sites"
http_access deny blocked_sites
http_access allow all
In the above example, -i option is used for ignoring case for matching. So, while accessing the websites, squid will try to match the url with any of the pattern mentioned in the above blocked_sites file and denies the access when it matches.

SARG – Squid Analysis Report Generator

Download and install SARG to generate squid usage reports.
Use the sarg-reports command to generate reports as shown below.
# to generate the report for today
sarg-report today

# on daily basis
sarg-report daily

# on weekly basis
sarg-report weekly

# on monthly basis
sarg-report monthly

Add the sarg-report to the crontab.
The reports generated by sarg are stored under /var/www/squid-reports. These are html reports can you can view from a browser.
 
$ ls /var/www/squid-reports
Daily  index.hyml

$ ls /var/www/squid-reports/Daily
2010Sept1-2010Sept2  images  index.html

Monday, August 16, 2010

How to Recover Deleted Files in Fedora / Ubuntu

foremost is a forensics application to recover files based on their headers, footers, and internal data structures. Foremost can work on image files, such as those generated by dd, Safeback, Encase, etc, or directly on a drive. This short article shows how you can use foremost to recover deleted files.

Currently foremost can recover the following file types:
  • jpg - Support for the JFIF and Exif formats including implementations used in modern digital cameras.
  • gif
  • png
  • bmp - Support for windows bmp format.
  • avi
  • exe - Support for Windows PE binaries, will extract DLL and EXE files along with their compile times.
  • mpg - Support for most MPEG files (must begin with 0x000001BA)
  • wav
  • riff - This will extract AVI and RIFF since they use the same file format (RIFF). note faster than running each separately.
  • wmv - Note may also extract -wma files as they have similar format.
  • mov
  • pdf
  • ole - This will grab any file using the OLE file structure. This includes PowerPoint, Word, Excel, Access, and StarWriter
  • doc - Note it is more efficient to run OLE as you get more bang for your buck. If you wish to ignore all other ole files then use this.
  • zip - Note is will extract .jar files as well because they use a similar format. Open Office docs are just zipâd XML files so they are extracted
    as well. These include SXW, SXC, SXI, and SX? for undetermined OpenOffice files.
  • rar
  • htm
  • cpp - C source code detection, note this is primitive and may generate documents other than C code.
You can tweak /etc/foremost.conf to add support for more file types.
Please note that there's no guarantee that foremost will succeed in recovering your files, but at least there's a chance.

2 Installing foremost

On Fedora and Ubuntu, foremost can be installed as follows:

#yum install foremosrt

 #apt-get install foremost
#apt-get install scalpel


Before we can use Scalpel, we must define some file types that Scalpel should search for in /etc/scalpel/scalpel.conf. By default, all file types are commented out. Uncomment the lines you want, for instance if you want to recover PDF files:

Press Alt + F2 and type: gedit /etc/scalpel/scalpel.conf

and uncomment these lines:
       pdf     y       5000000 %PDF  %EOF\x0d  REVERSE
     pdf     y       5000000 %PDF  %EOF\x0a  REVERSE
Scalpel can be used as follows to try to recover the files:
scalpel /dev/sda1 -o output 
-o defines the directory where Scalpel will place the recovered files - in this case the directory is named output and is a subdirectory of the directory where we are running the scalpel command from; the directory must not exist because otherwise scalpel will refuse to start.

After Scalpel has finished, you will find a folder called output in the directory from where you called Scalpel. The audit.txt contains a summary of what Scalpel has done and the pdf-0-0/ subdirectory contains the pdf files that Scalpel has recovered.

Before you run Scalpel the next time from the same directory, you must either delete/rename the current output/ directory (because Scalpel will not start if the output directory is already existing) or use specify another output directory.


Using Foremost

Foremost Syntax
foremost  [-h][-V][-d][-vqwQT][-b][-o] [-t][-s][-i]
 

Available Options
-h Show a help screen and exit.
-V Show copyright information and exit.
-d Turn on indirect block detection, this works well for Unix file systems.
-T Time stamp the output directory so you don’t have to delete the output dir when running multiple times.
-v Enables verbose mode. This causes more information regarding the current state of the program to be dis-played on the screen, and is highly recommended.
-q Enables quick mode. In quick mode, only the start of each sector is searched for matching headers. That is,the header is searched only up to the length of the longest header. The rest of the sector, usually about 500 bytes, is ignored. This mode makes foremost run con- siderably faster, but it may cause you to miss files that are embedded in other files. For example, using quick mode you will not be able to find JPEG images embedded in Microsoft Word documents.
Quick mode should not be used when examining NTFS file systems. Because NTFS will store small files inside the Master File Table, these files will be missed during quick mode.
-Q Enables Quiet mode. Most error messages will be sup-pressed.
-w Enables write audit only mode. No files will be extracted.
-a Enables write all headers, perform no error detection in terms of corrupted files.
-b number Allows you to specify the block size used in foremost. This is relevant for file naming and quick searches. The default is 512. ie. foremost -b 1024 image.dd
-k number Allows you to specify the chunk size used in foremost.This can improve speed if you have enough RAM to fit the image in. It reduces the checking that occurs between chunks of the buffer. For example if you had > 500MB of RAM. ie. foremost -k 500 image.dd
-i file The file is used as the input file. If no input file is specified or the input file cannot be read then stdin is used.
-o directory Recovered files are written to the directory directory.
-c file Sets the configuration file to use. If none is speci-fied, the file “foremost.conf” from the current direc-tory is used, if that doesn’t exist then “/etc/fore-most.conf” is used. The format for the configuration file is described in the default configuration file included with this program. See the CONFIGURATION FILE section below for more information.
-s number Skips number blocks in the input file before beginning the search for headers. ie.
foremost -s 512 -t  jpeg -i /dev/hda1
Foremost examples
Search for jpeg format skipping the first 100 blocks
su -c foremost -s 100 -t jpg -i image.dd
Only generate an audit file, and print to the screen (verbose mode)
su -c foremost -av image.dd
Search all defined types
su -c foremost -t all -i image.dd
Search for gif and pdf
su -c foremost -t gif,pdf -i image.dd
Search for office documents and jpeg files in a Unix file sys-tem in verbose mode.
su -c foremost -v -t ole,jpeg -i image.dd
Run the default case
su -c foremost image.dd
image.dd means you need to enter your hardisk mount point i.e /dev/sda1 or /dev/sda2
 
  (pls use for ubuntu sudo )