Monday, June 25, 2007

Xen : virtualization software

In my previous blog post I was talked about Virtualization.

Now I am writting about XEN , It is software that runs on a host operating system and allows one to run several guest operating systems on top of the host on the same computer hardware at the same time. Xen Software which enabling every server to support multiple virtual servers. It is the fastest and most secure virtualization software.

In Xen virtualization, a thin software layer known as the Xen hypervisor ( open source technology, developed collaboratively by the world’s best engineers at over 20 of the most innovative data center solution vendors, including Intel, AMD, Cisco, Dell, Egenera, HP, IBM, Mellanox, Network Appliance, Novell, Red Hat, SGI, Sun, Unisys, Veritas, Voltaire, and of course, XenSource ) is inserted between the server’s hardware and the operating system.

This provides an abstraction layer that allows each physical server to run one or more “virtual servers,” effectively decoupling the operating system and its applications from the underlying physical server.

In CentOS-5 Its In build

http://www.centos.org/
Some useful Link here
http://www.xensource.com/download/
http://www.xensource.com/media/xen/player.html
http://bits.xensource.com/Xen/docs/user.pdf
http://www.linuxjournal.com/article/8540
http://wiki.xensource.com/xenwiki/XenIntro

Friday, April 27, 2007

Virtualization : Basic Concepts

Virtualization is the creation of a virtual (rather than actual) version of something, such as an operating system, a server, a storage device or network resources. e.g. hard drive into different partitions, a partition is the logical division of a hard disk drive to create, in effect, two separate hard drives.
Similarly, Operating system virtualization is the use of software to allow a piece of hardware to run multiple operating system images at the same time.

There are three areas of IT where virtualization is making head roads
a) Network virtualization
b) Storage virtualization
c) Server virtualization

Today, virtualization is in the forefront - helping businesses with scalability, security and management of their global IT infrastructure.

Virtualization can host multiple guest operating systems. Each guest operating system runs in its own domain, Virtualization schedules virtual CPUs within the virtual machines to make the best use of the available physical CPUs. Each guest operating systems handles its own applications. These guest operating systems schedule each application accordingly.

You can deploy Virtualization in one of two choices: full virtualization or Para virtualization.

Full virtualization provides total abstraction of the underlying physical system and creates a new virtual system in which the guest operating systems can run. No modifications are needed in the guest OS or application (the guest OS or application is not aware of the virtualized environment and runs normally).

Para virtualization requires user modification of the guest operating systems that run on the virtual machines (these guest operating systems are aware that they are running on a virtual machine) and provide near-native performance.

To know more on Virtualization:
Intro to Virtualization,
SearchServerVirtualization.com
,
Red Hat Enterprise Linux Virtualization
.

Monday, April 23, 2007

Change the default port for SSh user

Default port for SSH user is 22. But we can change the default port to some another port.
eg. I want to run ssh service on port 99 instead of 22.

Make the following change.

open files
#emacs /etc/ssh/ssh_config
#emacs /etc/ssh/sshd_config

search for port ie is default port = 22

make port = 99

or

You can run on any port, But make sure other service not running on that port.

Thursday, April 19, 2007

web Based administration solution for Linux : webmin

Webmin is an open source web Based administration solution for Linux. The purpose of webmin is to gather the administration of many different tasks and services under a common web interface. The software is perl based and module based which make it adaptable. Most common tasks have a module to administer.

how To Install Webmin:
# cd /usr/src
# wget http://prdownloads.sourceforge.net/webadmin/webmin-1.340-1.noarch.rpm
# rpm -ivh webmin-1.340-1.noarch.rpm

steps to install virtualmin & configure it:
login to webmin: ipaddress:100000
1) webmin -> webmin configuration -> webmin modulesInstall module -> from ftp or http url ->virtual min url is: http://download.webmin.com/download/virtualmin/virtual-server-3.201.gpl.wbm.gz

2) Enable https:yum install mod_sslin virtualmin config enable ssl for websites.
Configuring virtualmin:Enabled the subverion and mysql moduledisabled webalizerPostgreSQL setup and configuration enabled? yes.

3) If this server is going to use PGsqlPostfix configuration from webmin:servers->postfix->virtual domain->domain mapping lookup table: hash:/etc/postfix/virtual General options: Network interface for receiving mail: all [make sure that the hostname is something like sys.abc.comg is you are going to run the acb system here.]

4) dovecot configuration from webmin:webmin -> servers -> dovecot -> user login options -> Password authentication source -> unix shadow filestart at boot: yes

5) Webmin -> webmin configuration -> Ports and addressesaccess the webmin system: and then configure the port (eg 100000) for webmin listen and udp packets.

6) Webmin -> webmin configuration -> ssl encryptionAlso make webmin run on ssh.Enable SSL if available? yesRedirect non-SSL requests to SSL mode? yes

Monday, April 02, 2007

Check your memory !

We all are always worry about memory weather it is main memory, secondary, or other swap
These are few command which help u to debug your memory.

Simple stat.
#free
#du -h
#df -h

Some complex stat.

#cat /proc/meminfo
#dmesg | grep -n kernel

This command give you files have more than 100M usages.

#find / -size +100M -fprintf /root/big.txt '%-10s %p\n'

Tuesday, February 13, 2007

find out all failed login attempts via ssh/telnet

how do I find out all failed login attempts via ssh/telnet?

# grep "authentication failure" /var/log/messages|awk '{ print $13 }' | cut -b7- | sort | uniq -c

Thursday, February 08, 2007

find command with examples

find command all we know but here u find some example,

find . -name "rc.conf" -print
This command will search in the current directory and all sub directories for a file named rc.conf.

find /usr/src -not \( -name "*,v" -o -name ".*,v" \) '{}' \; -print
This command will search in the /usr/src directory and all sub directories. All files that are of the form '*,v' and '.*,v' are excluded. Important arguments to note are:

* -not means the negation of the expression that follows
* \( means the start of a complex expression.
* \) means the end of a complex expression.
* -o means a logical or of a complex expression.
In this case the complex expression is all files like '*,v' or '.*,v'

The above example is shows how to select all file that are not part of the RCS system. This is important when you want go through a source tree and modify all the source files... but ... you don't want to affect the RCS version control files.

find . -exec grep "www.athabasca" '{}' \; -print
This command will search in the current directory and all sub directories.

find . -exec grep -q "www.athabasca" '{}' \; -print

This command is very important for process a series of files that contain a specific string. You can then process each file appropriately. An example is find all html files with the string "www.athabascau.ca". You can then process the files with a sed script to change those occurrances of "www.athabascau.ca" with "intra.athabascau.ca"

Tuesday, January 09, 2007

Recover Root Password of MYSQL

Step # 1 : Stop mysql service
# /etc/init.d/mysql stop

Step # 2: Start to MySQL server w/o password:
# mysqld_safe --skip-grant-tables &

Step # 3: Connect to mysql server using mysql client:
# mysql -u root

Step # 4: Setup new MySQL root user password
mysql> use mysql;
mysql> update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root';
mysql> flush privileges;
mysql> quit

Step # 5: Stop MySQL Server:
# /etc/init.d/mysql stop

Step # 6: Start MySQL server and test it
# /etc/init.d/mysql start
# mysql -u root -p

Enjoy ;-)

Monday, January 08, 2007

Recover Root Password In Liunx Machine

Recover Root Password

Probably the simplest way to solve a forgotten root password problem is to boot your system in the single-user mode.
If you are using LILO, at the LILO boot prompt (graphical LILO users can press Ctrl-x to exit the graphical screen and go to the boot: prompt), and then enter:
Code:
linux single
This will make you the "root" user without asking for a password. Once the system has booted, you can change the root password using the password command:
Code:
passwd
GRUB users will follow basically the same steps, except that the GRUB boot loader doesn't have a default boot prompt, but you can choose "e'' when the menu displays to edit the boot parameters. Just select the kernel line for the kernel you want to boot. Go to the end of that line and type "single" as a separate word, then press ENTER to exit the edit mode. Once back at the GRUB screen, press "b" to boot into single user mode.

Friday, January 05, 2007

Backup of DataBase from MYSQL

Every database admin job is to take DB backup time to time.
there is two method's i am using..
Method 1st :
mysqldump client is a backup program used to dump a database or a collection of databases for backup or transfer to another SQL server. The dump typically contains SQL statements to create the table, populate it, or both. However, mysqldump can also be used to generate files in CSV, other delimited text, or XML format.

The most common use of mysqldump is probably for making a backup of an entire database:
shell> mysqldump db_name > backup-file.sql
You can read the dump file back into the server like this:
shell> mysql db_name < backup-file.sql

Or like this:
shell> mysql -e "source /path-to-backup/backup-file.sql" db_name

mysqldump is also very useful for populating databases by copying data from one MySQL server to another:
shell> mysqldump --opt db_name | mysql --host=remote_host -C db_name

It is possible to dump several databases with one command:
shell> mysqldump --databases db_name1 [db_name2 ...] > my_databases.sql

To dump all databases, use the --all-databases option:
shell> mysqldump --all-databases > all_databases.sql
more u can read

Method 2nd:
find out where ur mysql sotre's the database generally default path will be:
:var/lib/mysql this is datadir=var/lib/mysql which is mention in mysql configuration file.

All the DB's u willfind on mysql dir, so u can copy the mysql dir.
this kind of backup used when u want to uninstall and then again install with different version.
simply move to other location mysql dir, and then copy that.

Tuesday, December 26, 2006

rm and the 'Argument list too long'

you wanted to delete all the files in a directory that begins with the word 'temp' bala bala

[prabhat@my-site]# rm temp*
bash: /bin/rm: Argument list too long

ERROR!
This happens when you are trying to delete too many files in a directory at the same time - it seems rm has limits ....

To solve the problem:

Use 'find' to pipe all the matching files to 'rm', one at a time.
[prabhat@my-site]# find . -name 'temp*' | xargs rm

or

[prabhat@my-site]# find . -name 'temp*' - print0 | xargs -0 rm -f

Monday, December 18, 2006

Sort folders by size with one command

Entire user’s data is under /home, I need to have a list of all the sub folders sorted by the size of the sub folders.
simple command to get the list of sub folders sorted by their size:
du --max-depth=1 /home/ | sort -n -r

Friday, December 01, 2006

Zombie Process

A process can be sleeping in kernel code. Usually that's because of faulty hardware or a badly written driver- or maybe a little of both. A device that isn't set to the interrupt the driver thinks it is can cause this, for example- the driver is waiting for something its never going to get. The process doesn't ignore your signal- it just never gets it.
A zombie process doesn't react to signals because it's not really a process at all- it's just what's left over after it died. What's supposed to happen is that its parent process was to issue a "wait()" to collect the information about its exit. If the parent doesn't (programming error or just bad programming), you get a zombie. The zombie will go away if its parent dies- it will be "adopted" by init which will do the wait()- so if you see one hanging about, check its parent; if it is init, it will be gone soon, if not the only recourse is to kill the parent..which you may or may not want to do.
* Finally, a process that is being traced (by a debugger, for example) won't react to the KILL either.

We can find out zombie process by :-
Use top or ps command:
# top
OR
# ps aux | awk '{ print $8 " " $2 }' | grep -w Z


How do I kill zombie process?
You cannot kill zombies, as they are already dead. But if you have too many zombies then kill parent process or restart service.

You can kill zombie process using PID obtained from any one of the above command. For example kill zombie proces having PID 4104:
# kill -9 4104
*Please note that kill -9 does not guarantee to kill a zombie process

How do I automate zombie process killing?
Write a script and schedule as a cron job.
for each in `ps jauxww | grep Z | grep -v PID | awk ‘{print $3}’`; do for every in `ps auxw | grep $each | grep cron | awk ‘{print $2}’`; do kill -9 $every; done; done

Thursday, November 23, 2006

grep command : Finds text within a file

The grep command searches for the pattern specified by the Pattern parameter and writes each matching line to standard output.
Examples

0. $ grep '12.00' /home/prabhat/backup/log.txt
This command basically shows how you can use grep to extract lines containing a particular string from a text file.
1. To use a pattern that contains some of the pattern-matching characters *, ^, ?, [, ], \(, \), \{, and \}, enter:
grep "^[a-zA-Z]" pgm.s
This displays every line in pgm.s whose first character is a letter.

2. To display all lines that do not match a pattern, enter:
grep -v "^#" pgm.s
This displays every line in pgm.s whose first character is not a # (pound sign).

3. To display all lines in the file1 file that match either the abc or xyz string, enter:
grep -E "abc|xyz" file1

4. To search for a $ (dollar sign) in the file named test2, enter:
grep \\$ test2
The \\ (double backslash) characters are necessary in order to force the shell to pass a \$ (single backslash, dollar sign) to the grep command. The \ (single backslash) character tells the grep command to treat the following character (in this example the $) as a literal character rather than an expression character. Use the fgrep command to avoid the necessity of using escape characters such as the backslash.

^ - match at the beginning of the line
$ - match at the end of the line

Some extra options for grep
-v
Reverses the normal behavior of the grep command - Instead of selecting lines, it rejects the lines that match the given criteria.
-c
It suppresses the normal output and only prints the total count of matching lines instead of the actual lines.
-i
Ignores the case of the text when matching the given pattern.
-w
Checks if the given pattern is a word by itself and not a part of another word. Thus if you search for 'bay' and the word 'baywatch' is present in a file, the particular line containing that word would not be returned in the result.
-l
Only gives the names of the files in which the given pattern was found.
-r
Checks for the given pattern , recursively within the directory that you specify after the -r option

know more
http://www.computerhope.com/unix/ugrep.htm
http://linux.about.com/od/commands/l/blcmdl1_grep.htm
http://www.lowfatlinux.com/linux-grep-manual.html

Wednesday, November 22, 2006

yum : Yellow dog Updater, Modified

automated software installation and update for linux
yum is software installation tool for Red hat linux and Fedora Linux. It is a complete software management system. yum is designed to use over network/internet. It does not use CDROM to install packages. If you are using fedora you don't have to install it, it is part of fedora itself.

In the case u don't have yum, then u can download yum from project home page http://linux.duke.edu/projects/yum/download.ptml
u can Install using.(it is avaliable in rmp)
# rpm -ivh yup*
U can Configure yum editing /etc/yum.conf
# emacs /etc/yum.conf
Append or edit code as follows:
[base]
name=Fedora Core $releasever - $basearch - Base
baseurl=http://apt.sw.be/fedora/$releasever/en/$basearch/dag
baseurl=http://mirrors.kernel.org/fedora/core/$releasever/$basearch/os
Install GPG signature key with rpm command:
# rpm --import http://dag.wieers.com/packages/RPM-GPG-KEY.dag.txt
and other keys too (if any using above command)
Update your package list:
# yum check-update
Install a new package called test
# yum install test
To update packages
# yum update
To update a single package called test1
# yum update test1
To remove a package called test2
# yum remove test2
To list all packages
# yum list installed
You can search using grep command
# yum list installed | grep test1
Display information on a package called test
# yum info test
To display list of packages for which updates are available
# yum list updates
To clean all cahced packages:
# yum clean packages
To remove all cached packages and old headers:
# yum clean all
Force a fresh download of package
yum clean headers
yum clean oldheaders
To Know more visit :
http://www.die.net/doc/linux/man/man5/yum.conf.5.html http://www.linuxcommand.org/man_pages/yum8.html
http://www.linuxmanpages.com/man8/yum.8.php

Thursday, November 16, 2006

Did u know how many virtual web site's ?

Following command show how many virtual web site's running on ur server.

httpd -t -D DUMP_VHOSTS
or
apache2 -t -D DUMP_VHOSTS

Saturday, November 11, 2006

How to keep a computer from answering to ping?

it is possible to block pings entirely to your machine..

a simple
"echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all" will do the trick...

to turn it back on, simply
"echo 0 > /proc/sys/net/ipv4/icmp_echo_ignore_all"

Saturday, October 28, 2006

How to do backup with tar?

You can mantain a list of files that you with to backup into a file and tar
it when you wish.

tar czvf tarfile.tar.gz -T list_file

where list_file is a simple list of what you want to include into the tar

i.e:

/etc/smb.conf
/root/myfile
/etc/ppp (all files into the /etc/ppp directory)
/opt/gnome/html/gnome-dev-info.html

How to remove a file with a dash as first character?

If you accidentally created a file with a - in the beginning then you want to
remove it, you have to do :
rm ./-thefile

Tuesday, September 26, 2006

Secure Deletion of Data from Magnetic and Solid-State Memory

Secure Deletion of Data from Magnetic and Solid-State Memory

`shred': Remove files more securely

`shred' overwrites devices or files, to help prevent even very
expensive hardware from recovering the data.

Ordinarily when you remove a file (*note rm invocation::), the data
is not actually destroyed. Only the index listing where the file is
stored is destroyed, and the storage is made available for reuse.
There are undelete utilities that will attempt to reconstruct the index
and can bring the file back if the parts were not reused.
On a busy system with a nearly-full drive, space can get reused in a
few seconds. But there is no way to know for sure. If you have
sensitive data, you may want to be sure that recovery is not possible
by actually overwriting the file with non-sensitive data.

The best way to remove something irretrievably is to destroy the
media it's on with acid, melt it down, or the like. For cheap
removable media like floppy disks, this is the preferred method.
However, hard drives are expensive and hard to melt, so the `shred'
utility tries to achieve a similar effect non-destructively.

`Secure Deletion of Data from Magnetic and Solid-State Memory', from the
proceedings of the Sixth USENIX Security Symposium (San Jose,
California, 22-25 July, 1996).
visit: http://www.cs.auckland.ac.nz/~pgut001/pubs/secure_del.html

So. `shred' a linux command : Remove files more securely

shred [OPTION]... FILE[...]

look man page how to use..

Basics of Kubernetes

 Kubernetes, often abbreviated as K8s , is an open-source platform designed to automate the deployment, scaling, and management of container...