Friday, 21 December 2012

How to Recover Corrupted Partition From A Bad Superblock


-->
Q. How can I Recover a bad superblock from a corrupted ext2/3/4 partition to get back my data? I'm getting following error:
/dev/sda2: Input/output error
mount: /dev/sda2: can't read superblock
How do I fix this error?

A. Linux ext2/3/4 filesystem stores superblock at different backup location so it is possible to get back data from corrupted partition.

WARNING! Make sure file system is UNMOUNTED.
If your system will give you a terminal type the following command, else boot Linux system from rescue disk (boot from 1st CD/DVD. At boot: prompt type command linux rescue).

Mount partition using alternate superblock

Find out superblock location for /dev/sda2:

# dumpe2fs /dev/sda2 | grep superblock

Sample output:
  Primary superblock at 0, Group descriptors at 1-6
  Backup superblock at 32768, Group descriptors at 32769-32774
  Backup superblock at 98304, Group descriptors at 98305-98310
  Backup superblock at 163840, Group descriptors at 163841-163846
  Backup superblock at 229376, Group descriptors at 229377-229382
  Backup superblock at 294912, Group descriptors at 294913-294918
  Backup superblock at 819200, Group descriptors at 819201-819206
  Backup superblock at 884736, Group descriptors at 884737-884742
  Backup superblock at 1605632, Group descriptors at 1605633-1605638
  Backup superblock at 2654208, Group descriptors at 2654209-2654214
  Backup superblock at 4096000, Group descriptors at 4096001-4096006
  Backup superblock at 7962624, Group descriptors at 7962625-7962630
  Backup superblock at 11239424, Group descriptors at 11239425-11239430
  Backup superblock at 20480000, Group descriptors at 20480001-20480006
  Backup superblock at 23887872, Group descriptors at 23887873-23887878
 
Now check and repair a Linux file system using alternate superblock # 32768:

# fsck -b 32768 /dev/sda2
Sample output:
fsck 1.40.2 (12-Jul-2007)
e2fsck 1.40.2 (12-Jul-2007)
/dev/sda2 was not cleanly unmounted, check forced.
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Free blocks count wrong for group #241 (32254, counted=32253).
Fix? yes
Free blocks count wrong for group #362 (32254, counted=32248).
Fix? yes
Free blocks count wrong for group #368 (32254, counted=27774).
Fix? yes
..........
/dev/sda2: ***** FILE SYSTEM WAS MODIFIED *****
/dev/sda2: 59586/30539776 files (0.6% non-contiguous), 3604682/61059048 blocks
 
Now try to mount file system using mount command:

# mount /dev/sda2 /mnt

You can also use superblock stored at 32768 to mount partition, enter:

# mount sb={alternative-superblock} /dev/device /mnt
# mount sb=32768 /dev/sda2 /mnt


Try to browse and access file system:

# cd /mnt
# mkdir test
# ls -l
# cp file /path/to/safe/location

You should always keep backup of all important data including configuration files.

Saturday, 8 December 2012

How to manage log files using logrotate


-->
Managing log files effectively is an essential task for Linux sysadmin.
In this article, let us discuss how to perform following log file operations using UNIX logrotate utility.
  • Rotate the log file when file size reaches a specific size
  • Continue to write the log information to the newly created file after rotating the old log file
  • Compress the rotated log files
  • Specify compression option for the rotated log files
  • Rotate the old log files with the date in the filename
  • Execute custom shell scripts immediately after log rotation
  • Remove older rotated log files

1. Logrotate Configuration files

Following are the key files that you should be aware of for logrotate to work properly.
/usr/sbin/logrotate – The logrotate command itself.
/etc/cron.daily/logrotate – This shell script executes the logrotate command everyday.
$ cat /etc/cron.daily/logrotate
#!/bin/sh

/usr/sbin/logrotate /etc/logrotate.conf
EXITVALUE=$?
if [ $EXITVALUE != 0 ]; then
    /usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
fi
exit 0
/etc/logrotate.conf – Log rotation configuration for all the log files are specified in this file.
$ cat /etc/logrotate.conf
weekly
rotate 4
create
include /etc/logrotate.d
/var/log/wtmp {
    monthly
    minsize 1M
    create 0664 root utmp
    rotate 1
}
/etc/logrotate.d – When individual packages are installed on the system, they drop the log rotation configuration information in this directory. For example, yum log rotate configuration information is shown below.
$ cat /etc/logrotate.d/yum
/var/log/yum.log {
    missingok
    notifempty
    size 30k
    yearly
    create 0600 root root
}

2. Logrotate size option: Rotate the log file when file size reaches a specific limit

If you want to rotate a log file (for example, /tmp/output.log) for every 1KB, create the logrotate.conf as shown below.
$ cat logrotate.conf
/tmp/output.log {
        size 1k
        create 700 ranjith ranjith
        rotate 4
}
This logrotate configuration has following three options:
  • size 1k – logrotate runs only if the filesize is equal to (or greater than) this size.
  • create – rotate the original file and create the new file with specified permission, user and group.
  • rotate – limits the number of log file rotation. So, this would keep only the recent 4 rotated log files.
Before the logrotation, following is the size of the output.log:
$ ls -l /tmp/output.log
-rwx------- 1 ranjith ranjith 25868 2010-06-09 21:19 /tmp/output.log
Now, run the logrotate command as shown below. Option -s specifies the filename to write the logrotate status.
$ logrotate -s /var/log/logstatus logrotate.conf
Note : whenever you need of log rotation for some files, prepare the logrotate configuration and run the logroate command manually.
After the logrotation, following is the size of the output.log:
$ ls -l /tmp/output*
-rwx------- 1 ranjith ranjith 25868 2010-06-09 21:19 output.log.1
-rwx------ 1 ranjith ranjith        0 2010-06-09 21:20 output.log
Eventually this will keep following setup of rotated log files.
  • output.log.4.
  • output.log.3
  • output.log.2
  • output.log.1
  • output.log
Please remember that after the log rotation, the log file corresponds to the service would still point to rotated file (output.log.1) and keeps on writing in it. You can use the above method, if you want to rotate the apache access_log or error_log every 5 MB.
Ideally, you should modify the /etc/logrotate.conf to specify the logrotate information for a specific log file.

3. Logrotate copytruncate option: Continue to write the log information in the newly created file after rotating the old log file.

$ cat logrotate.conf
/tmp/output.log {
         size 1k
         copytruncate
         rotate 4
}
copytruncate instruct logrotate to creates the copy of the original file (i.e rotate the original log file) and truncates the original file to zero byte size. This helps the respective service that belongs to that log file can write to the proper file.


Saturday, 13 October 2012

How to configure sftp in rhel 6.3 / centos 6.3


How to Configure sftp

Note: sftp works in port number 115
[root@station1 ~]# cd /etc/vsftpd/
[root@station1 ~]# /usr/bin/openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout vsftpd.pem -out vsftpd.pem
[root@station1 ~]# vim /etc/vsftpd/vsftpd.conf
121 #For SSL
122 ssl_enable=YES
123 #To allow anonymous users to use SSL
124 allow_anon_ssl=YES
125 #local users to use both ssl and unsecure way
126 force_local_data_ssl=YES
127 #Force ssl
128 force_local_logins_ssl=YES
129 # Permit TLS v1 protocol connections. TLS v1 connections are preferred
130 ssl_tlsv1=YES
131 # Permit SSL v2 protocol connections. TLS v1 connections are preferred
132 ssl_sslv2=YES
133 # permit SSL v3 protocol connections. TLS v1 connections are preferred
134 ssl_sslv3=YES
135 #RSA certificate
136 rsa_cert_file=/etc/vsftpd/vsftpd.pem
[root@station1 ~]# service vsftpd restart
Shutting down vsftpd: [ OK ]
Starting vsftpd for vsftpd: [ OK ]
[root@station1 ~]# ssh 10.65.62.35 --> loging in to client pc i.e station2
[root@station2 ~]# ftp ranjith@10.65.62.30 --- > Try, it wont login because we have kept force ssl

^C[root@station2 ~]#
[root@station2 ~]# sftp ranjith@10.65.62.30
Connecting to 10.65.62.30...
ranjith@10.65.62.30's password:
sftp> ls
Desktop Documents Downloads Music Pictures Public Templates Videos
sftp> bye
[root@station2 ~]#

Wednesday, 10 October 2012

Ekiga VoIP Application in RHEL 6.3 / Centos 6.3


-->
How to Install & Configure Ekiga in rhel 6.3 / centos 6.3

-->
[root@station1 ~]# yum install ptlib or ptlib*
[root@station1 ~]# cd /usr/lib64/
[root@station1 lib64]# ln -s ptlib-2.6.5/ 2.6.5/ --> this step bcoz the application looks for lib in 2.6.5
[root@station1 ~]# yum install -y ekiga
Then go to Applications -> Internet -> IP Technology, VoIP and Video Conferencing

Step : 1click forward


Step : 2Enter Your Name & forward


Step : 3Don't enter anything just click the check box below & forward

Step : 4Don't enter anything just click the check box below & forward



Sunday, 30 September 2012

How to redirect http to https in apache

 Just Add this line to end of your httpd.conf file

[root@station1 ~]# vim /etc/httpd/conf/httpd.conf
1025 RewriteEngine On
1026 RewriteCond %{SERVER_PORT} !443
1027 RewriteRule (.*) https://station1.ranjihat.com/ [R]
[root@station1 ~]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                             [  OK  ]

Thats it.. Open your webpage using http, you can observe the site will be automatically redirected to https.

Saturday, 29 September 2012

How to install nagios in rhel 6.3 / centos 6.3

Introduction
This guide is intended to provide you with simple instructions on how to install Nagios from source (code) on Fedora and have it monitoring your local machine inside of 20 minutes. No advanced installation options are discussed here - just the basics that will work for 95% of users who want to get started.
These instructions were written based on a standard RHEL 6.3 Linux distribution. 

What You'll End Up With
 
If you follow these instructions, here's what you'll end up with:
  • Nagios and the plugins will be installed underneath /usr/local/nagios
  • Nagios will be configured to monitor a few aspects of your local system (CPU load, disk usage, etc.)
  • The Nagios web interface will be accessible at http://localhost/nagios/
Prerequisites
 
During portions of the installation you'll need to have root access to your machine.
Make sure you've installed the following packages on your Fedora installation before continuing.
  • Apache
  • PHP
  • GCC compiler
  • GD development libraries
You can use yum to install these packages by running the following commands (as root):
yum install httpd php

yum install gcc glibc glibc-common

yum install gd gd-devel 
gd-devel is not available in default package so download from here. 
While installing it throws dependency errors. 
Just install those dependency through yum after that install this gd-devel rpm
ftp://rpmfind.net/linux/centos/6.3/os/x86_64/Packages/gd-devel-2.0.35-10.el6.x86_64.rpm
 
1) Create Account Information
Become the root user.
su -l

Create a new nagios user account and give it a password.
/usr/sbin/useradd -m 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 apache
 
2) Download Nagios and the Plugins
Create a directory for storing the downloads.
mkdir ~/downloads

cd ~/downloads
Download the source code tarballs of both Nagios and the Nagios plugins (visit http://www.nagios.org/download/ for links to the latest versions).


3) Compile and Install Nagios

Extract the Nagios source code tarball.
cd ~/downloads

tar xzf nagios-3.2.3.tar.gz

cd nagios-3.2.3
Run the Nagios configure script, passing the name of the group you created earlier like so:
./configure --with-command-group=nagcmd
Compile the Nagios source code.
make all
Install binaries, init script, sample config files and set permissions on the external command directory.
make install

make install-init

make install-config

make install-commandmode

Don't start Nagios yet - there's still more that needs to be done...

4) Customize Configuration

Sample configuration files have now been installed in the /usr/local/nagios/etc directory. These sample files 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

5) Configure the Web Interface

Install the Nagios web config file in the Apache conf.d directory.
 
make install-webconf

Create a nagiosadmin account for logging into the Nagios web interface. Remember the password you assign to this account - you'll need it later.
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
Restart Apache to make the new settings take effect.
 
service httpd restart

Note: Consider implementing the ehanced CGI security measures described here 
to ensure that your web authentication credentials are not compromised. 
 
[root@station1 ~]# htdigest -c /usr/local/nagios/etc/.digest_pw "Nagios Access" \ 
nagiosadmin 
 
Adding password for nagiosadmin in realm Nagios Access.
New password: 
Re-type new password: 
 
[root@station1 ~]# vim /etc/httpd/conf.d/nagios.conf 
  9 ScriptAlias /nagios/cgi-bin "/usr/local/nagios/sbin"
 10 
 11 <Directory "/usr/local/nagios/sbin">
 12    SSLRequireSSL
 13    Options ExecCGI
 14    AllowOverride None
 15    Order allow,deny
 16 #   Allow from all
 17 #  Order deny,allow
 18 #  Deny from all
 19    Allow from 127.0.0.1 10.65.62.30
 20    AuthName "Nagios Access"
 21    AuthType Digest
 22    AuthUserFile /usr/local/nagios/etc/.digest_pw
 23    Require valid-user
 24 </Directory>
 25 
 26 Alias /nagios "/usr/local/nagios/share"
 27 
 28 <Directory "/usr/local/nagios/share">
 29    SSLRequireSSL
 30    Options None
 31    AllowOverride None
 32    Order allow,deny
 33 #   Allow from all
 34 #  Order deny,allow
 35 #  Deny from all
 36    Allow from 127.0.0.1 10.65.62.30
 37    AuthName "Nagios Access"
 38    AuthType Digest
 39    AuthUserFile /usr/local/nagios/etc/.digest_pw
 40    Require valid-user
 41 </Directory>

Monitoring Tools in rhel

Need to monitor Linux server performance? Try these built-in command 

top - Process Activity Command
 The top program provides a dynamic real-time view of a running system i.e. actual process activity. By default, it displays the most CPU-intensive tasks running on the server and updates the list every five seconds.
Commonly Used Hot Keys
The top command provides several useful hot keys:
Hot KeyUsage
tDisplays summary information off and on.
mDisplays memory information off and on.
ASorts the display by top consumers of various system resources. Useful for quick identification of performance-hungry tasks on a system.
fEnters an interactive configuration screen for top. Helpful for setting up top for a specific task.
oEnables you to interactively select the ordering within top.
rIssues renice command.
kIssues kill command.
zTurn on or off color/mono
vmstat - System Activity, Hardware and System Information

The command vmstat reports information about processes, memory, paging, block IO, traps, and cpu activity.

# vmstat 3

Display Memory Utilization Slabinfo

# vmstat -m

Get Information About Active / Inactive Memory Pages

# vmstat -a

w - Find Out Who Is Logged on And What They Are Doing

[root@station1 ~]# w root
 11:05:46 up 38 min,  3 users,  load average: 0.04, 0.11, 0.13
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
root     tty1     :0               10:28   38:23   1:37   1:37  /usr/bin/Xorg :
root     pts/0    :0.0             10:28   37:12   1.17s  0.00s sh reliance.sh
root     pts/3    :0.0             11:05    0.00s  0.02s  0.01s w root

Thursday, 27 September 2012

Crondtab usage


What is a Crontab?
A cron is a utility that allows tasks to automatically run in the background of the system at regular intervals by use of the cron daemon. Crontab (CRON TABle) is a file which contains the schedule of cron entries to be run and at what times they are to be run. This can be quite useful. For example, you may have a personal temporary directory that you wish to be cleaned out once a day to keep your quota from being exceeded. This is where cron scheduling comes in to play. Not all systems allow for a cron schedule to be setup. You need to see your system administrator to see if it is available on your system.

How does it work?

The editor must be invoked using the -e switch. To create a cron schedule type:
crontab -e
Each cron job has at least 6 sections. Each section is separated by a single space, but the final section may have spaces within it. No spaces are allowed within Sections 1-5, only between them. Sections 1-5 are indicate when and how often you want the task (the sixth position) to be executed. All time are local times not GMT.

Here is how positions 1-5 are layed out:
1 Minute 0-59
2 Hour 0-23 (0 = midnight)
3 Day 1-31
4 Month 1-12
5 Weekday 0-6 (0 = Sunday)
An asterisk (*) is used to indicate that every instance (i.e. every hour, every weekday, etc.) of the particular time period will be used.
If you wish to use more than one instance of a particular time periods, then seperate the times by a comma. If you wish for continuous execution, the start and stop items are separated by a dash. For example, if you wanted to run your command at :05 and :35 past the hour, every hour, Monday through Friday, then your time stamp would look like this:
5,35 * * * 1-5 cmd
30 */1 * * * 1-5 cmd-- this means  at every 1 hours 30 min the process will execute
ll'y for days weeks and month u can apply like this by putting , between numbers.
Example- * * 1,30 1,6,12 1-5 cmd
The sixth position indicates which task will be run at the given time(s).
if you wanted to remove all of the files in you "temp" directory every morning at 4:45 AM, your command would look:
45 4 * * * rm /home/{username}/temp/*
(Where you insert your username where appropriate.)
Special Note: While system commands are normally located in the same directories with standard settings for almost all machines, it is best to put the full path of the directory to any commands, system or not. For example, it would be better to use /usr/bin/rm instead of just rm. This also applies to any scripts. If there are not full paths to system commands (or other local commands), then it is possible that the cronjob will error. It is always best to include full path names on all commands.
Only command lines, blank lines and comments may be place in a crontab file. Any other type of text will cause the crontab to not function properly.


Are there any toggle options to Crontab?
Yes, one has already been introduced. The -e option allows you to edit your cron file (or create a cron file does not exist). There are three toggle options to crontab:
-e Edit (or create) a crontab file
-l List the crontab file
-r Remove the crontab file.
Why do I keep getting an email each time my Cron job runs?
The email is crontab's way of notifing you that it has completed (or not) the job you requested it to run. After everything is running smoothly, you may want to disable this feature, or redirect the output to a log file instaed of an email.
If you wish to diasble the email (and not output to a log file) then, at the end of each of the cron job lines you wish to not be notified on, place the command:
>/dev/null 2>&1
This essential writes the email out to nowhere (a trash bin of sorts), and thus solves the problem. Your final cron job line will look like this:
45 4 * * * rm /home/{username}/temp/* >/dev/null 2>&1
If you wish to diasble the email (and output to a log file) then, at the end of each of the cron job lines you wish to not be notified on, place the command:
> {logfile path and name}
or
>> {logfile path and name}
Special Note: One > means replace the current log with a new one, while (two) >> means append the current output to the end of the current log.
This essential writes the email out to nowhere (a trash bin of sorts), and thus solves the problem. Your final cron job line will look like this:
45 4 * * * rm /home/{username}/temp/* > /home/{username}/cronlogs/clear_temp_dir.txt >/dev/null 2>&1

use this link for crontab gui - www.corntab.com/pages/crontab-gui 
 
That's it?
As has been show, there is not really too much to learn in order to use crontab. It is a quite useful tool in automating your recurring tasks. Happy crontabbing!!!

Examples-

Scheduling a Job For a Specific Time

The basic usage of cron is to execute a job in a specific time as shown below. This will execute the Full backup shell script (full-backup) on 10th June 08:30 AM.

Please note that the time field uses 24 hours format. So, for 8 AM use 8, and for 8 PM use 20.
30 08 10 06 * /home/ranjith/full-backup
  • 30 – 30th Minute
  • 08 – 08 AM
  • 10 – 10th Day
  • 06 – 6th Month (June)
  • * – Every day of the week

Wednesday, 26 September 2012

How to configure postgres in rhel 6.3 / centos 6.3


-->
[root@station1 ~]# yum install postgresql*

Initializing the data first

root@station1 ~]# /etc/init.d/postgresql initdb
Initializing database: [ OK ]

Set PostgreSQL Environment

[root@station1 ~]# vim /var/lib/pgsql/.bash_profile
1 [ -f /etc/profile ] && source /etc/profile
2
3 PGDATA=/var/lib/pgsql/data
4 export PGDATA
5 PATH=$PATH:$HOME/bin:/usr/bin
6 export PATH
[root@station1 ~]# service postgresql start
Starting postgresql service: [ OK ]

Set postgres Password

[root@station1 ~]# su - postgres
-bash-4.1$ psql postgres postgres
psql (8.4.11)
Type "help" for help.
postgres=# alter user postgres with password 'postgres';
ALTER ROLE
postgres=#

Configure PostgreSQL pg_hba.conf File

[root@station1 ~]# vim /var/lib/pgsql/data/pg_hba.conf
70 local all all md5
71 # IPv4 local connections:
72 host all all 127.0.0.1/32 md5
73 # IPv6 local connections:
74 host all all ::1/128 md5

In order for the change to take effect, reload the pg_hba.conf file.

As with any command, there are several ways you can reload the pg_hba.conf file.

Method 1: From the shell using pg_ctl reload:
[root@station1 ~]# su - postgres
-bash-4.1$ pg_ctl reload
server signaled
-bash-4.1$

Method 2: From psql using pg_reload_conf();
[root@station1 ~]# su - postgres
-bash-4.1$ psql postgres postgres
Password for user postgres:
psql (8.4.11)
Type "help" for help.
postgres=# SELECT pg_reload_conf();
pg_reload_conf
----------------
t
(1 row)
postgres=#

Method 3: From the shell using -c switch to run select pg_reload_conf();
[root@station1 ~]# su - postgres
-bash-4.1$ psql postgres postgres -c "select pg_reload_conf();"
Password for user postgres:
pg_reload_conf
----------------
t
(1 row)
-bash-4.1$

How to configure svn in rhel 6.3 / centos 6.3


-->
Apache Subversion (often abbreviated SVN, after the command name svn) is a software versioning and revision control system distributed under an open source license. Developers use Subversion to maintain current and historical versions of files such as source code, web pages, and documentation. Its goal is to be a mostly compatible successor to the widely used Concurrent Versions System (CVS).

[root@station1 ~]# yum install mod_dav_svn subversion
[root@station1 ~]# vim /etc/httpd/conf.d/subversion.conf
41 <Location /svn>
42 DAV svn
43 SVNParentPath /var/www/svn
44 AuthType Basic
45 AuthName "Subversion repositories"
46 AuthUserFile /etc/svn-auth-users
47 Require valid-user
48 </Location>
[root@station1 ~]# htpasswd -cm /etc/svn-auth-users ranjith
New password:
Re-type new password:
Adding password for user ranjith
[root@station1 ~]# mkdir /var/www/svn
[root@station1 ~]# cd /var/www/svn/
[root@station1 svn]# svnadmin create testrepo
[root@station1 svn]# chown -R apache.apache testrepo
[root@station1 svn]# chcon -R -t httpd_sys_content_t /var/www/svn/testrepo
[root@station1 svn]# chcon -R -t httpd_sys_rw_content_t /var/www/svn/testrepo
[root@station1 ~]# service httpd restart

Goto http://station1.ranjihat.com/svn/testrepo address and you should see something like following, write username and password:




Configure repository
To disable anonymous access and enable access control add following rows to testrepo/conf/svnserve.conf file:

[root@station1 ~]# vim /var/www/svn/testrepo/conf/svnserve.conf
12 anon-access = none
27 authz-db = authz

Create trunk, branches and tags structure under testrepo

Create “template” directories with following command:

[root@station1 ~]# mkdir -p /tmp/svn-structure-template/{trunk,branches,tags}

Then import template to project repository using “svn import” command:

[root@station1 ~]# svn import -m 'Initial import' /tmp/svn-structure-template/ http://station1.ranjihat.com/svn/testrepo/

Authentication realm: <http://station1.ranjihat.com:80> Subversion repositories
Password for 'root':
Authentication realm: <http://station1.ranjihat.com:80> Subversion repositories
Username: ranjith
Password for 'ranjith':
Adding /tmp/svn-structure-template/trunk
Adding /tmp/svn-structure-template/branches
Adding /tmp/svn-structure-template/tags
-----------------------------------------------------------------------
ATTENTION! Your password for authentication realm:
<http://station1.ranjihat.com:80> Subversion repositories
can only be stored to disk unencrypted! You are advised to configure
your system so that Subversion can store passwords encrypted, if
possible. See the documentation for details.
You can avoid future appearances of this warning by setting the value
of the 'store-plaintext-passwords' option to either 'yes' or 'no' in
'/root/.subversion/servers'.
-----------------------------------------------------------------------
Store password unencrypted (yes/no)? yes
Committed revision 1.

Now refresh the webpage.

How to install tomcat in rhel 6.3 / centos 6.3

This post will cover installing and basic configuration of apache-tomcat-7.0.30

If you do not already have the Java Development Kit (JDK) installed on your machine, you will need to download and install the required JDK for your platform.

If you do have the JDK installed, you can skip to: Step 2: Download and Install the  apache-tomcat-7.0.30

Step 1: Install the JDK

[root@station1 Downloads]# rpm -ivh jdk-7u7-linux-x64.rpm
-->
[root@station1 Downloads]# JAVA_HOME=/usr/java/jdk1.7.0_07
[root@station1 Downloads]# export JAVA_HOME
[root@station1 Downloads]# PATH=$JAVA_HOME/bin:$PATH
[root@station1 Downloads]# export PATH 
[root@station1 Downloads]# vim /root/.bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs
JAVA_HOME=/usr/java/jdk1.7.0_07/
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
#PATH=$PATH:$HOME/bin
#export PATH
Restart or logout and login
[root@station1 Downloads]# echo $JAVA_HOME
/usr/java/jdk1.7.0_07/


       Step 2: Download and Unpack apache-tomcat-7.0.30 (or latest)
To download apache-tomcat click here
[root@station1 Downloads]# tar -xzvf apache-tomcat-7.0.30.tar.gz
[root@station1 Downloads]# mv apache-tomcat-7.0.30 /usr/share/
[root@station1 Downloads]# vim /etc/init.d/tomcat
    #!/bin/bash
    # description: Tomcat Start Stop Restart
    # processname: tomcat
    # chkconfig: 234 20 80
    JAVA_HOME=/usr/java/jdk1.7.0_07
    export JAVA_HOME
    PATH=$JAVA_HOME/bin:$PATH
    export PATH
    CATALINA_HOME=/usr/share/apache-tomcat-7.0.30

    case $1 in
    start)
    sh $CATALINA_HOME/bin/startup.sh
    ;;
    stop)
    sh $CATALINA_HOME/bin/shutdown.sh
    ;;
    restart)
    sh $CATALINA_HOME/bin/shutdown.sh
    sh $CATALINA_HOME/bin/startup.sh
    ;;
    esac
    exit 0
[root@station1 ~]# chmod 755 /etc/init.d/tomcat
[root@station1 ~]# chkconfig --add tomcat
[root@station1 ~]# chkconfig --level 234 tomcat on
[root@station1 ~]# chkconfig --list tomcat
tomcat             0:off    1:off    2:on    3:on    4:on    5:off    6:off
[root@station1 ~]# service tomcat stop
Using CATALINA_BASE:   /usr/share/apache-tomcat-7.0.30
Using CATALINA_HOME:   /usr/share/apache-tomcat-7.0.30
Using CATALINA_TMPDIR: /usr/share/apache-tomcat-7.0.30/temp
Using JRE_HOME:        /usr/java/jdk1.7.0_07
Using CLASSPATH:       /usr/share/apache-tomcat-7.0.30/bin/bootstrap.jar:/usr/share/apache-tomcat-7.0.30/bin/tomcat-juli.jar
[root@station1 ~]# service tomcat start
Using CATALINA_BASE:   /usr/share/apache-tomcat-7.0.30
Using CATALINA_HOME:   /usr/share/apache-tomcat-7.0.30
Using CATALINA_TMPDIR: /usr/share/apache-tomcat-7.0.30/temp
Using JRE_HOME:        /usr/java/jdk1.7.0_07
Using CLASSPATH:       /usr/share/apache-tomcat-7.0.30/bin/bootstrap.jar:/usr/share/apache-tomcat-7.0.30/bin/tomcat-juli.jar
[root@station1 ~]# service tomcat restart
Using CATALINA_BASE:   /usr/share/apache-tomcat-7.0.30
Using CATALINA_HOME:   /usr/share/apache-tomcat-7.0.30
Using CATALINA_TMPDIR: /usr/share/apache-tomcat-7.0.30/temp
Using JRE_HOME:        /usr/java/jdk1.7.0_07
Using CLASSPATH:       /usr/share/apache-tomcat-7.0.30/bin/bootstrap.jar:/usr/share/apache-tomcat-7.0.30/bin/tomcat-juli.jar
Using CATALINA_BASE:   /usr/share/apache-tomcat-7.0.30
Using CATALINA_HOME:   /usr/share/apache-tomcat-7.0.30
Using CATALINA_TMPDIR: /usr/share/apache-tomcat-7.0.30/temp
Using JRE_HOME:        /usr/java/jdk1.7.0_07
Using CLASSPATH:       /usr/share/apache-tomcat-7.0.30/bin/bootstrap.jar:/usr/share/apache-tomcat-7.0.30/bin/tomcat-juli.jar

For logs

[root@station1 ~]# less /usr/share/apache-tomcat-7.0.30/logs/catalina.out
We can now access the Tomcat Manager page at
[root@station1 ~]# firefox http://station1.ranjihat.com:8080


Sunday, 23 September 2012

How to Configure NIS in rhel 6 / centos 6.3


-->
[root@station1 ~]# vim /etc/exports
/nis *(rw,sync)
[root@station1 ~]# chkconfig nfslock on
[root@station1 ~]# chkconfig rpcbind on
[root@station1 ~]# chkconfig nfs on
[root@station1 ~]# service nfslock restart
[root@station1 ~]# service rpcbind restart
[root@station1 ~]# service nfs restart
[root@station1 Desktop]# showmount -e
Export list for station1.ranjihat.com:
/nis *
[root@station1 ~]# vim /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=station1.ranjihat.com
NISDOMAIN=ranjihat.com
[root@station1 ~]# vim /etc/hosts
127.0.0.1 station1 station1.ranjihat.com
10.65.62.35 station2 station2.ranjihat.com
[root@station1 ~]# vim /etc/yp.conf
ypserver 127.0.0.1
[root@station1 ~]# service rpcbind restart
[root@station1 ~]# yum install ypserv
[root@station1 ~]# service ypserv start
Setting NIS domain name ranjihat.com: [ OK ]
Starting YP server services: [ OK ]
[root@station1 ~]# chkconfig ypserv on
[root@station1 ~]# service ypxfrd start
Starting YP map server: [ OK ]
[root@station1 ~]# chkconfig ypxfrd on
[root@station1 ~]# /usr/lib64/yp/ypinit -m

At this point, we have to construct a list of the hosts which will run NIS
servers. station1 is in the list of NIS server hosts. Please continue to add
the names for the other hosts, one per line. When you are done with the
list, type a <control D>.
next host to add: station1
next host to add: station2
next host to add:
The current list of NIS servers looks like this:

station1
station2

Is this correct? [y/n: y] y
We need a few minutes to build the databases...
Building /var/yp/ranjihat.com/ypservers...
Running /var/yp/Makefile...
gmake[1]: Entering directory `/var/yp/ranjihat.com'
Updating passwd.byname...
Updating passwd.byuid...
Updating group.byname...
Updating group.bygid...
Updating hosts.byname...
Updating hosts.byaddr...
Updating rpc.byname...
Updating rpc.bynumber...
Updating services.byname...
Updating services.byservicename...
Updating netid.byname...
Updating protocols.bynumber...
Updating protocols.byname...
Updating mail.aliases...
gmake[1]: Leaving directory `/var/yp/ranjihat.com'

station1 has been set up as a NIS master server.

Now you can run ypinit -s station1 on all slave server.


Friday, 21 September 2012

How to install transmission bitTorrent Client in rhel 6.3 / centos 6.3

To download the Package click here

[root@station1 Downloads]# tar -xzvf transmission.tar.gz
[root@station1 Downloads]# cd transmission
[root@station1 transmission]# rpm -ivh *

Thats it see the app in Applications -> Internet -> Transmission BitTorrent Client

Thursday, 20 September 2012

How to install mplayer in rhel 6.x / centos 6.3

I have collected the packages required for mplayer and kept it in a zip file
To download the mplayer zip file click here

[root@vellore Downloads]$ unzip mplayer.zip
Archive:  mplayer.zip
   creating: mplayer/
   creating: mplayer/repodata/
  inflating: mplayer/xvidcore-1.2.2-1.el6.rf.x86_64.rpm 
  inflating: mplayer/x264-0.0.0-0.4.20101111.el6.rf.x86_64.rpm 
  inflating: mplayer/schroedinger-1.0.10-1.el6.rf.x86_64.rpm 
  inflating: mplayer/svgalib-1.9.25-8.el6.x86_64.rpm 
  inflating: mplayer/orc-0.4.16-6.el6.x86_64.rpm 
  inflating: mplayer/opencore-amr-0.1.2-1.el6.rf.x86_64.rpm 
  inflating: mplayer/mplayer-common-1.0-0.47.svn20100703.el6.rf.x86_64.rpm 
  inflating: mplayer/mpg123-1.14.4-1.el6.rf.x86_64.rpm 
  inflating: mplayer/lzo-2.03-3.1.el6.x86_64.rpm 
  inflating: mplayer/live555-0-0.27.2012.02.04.el6.rf.x86_64.rpm 
  inflating: mplayer/libvdpau-0.4.1-1.el6.rf.x86_64.rpm 
  inflating: mplayer/librtmp-2.3-1.el6.rf.x86_64.rpm 
  inflating: mplayer/libmad-0.15.1b-4.el6.rf.x86_64.rpm 
  inflating: mplayer/libdca-0.0.5-1.el6.rf.x86_64.rpm 
  inflating: mplayer/libcaca-0.99-0.9.beta16.el6.x86_64.rpm 
  inflating: mplayer/lame-3.99.5-1.el6.rf.x86_64.rpm 
  inflating: mplayer/fribidi-0.10.9-1.el6.rf.x86_64.rpm 
  inflating: mplayer/freeglut-2.6.0-1.el6.x86_64.rpm 
  inflating: mplayer/faac-1.26-1.el6.rf.x86_64.rpm 
  inflating: mplayer/enca-1.13-1.el6.x86_64.rpm 
  inflating: mplayer/dirac-libs-1.0.2-4.el6.x86_64.rpm 
  inflating: mplayer/mplayer-fonts-1.1-3.0.rf.noarch.rpm 
  inflating: mplayer/aalib-1.4.0-5.el6.rf.x86_64.rpm 
  inflating: mplayer/audiofile-0.2.6-11.1.el6.x86_64.rpm 
  inflating: mplayer/esound-libs-0.2.41-3.1.el6.x86_64.rpm 
  inflating: mplayer/arts-1.5.10-10.el6.x86_64.rpm 
  inflating: mplayer/mplayer-1.0-0.47.svn20100703.el6.rf.x86_64.rpm 
  inflating: mplayer/a52dec-0.7.4-8.el6.rf.x86_64.rpm 
  inflating: mplayer/repodata/repomd.xml 
 extracting: mplayer/repodata/other.xml.gz 
 extracting: mplayer/repodata/filelists.xml.gz 
 extracting: mplayer/repodata/primary.xml.gz 
[root@vellore Downloads]$ cd mplayer
[root@vellore mplayer]$ rm -rf repodata
[root@vellore mplayer]$ rpm -ivh *

If some packages missing then download that rpm packages from rpmfind site

http://rpmfind.net/linux/rpm2html/search.php

Check the manual page for keyboard shortcuts "man mplayer"

[root@station1 English_movies]# mplayer TRANSFORMERS\ 3D.mkv


How to install webmin in rhel 6

[root@station1 Desktop]# yum install -y httpd*
[root@station1 Desktop]# vim /etc/httpd/conf/httpd.conf
276 ServerName station1.ranjihat.com:80
285 UseCanonicalName On
[root@station1 Desktop]# chkconfig httpd on
[root@station1 Desktop]# service httpd start
Starting httpd: [ OK ]

To Download Webmin click here

[root@station1 Downloads]# rpm -ivh webmin-1.590-1.noarch.rpm
warning: webmin-1.590-1.noarch.rpm: Header V3 DSA/SHA1 Signature, key ID 11f63c51: NOKEY
Preparing... ########################################### [100%]
Operating system is CentOS Linux
1:webmin ########################################### [100%]
Webmin install complete. You can now login to http://station1.ranjihat.com:10000/
as root with your root password.
[root@station1 Downloads]# service httpd restart


Friday, 7 September 2012

how to configure squirrelmail in rhel6

First you should have a well configured dns in the system in which u are going to configure you mail server.

your forward zone should look like this
your reverse zone should look like this
Then install postfix service
[root@station1 ~]# yum install -y postfix
75 myhostname = station1.example.com
83 mydomain = example.com
99 myorigin = $mydomain
113 inet_interfaces = all
116 #inet_interfaces = localhost
164 #mydestination = $myhostname, localhost.$mydomain, localhost
165 mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
419 home_mailbox = Maildir/
:wq save and quit
[root@station1 ~]# chkconfig postfix on
[root@station1 ~]# service postfix start
Starting postfix: [ OK ]
[root@station1 ~]# yum install dovecot
[root@station1 ~]# yum install fetchmail
[root@station1 ~]# yum install mutt
[root@station1 ~]# vim /etc/dovecot/dovecot.conf
20 protocols = imap pop3 lmtp
32 login_greeting = Dovecot ready.
[root@station1 ~]# vim /etc/dovecot/conf.d/10-mail.conf
24 mail_location = maildir:~/Maildir
[root@station1 ~]# vim /etc/dovecot/conf.d/20-pop3.conf
51 pop3_uidl_format = %08Xu%08Xv
85 pop3_client_workarounds = outlook-no-nuls oe-ns-eoh
[root@station1 ~]# cd /etc/pki/tls/certs/
[root@station1 certs]# make dovecot.pem
Country Name (2 letter code) [XX]:IN
State or Province Name (full name) []:Kerala
Locality Name (eg, city) [Default City]:Calicut
Organization Name (eg, company) [Default Company Ltd]:Hp
Organizational Unit Name (eg, section) []:Edms
Common Name (eg, your name or your server's hostname) []:station1.example.com
Email Address []:root@station1.example.com
[root@station1 certs]# cp dovecot.pem /etc/pki/tls/private/
[root@station1 certs]# cp dovecot.pem /etc/pki/dovecot/certs/
[root@station1 certs]# cp dovecot.pem /etc/pki/dovecot/private/
[root@station1 certs]# vim /etc/pki/dovecot/dovecot-openssl.cnf
[ req_dn ]
# country (2 letter code)
C=IN

# State or Province Name (full name)
ST=Kerala

# Locality Name (eg. city)
L=Calicut

# Organization (eg. company)
O=Hp

# Organizational Unit Name (eg. section)
OU=Edms

# Common Name (*.example.com is also possible)
CN=station1.example.com

# E-mail contact
emailAddress=root@station1.example.com

[ cert_type ]
nsCertType = server
[root@station1 certs]# chkconfig dovecot on
[root@station1 certs]# service dovecot restart
Stopping Dovecot Imap: [ OK ]
Starting Dovecot Imap: [ OK ]
[root@station1 certs]# yum install httpd
[root@station1 certs]# vim /etc/httpd/conf/httpd.conf
262 ServerAdmin root@station1.example.com
276 ServerName station1.example.com:80
[root@station1 certs]# service httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]

To install squirrelmail download the packages form the link given below

for x86_64 epel package click here and install the rpm package epel

[root@station1 ~]# yum repolist
[root@station1 ~]# yum install squirrelmail

suppose if dependency issue occurs for php-mbstring download from here php-mbstring

Tuesday, 1 May 2012

how to download flash videos in rhel 6.3 / centos 6.3

This tutorial is very simple. you can just use your terminal to do this. No need of any software. what Login as user u have to do is just open youtube and buffer some video fully.
Then open your terminal

Note: This step wont work when u login as root.

[ranjith@station1 ~]$ ps aux | grep flash
ranjith 4032 17.4 7.0 812836 71460 ? Sl 21:40 17:54 /usr/lib64/opera//operapluginwrapper-native 85 88 /usr/lib64/flash-plugin/libflashplayer.so

4032 is the process id

[ranjith@station1 ~]$ cd /proc/4032/fd
[ranjith@station1 fd]$ ls -hal | grep Flash
lrwx------ 1 ranjith ranjith 64 May 1 23:20 12 -> /tmp/FlashXX6ILRNG (deleted)

Copy it (by ID) somewhere else.

[ranjith@station1 fd]$ cp 12 ~/flash.flv

Now you can play that flash.flv file with your vlc media player.

Sunday, 29 April 2012

Complete LVM steps in rhel 6

[root@station1 Desktop]# fdisk /dev/sda

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').

Command (m for help): n
First cylinder (10609-19457, default 10609):
Using default value 10609
Last cylinder, +cylinders or +size{K,M,G} (10609-19457, default 19457): +512M

Command (m for help): t
Partition number (1-6): 6
Hex code (type L to list codes): 8e
Changed system type of partition 6 to 8e (Linux LVM)

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
[root@station1 Desktop]# reboot
[root@station1 Desktop]# pvcreate /dev/sda6
Physical volume "/dev/sda6" successfully created
[root@station1 Desktop]# vgcreate shazam /dev/sda6
Volume group "shazam" successfully created
[root@station1 Desktop]# lvcreate -n storage -L 256M shazam
Logical volume "storage" created
[root@station1 Desktop]# mkfs -t ext4 /dev/shazam/storage
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
65536 inodes, 262144 blocks
13107 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67371008
32 block groups
8192 blocks per group, 8192 fragments per group
2048 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729, 204801, 221185

Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 30 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@station1 Desktop]# mkdir /storage
[root@station1 Desktop]# vim /etc/fstab
/dev/shazam/storage /storage ext4 defaults 1 2
[root@station1 Desktop]# mount -a
[root@station1 Desktop]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 29G 8.6G 19G 32% /
tmpfs 495M 100K 495M 1% /dev/shm
/dev/sda1 985M 39M 897M 5% /boot
/dev/sda5 46G 2.2G 42G 5% /sambashare
/dev/mapper/shazam-storage
248M 11M 226M 5% /storage
[root@station1 Desktop]#

------------------------extending a logical volume---------------------------
NOTE: NO NEED TO UNMOUNT THE VOLUME WHILE EXTENDING

[root@station1 Desktop]# vgdisplay shazam
--- Volume group ---
VG Name shazam
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 2
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 1
Act PV 1
VG Size 516.00 MiB
PE Size 4.00 MiB
Total PE 129
Alloc PE / Size 64 / 256.00 MiB
Free PE / Size 65 / 260.00 MiB --------->FREE SPACE IS 65 EXTENTS SO I USED +32 i.e HALF OF THE FREE SPACE
VG UUID NJ5N0M-09GF-KfKa-TT6Z-uMGL-mdRE-Dq1YPo

[root@station1 Desktop]# lvextend -l +32 /dev/shazam/storage
Extending logical volume storage to 384.00 MiB
Logical volume storage successfully resized
[root@station1 Desktop]# resize2fs /dev/shazam/storage
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/shazam/storage is mounted on /storage; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 2
Performing an on-line resize of /dev/shazam/storage to 393216 (1k) blocks.
The filesystem on /dev/shazam/storage is now 393216 blocks long.

[root@station1 Desktop]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 29G 8.6G 19G 32% /
tmpfs 495M 100K 495M 1% /dev/shm
/dev/sda1 985M 39M 897M 5% /boot
/dev/sda5 46G 2.2G 42G 5% /sambashare
/dev/mapper/shazam-storage
372M 11M 343M 3% /storage

--------------------------------Extending Volume Group---------------------------
[root@station1 Desktop]# fdisk /dev/sda

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').

Command (m for help): n
First cylinder (10609-19457, default 10609):
Using default value 10609
Last cylinder, +cylinders or +size{K,M,G} (10609-19457, default 19457): +512M

Command (m for help): t
Partition number (1-7): 7
Hex code (type L to list codes): 8e
Changed system type of partition 7 to 8e (Linux LVM)

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
[root@station1 Desktop]# reboot
[root@station1 Desktop]# pvcreate /dev/sda
sda sda1 sda2 sda3 sda4 sda5 sda6 sda7
[root@station1 Desktop]# pvcreate /dev/sda7
Physical volume "/dev/sda7" successfully created
[root@station1 Desktop]# vgextend shazam /dev/sda7
Volume group "shazam" successfully extended
[root@station1 Desktop]# pvdisplay
--- Physical volume ---
PV Name /dev/sda6
VG Name shazam
PV Size 517.69 MiB / not usable 1.69 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 129
Free PE 33
Allocated PE 96
PV UUID SY87lw-LqeE-2Vxv-4Hh6-fLSV-mTy2-Jt8VNm

--- Physical volume ---
PV Name /dev/sda7
VG Name shazam
PV Size 517.69 MiB / not usable 1.69 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 129
Free PE 129
Allocated PE 0
PV UUID sLoDna-esoW-pqms-Vc3k-Pc4c-RC4g-p8T130
-----------------------------------------to reduce vg-----------------------------

[root@station1 Desktop]# vgreduce shazam /dev/sda7
Removed "/dev/sda7" from volume group "shazam"
[root@station1 Desktop]# pvdisplay
--- Physical volume ---
PV Name /dev/sda6
VG Name shazam
PV Size 517.69 MiB / not usable 1.69 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 129
Free PE 65
Allocated PE 64
PV UUID SY87lw-LqeE-2Vxv-4Hh6-fLSV-mTy2-Jt8VNm

"/dev/sda7" is a new physical volume of "517.69 MiB"
--- NEW Physical volume ---
PV Name /dev/sda7
VG Name
PV Size 517.69 MiB
Allocatable NO
PE Size 0 ----------> look everything is 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID sLoDna-esoW-pqms-Vc3k-Pc4c-RC4g-p8T130

[root@station1 Desktop]# vgdisplay
--- Volume group ---
VG Name shazam
System ID
Format lvm2
Metadata Areas 1 ---------> look 1 is here
Metadata Sequence No 8
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 1
Act PV 1
VG Size 516.00 MiB ------------> look only 516 is here
PE Size 4.00 MiB
Total PE 129
Alloc PE / Size 64 / 256.00 MiB
Free PE / Size 65 / 260.00 MiB
VG UUID NJ5N0M-09GF-KfKa-TT6Z-uMGL-mdRE-Dq1YPo

NOTE: sda7 is just remove from the shazam it can be added at any time by command 'vgextend shazam /dev/sda7'