Search Windows and Linux Networking

Friday, April 29, 2011

Searching and installing package in Ubuntu

Searching and installing package in Ubuntu

If you are using terminal in ubuntu or command line interface and want to install software but you forgot

the name of package. following is the very useful command that will search all package for you.

command is:-

apt-cache search SearchTerm

example you want  packet  libmp3lame-devel  and only remember lame the following command will search
package you want.

 apt-cache search lame

libcarp-clan-perl - Perl enhancement to Carp error logging facilities
libgnome2-canvas-perl - Perl interface to the GNOME canvas library
libgnome2-perl - Perl interface to the GNOME libraries
libgnome2-vfs-perl - Perl interface to the 2.x series of the GNOME VFS library
libgtk2-perl - Perl interface to the 2.x series of the Gimp Toolkit library
libgtk2-perl-doc - Perl interface to the Gtk 2.x series (documentation files)
libpango-perl - Perl module to layout and render international text
abuse - SDL port of the Abuse action game
audex - Audio grabber tool for KDE
caca-utils - text mode graphics utilities
cmt - a collection of LADSPA plugins
cpufire-applet - GNOME panel applet showing the CPU load as a fire
electricsheep - screensaver showing collective dream of sleeping computers
flam3 - render and animate FLAM3s and manipulate their genomes
flamerobin - graphical database administration tool for Firebird DBMS
flamethrower - Multicast file distribution utility
glame - versatile audio processor
hardware-monitor - Monitor applet for the Gnome panel
lame - An MP3 encoding library (frontend)
lame-doc - An MP3 encoding library (documentation)
libavifile-0.7c2 - shared libraries for AVI read/writing
libgnome2-gconf-perl - Perl interface to the GNOME GConf library
libgnome2-wnck-perl - Perl interface to the Window Navigator Construction Kit
libgstreamer-interfaces-perl - Perl interface to the GStreamer Interfaces library
libgstreamer-perl - Perl interface to the GStreamer media processing framework
libgtk2-gladexml-perl - Perl interface to use user interfaces created with glade-2
libgtk2-trayicon-perl - Perl interface to fill the system tray
libgtk2-traymanager-perl - Perl interface to fill the system tray
libmp3lame-dev - An MP3 encoding library (development)
libmp3lame0 - An MP3 encoding library




Now you know the name of package and want to install now

apt-get install libmp3lame-dev

that's it. 

Total video converting solution in linux (Ubuntu)


Convert any video file to any format in Ubuntu


Why to spend money when opensourse software free and do our work.

ffmpeg and mencoder are the two most popular in Linux to convert files by using these tool you can be convert any video or audio file to any format.

To install it give the following command:-

apt-get install ffmpeg mplayer mencoder libmp3lame-dev lame


wget http://www.mplayerhq.hu/MPlayer/releases/codecs/all-20061022.tar.bz2

tar -xjvf all-20061022.tar.bz2

sudo mkdir-p / usr / lib / codecs

sudo cp all-20061022 / * / usr / lib / codecs /

 Now it ready to use .

Examples:-

Convert from avi to flv

Using ffmpeg

ffmpeg -i inputfile.avi outputfile.flv

convert from flv to avi file

ffmpeg -i inputfile.flv outputfile.avi


Using mencoder

mencoder inputfile.avi -oac mp3lame -ovc lavc -o outputfile.flv

OR


mencoder {SOURCE_VIDEO} -o {OUTPUT_VIDEO}.flv -of lavf -oac mp3lame -lameopts abr:br=56
 -srate 22050 -ovc lavc -lavcopts vcodec=flv:vbitrate=500:mbd=2:mv0:trell:v4mv:cbp:last_pred=3
 -lavfopts


There are many over option you can use for that see the help.

Tuesday, April 19, 2011

Installing Mysql on ubuntu 10.10

Installing mysql on ubuntu 10.10


To install mysql on ubuntu run the following command

sudo apt-get install mysql-server-5.1

 
This will install mysql-server during installation. it will ask you root password for sql you can set it or live it blank.

to activate MySQL with the following command:

sudo mysql_install_db

Then run the mysql_secure_installation script to tighten the MySQL server’s security a bit. Follow the default prompts:

mysql_secure_installation

Once this command finishes, you’ll need to log into the MySQL command-line client as the root user:

mysql -u root -p

Enter your MySQL root password. Once logged into the MySQL command line client, you will create a database, a user for that database, and grant all permissions on that database to that user.
First, create the database:

CREATE DATABASE newdatabaser;

(Note that all commands in MySQL must end with a semicolon to denote the end of the SQL statement.)
Create a user who can access the database:

CREATE USER newdatabaseruser;

Next, set a password for the new user:

SET PASSWORD FOR newdatabaseuser= PASSWORD(“password”);

Just as with the root user, you’ll want to choose a strong password. Note that your password will actually go within the quotation marks, and that the password is case-sensitive. For instance, if you were to choose 1234 as your password (an extraordinarily bad idea, incidentally), the command would look like this:

SET PASSWORD FOR newdatabaseuser= PASSWORD(“1234”);

The final step is to grant all privileges on your new database to the testuser by the following command. The password you just assigned the new user will go within the single-quote marks (and, yes, MySQL’s internal syntax isn’t always consistent):

GRANT ALL PRIVILEGES ON newdatabase.* TO newdatabaseuser IDENTIFIED BY ‘password’;

Type exit to close the MySQL client. You’ve now installed MySQL, performed basic configuration, and created a database and user


Ref site:-
http://blog.sudobits.com/2010/10/27/how-to-install-mysql-on-ubuntu-10-10/
http://www.jonathanmoeller.com/screed/?p=2149  Very Good site :-)

Friday, April 15, 2011

Adding Host to Nagios for monitor

Adding Host to Nagios for monitor 
 
 
 
Today, we will see how to Add our first host to nagios for monitoring support
you want to monitor is it internet is working of not by ping www.google.com
for that Create new file as googel.cfg in /usr/local/nagios/etc/objects 
and type following parameter to use nagios to read. by using vi or nano editor.
 
to define host we need to specify host name of the computer or host you want to
monitor. valid ip address or DNS name of the given host. set alias for host and 
what template should be used. we should must also define atleast one service to 
check for the host. parameter for defining service also same but we have to 
specify how to check the service and what action nagios should take. for eg. send 
notification or not. if you want notification then you should enabled it. i have
set it disabled. 
 
we are checking is www.googl.com is up and http service is running or not. 
 
vi /usr/local/nagios/etc/objects/google.cfg
 
  
# Define a host for the local machine

define host{
        use                     linux-server    
                                    
                                    
        host_name               google.com
        alias                   google.com
        address                 www.google.com
        }

###############################################################################
###############################################################################
#
# SERVICE DEFINITIONS
#
###############################################################################
###############################################################################

# Define a service to "ping" the local machine

define service{
        use                             generic-service        
        host_name                       google.com
        service_description             PING
        check_command                   check_ping!100.0,20%!500.0,60%
        }

# Define a service to check HTTP


define service{
        use                             generic-service         
        host_name                       google.com
        service_description             HTTP
        check_command                   check_http
        notifications_enabled           0
        }
# End of File google.cfg
###############################################################################
 
Now define google.cfg file on nagios main configuration file.
sudo vi /usr/local/nagios/etc/nagios.cfg
and add the following line 
cfg_file=/usr/local/nagios/etc/objects/google.cfg 
 
Save the nagios.cfg and restart nagios using following command
 
sudo /etc/init.d/nagios restart 
 
wait for a mint. and then open you web browser and open url:-

http://localhost/nagios

OR

http://ipaddress/nagios

In Host you will now see google.com in host list for monitoring .

Thursday, April 14, 2011

Send Automated Emails Using SendEmail & Windows Task Scheduler

Send Automated Emails Using SendEmail & Windows Task Scheduler

         If you want automated mail be send after something has been done or you want after scheduled backup report in you Mailbox or want to command line method to send a email with or without attachment file. SendEmail is the very good utility for you and is open source. windows and Linux users can be use this utility to send mail from command line.you can also create batch file or VBScirpt and set a scheduled to run that batch file or script to send mail automatically what you want.

To use SendEmail you should know you smtp server address, port , and authentication detail.

I am going to use Gmail server detail to send mail 

Note:- I am using Sender (from) address fromaddress@gmail.com and for to address as toaddress@gmail.com both are not real . Only shown for demo purpose only. 

To known your mail server detail. Ask your system administrator or IT person ( If you having gmail account you can use same detail what i have been used or you can get it from your account setting forwarding and pop/IMAP setting and there configuration instruction.)

Outgoing server (SMTP ) for Gmail are :-

SMTP Server:- smtp.gmail.com (use authentication)
Use Authentication: Yes
Port for TLS/STARTTLS: 587

and suppose  my user name is fromaddress@gmail.com and password MyPass0rd then command look like this in single line.

 

SendEmail.exe -f fromaddress@gmail.com -t toaddress@gmail.com -cc ccaddress@yahoo.com -u "test mail from sendmail" -m "this is the test mail from batch file" -a "c:\report.xls"-s smtp.gmail.com:587 -xu fromaddress@gmail.com -xp MyPass0rd -o tls=yes

This will send mail "toaddress@gmail.com" with CC "ccaddress@yahoo.com" with subject "test mail from sendmail " contains "this is the test mail from batch file" and attach file from "c:\report.xls"

 If you want to do it automatically open the notepad type the command and save the file on same location where SendEmail.exe is store. and set schedule task

you can download SendEmail.exe for windows from following site.

http://caspian.dotconf.net/menu/Software/SendEmail/
  • f xxxxx@gmail.com : This parameter is the email address that will be the “sender.”
  • -t rdube@yahoo.com : This is the recipient’s email address.
  • -u Monday Status Updates : This is the subject
  • -m Here’s the analytics data for this week! : This is the message body.
  • -a Analytics_Channel1.csv Analytics_Channel2.csv Analytics_Channel3.csv : These are the attachments.
  • -s smtp.gmail.com:587 : SMTP server and port
  • -xu xxxxx@gmail.com : SMTP authentication ID name
  • -xp A1ienz2A51 : SMTP authentication password
  • -o tls=yes : SMTP uses TLS (or SSL)

Wednesday, April 13, 2011

Installing Nagios(Monitoring Tool) on Ubuntu 10.10



Installing Nagios On Ubuntu 10.10

In last post I have shown how to install zabbix on ubuntu 10.10 now I will show you how to install Nagios on Ubuntu 10.10 Desktop.

Required Packages
Make sure you’ve installed the following packages on your Ubuntu installation before continuing.
Apache 2
PHP
GCC compiler and development libraries
GD development libraries

Install these packages by running the following commands:

sudo apt-get install apache2

sudo apt-get install libapache2-mod-php5

sudo apt-get install build-essential

sudo apt-get install libgd2-xpm-dev

Create User Account for Nagios :-
Become root using
Sudo –s

Create a new nagios user account and give it a password.

/usr/sbin/useradd -m -s /bin/bash Nagios

passwd Nagios

Create a new nagcmd group for allowing external commands to be submitted through the web interface.Add both the nagios user and the apache user to the group.

/usr/sbin/groupadd nagcmd

/usr/sbin/usermod -a -G nagcmd Nagios

/usr/sbin/usermod -a -G nagcmd www-data

Download Nagios and the Plugins

mkdir ~/downloads

cd ~/downloads

wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.0.tar.gz

wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.11.tar.gz

OR you can download from :-


Compile and Install Nagios

cd ~/downloads

tar xzf nagios-3.2.0.tar.gz

Run the Nagios configure script, passing the name of the group we created earlier :-

./configure --with-command-group=nagcmd

make all

make install

make install-init

make install-config

make install-commandmode

Customize Configuration
Sample configuration files have now been installed in the /usr/local/nagios/etc directory. These samplefiles should work fine for getting started with Nagios. You’ll need to make just one change before you proceed...Edit the /usr/local/nagios/etc/objects/contacts.cfg config file with your favorite editor and change the email address associated with the nagiosadmin contact definition to the address you’d like to use for receiving alerts

vi /usr/local/nagios/etc/objects/contacts.cfg

As I have change to sandeep@example.com highlight for your continuous  

###############################################################################
#
# CONTACTS
#
###############################################################################
###############################################################################

# Just one contact defined by default - the Nagios admin (that's you)
# This contact definition inherits a lot of default values from the 'generic-contact'
# template which is defined elsewhere.

define contact{
        contact_name                    nagiosadmin             ; Short name of user
        use                             generic-contact         ; Inherit default values from generic-contact template (defined above)
        alias                           Nagios Admin            ; Full name of user

        email                           sandeep@example.com        ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
        }



###############################################################################

Save the file.

Configure the Web Interface

make install-webconf

Create a nagiosadmin account for logging into the Nagios web interface. Remember the password you assign to this account – this password is required later to access.

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

set the password and confirm it.

Now, restart or reload  Apache to make the new settings take effect. Using following command

/etc/init.d/apache2 reload

Compile and Install the Nagios Plugins

cd ~/downloads

tar xzf nagios-plugins-1.4.11.tar.gz

cd nagios-plugins-1.4.11

./configure --with-nagios-user=nagios --with-nagios-group=Nagios

make

make install


Configure Nagios to automatically start when the system boots.

ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios

Verify the sample Nagios configuration files.

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

Start Nagios

/etc/init.d/nagios start

You should now be able to access the Nagios web interface at the URL below. You’ll be prompted for the username (nagiosadmin) and password you specified earlier.

http://localhost/nagios/

OR
http://ipaddress/nagios/


 Note:- to allow nagios to send Email notification you have to install and configure mailx and postfix

sudo apt-get install mailx
sudo apt-get install postfix

Installing Webmin on Ubuntu 10.10

Installing Webmin

            webmin is very good web base interface for system administrator or those are not very good familiar to Linux platform. it provide web base interface for configere veryus kind of server in Linux such as Samba, Apache, DNS, MySql, IPtable (Firewall), user management  and many more.
           Webmin consists of a simple web server, and a number of CGI programs which directly
update system files like /etc/inetd.conf and /etc/passwd. The web server and all CGI
programs are written in Perl version 5, and use no non-standard Perl modules. Please get more
information about Webmin here:

http://www.webmin.com

Install some dependencies:-

sudo apt-get install perl libnet-ssleay-perl 
sudo apt-get install openssl libauthen-pam-perl libpam-runtime 
sudo apt-get install libio-pty-perl

wget http://ftp.debian.org/pool/main/libm/libmd5-perl/libmd5-perl_2.03-1_all.deb

sudo dpkg -i   libmd5-perl_2.03-1_all.deb
 
wget http://sourceforge.net/projects/webadmin/files/webmin/1.510/webmin_1.510-2_all.deb/download 
 
sudo dpkg  -i   webmin_1.510-2_all.deb
 
sudo /etc/init.d/webmin  start   
 
 
To install current webmin version  
 
wget http://www.webmin.com/download/deb/webmin-current.deb 
 
sudo dpkg -i webmin-current.deb    


http://www.webmin.com/download/deb/webmin-current.deb        

.
You can now see the Webmin interface in your favourite browser by using the following
URLs:
https://localhost:10000 
OR

https://IP-address:10000

Tuesday, April 12, 2011

Installing Zabbix (Monitoring tool ) on Ubuntu 10.10


How to install Zabbix on ubuntu 10.10


Important of monitoring system :- Suppose you have many web servers that users frequently access for update your data. Everything are working on one morning when auditing are going on you company and users complete that web server is not working. To figure out the problem you may be first check router is working or not , are you able to ping web server or not and so on. And suppose your router is working ok and web server is also given reply. Then you check is it web server is running or not . If it running then you check backend of web server Database server is working or not by ping to database server but you are not able to ping database server then you will check cable is properly plug to database server and also switch and till are you not able to ping then you may be check services working or not and you find out that some service not started on database server so you may try to manually start services but if fail to start because of  IP address. Then you may check IP address but found that server not having valid IP address received from DHCP server then you fix the problem on DHCP server and after that everything come online. In between when you are trying to find out the problem every time many users will disturbing you because audit are going on it will very hearting.

    And if you have any monitoring tool like Nagios or Zabbix that will told where and when the problem is and send email or SMS on your mobile . you will know that DHCP server is down. On your mail box or mobile phone before user may know you will fix the problem and user not able to know web server was have problem because you have already fix the problem before users complaint you about web server is not working .

Zabbix and Nagios are Open source Monitoring tool . It monitor all your network infrastructure like Network, Servers, Routers, switches , services ,eg fpt, mail, exchange. It also real time graph . if something goes wrong like server down, or service fail to start it send a mail or SMS notify to saying that this server or router, switch is down or this service fail to start on this these server.  this will reduce your time to find out the problem. Zabbix and Nagios are both are very good open source software. As compare Nagios Zabbix is easy to install and configure so For now I will show you how to install Zabbix on Ubuntu 10.10 Desktop.

For More infromation about Nagios and zabbix find out the following links for your ref.


Nagios:-
http://en.wikipedia.org/wiki/Nagios
http://www.nagios.org/

Zabbix:-
http://www.zabbix.com/wiki/start
http://en.wikipedia.org/wiki/Zabbix

Install pre-requisites:
Apache MySQL-Server PHP5 Net-Snmp libraries Curl libraries
 
sudo apt-get install build-essential mysql-server libmysqlclient15-dev
sudo apt-get install php5 php5-gd php5-mysql 
sudo apt-get install snmp libsnmp-dev snmpd 
sudo apt-get install libcurl4-openssl-dev fping libiksemel3 libiksemel-dev

Setup the zabbix user:
 
sudo adduser zabbix

enter in the password "zabbix" without the quotes and confirm choice

Add the ser zabbix to the admin group:
 
sudo adduser zabbix admin

Switch to the zabbix user, dowload and extract source:
 
su - zabbix
 
Download zabbix-q.g.1.tar.gz from link  
wget http://downloads.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Development/1.9.1/zabbix-1.9.1.tar.gz
 
 
tar zxvpf zabbix-1.9.1.tar.gz


Create zabbix database and set permissions:
 
sudo mysql -e"create database zabbix;"
sudo mysql -e"grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';"

Populate the database (the order you do this matters):
 
mysql -D zabbix -uzabbix -pzabbix < /home/zabbix/zabbix-1.9.1/create/schema/mysql.sql
 
mysql -D zabbix -uzabbix -pzabbix < /home/zabbix/zabbix-1.9.1/create/data/images_mysql.sql
 
mysql -D zabbix -uzabbix -pzabbix < /home/zabbix/zabbix-1.9.1/create/data/data.sql

Configure, compile and install the server:
 
cd zabbix-1.9.1/
 
./configure --prefix=/usr --with-mysql --with-net-snmp --with-libcurl --with-jabber=/usr/ --enable-server --enable-agent
 
make
 
sudo make install

Setup the rest of the system:
Configure services:

sudo vi /etc/services

Add the following to the end:
 
zabbix_agent 10050/tcp # Zabbix ports
zabbix_trap 10051/tcp

Save and exit.
 
sudo mkdir /etc/zabbix
sudo chown -R zabbix.zabbix /etc/zabbix/
cp misc/conf/zabbix_* /etc/zabbix/
Edit the server configuration file:
sudo vi /etc/zabbix/zabbix_server.conf

Set these two lines as shown ( uncomment DBPassword ):
DBUser=zabbix
DBPassword=zabbix

Save and exit.

Copy the init scripts:
sudo cp misc/init.d/debian/zabbix-server /etc/init.d
sudo cp misc/init.d/debian/zabbix-agent /etc/init.d

Edit the server init script:
 
sudo vi /etc/init.d/zabbix-server
Change the line:
DAEMON=/usr/local/sbin/${NAME}
So it reads (remove the /local):
DAEMON=/usr/sbin/${NAME}
Edit the agent init script:
sudo vi /etc/init.d/zabbix-agent
Change the line:
DAEMON=/usr/local/sbin/${NAME}
So it reads (remove the /local):
DAEMON=/usr/sbin/${NAME}

Set the correct permissions on the init scripts and set to start at boot:
 
o chmod 755 /etc/init.d/zabbix-agent
sudo sudo chmod 755 /etc/init.d/zabbix-serversudo update-rc.d zabbix-server defaultssudupdate-rc.d zabbix-agent defaults

Start the server and agent:
sudo /etc/init.d/zabbix-server start
sudo /etc/init.d/zabbix-agent start

See if they are running:
ps -aux | grep zabbix

You should see zabbix-server and zabbix-agent multiple times if everything went ok.

Configure the web interface:
 
mkdir /home/zabbix/public_html
cp -R frontends/php/* /home/zabbix/public_html/

edit the apache configuration:
sudo vi /etc/apache2/sites-enabled/000-default
And add this below the last Directory item:
 
Alias /zabbix /home/zabbix/public_html/
<Directory /home/zabbix/public_html>
  AllowOverride FileInfo AuthConfig Limit Indexes
  Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
  <Limit GET POST OPTIONS PROPFIND>
    Order allow,deny
    Allow from all
  </Limit>
  <LimitExcept GET POST OPTIONS PROPFIND>
    Order deny,allow
    Deny from all
  </LimitExcept>
</Directory>

Save the file and exist

Restart Appache2 Server to apply chanages

sudo /etc/init.d/appache2 restart

If Appache2 server started without any error then Point your web browser to your server IP/zabbix:

http://localhost/zabbix

Complete the install wizard:

1. Introduction
read and click Next
2. License Agreement
Read, check 'I Agree', click Next
3. Check of Pre-Requisites
Fix any problems, click retry. Click Next when all pre-requisites are OK.
(if it any test fail for PHP then make changes to /etc/php5/php.ini after change restart appache2 to take effect)
4. Configure DB Connection
Enter appropriate settings and click Test Connection. (In User Name and password type zabbix ) Click Next when OK.
5. Pre-Installation Summary
Verify installation settings, click Next.
6. Install
Click Save Configuration file and save to machine. Copy zabbix.conf.php to /home/zabbix/public_html/conf/zabbix.conf.php

Login with user "admin" and password zabbix"

Wednesday, April 6, 2011

How to remove or Block some one from Facebook

How to remove or Block some one from Facebook


First of do not accept friend request whom you not know because by doing so. he will get access to your personal information and many more if you not change default setting privacy option setting. please do necessary changes there to only allow to person you really know them.

and if you have already accepted the request and now want to remove or block see the following link it give you good information about how to remove or block some one and many more.

     http://www.facebook.com/help/?page=770    

It may be helpful for some one how want to remove some one from his friend list or Block to the person from to  allow to visit your profile. 

Note:- I know one of my friend may be want this information. and want to do so that's why I posted this to help him for so if he want. :-)