centostricks

Just another WordPress.com site

Category Archives: linux

Replace a faulty disk from Volume Group


This commands are run on CentOS EL 6.0

Replace a faulty disk from Volume Group

Here /dev/sdb has an hardware issue and its been found to be a faulty Disk.

Step 1: Let us scan to find any data available on the faulty disk, Here we find that 120MB is consumed and data is available

[root@localhost ~]# pvscan
PV /dev/sdc    VG VG_01           lvm2 [1020.00 MiB / 1020.00 MiB free]
PV /dev/sdb    VG VG_00           lvm2 [1020.00 MiB / 120.00 MiB free]
PV /dev/sda2   VG VolGroup        lvm2 [12.51 GiB / 0    free]
PV /dev/sdd                       lvm2 [1.00 GiB]
Total: 4 [15.50 GiB] / in use: 3 [14.50 GiB] / in no VG: 1 [1.00 GiB]

Step 2 : Check the LV and PV mapping  :  /dev/VG_00/song is mapped to /dev/sdb

[root@localhost ~]# pvdisplay -m /dev/sdb
— Physical volume —
PV Name               /dev/sdb
VG Name               VG_00
PV Size               1.00 GiB / not usable 4.00 MiB
Allocatable           yes
PE Size               4.00 MiB
Total PE              255
Free PE               30
Allocated PE          225
PV UUID               9oE3Rn-8obQ-8wwn-Samq-tM1N-VVaM-o1qf5W

— Physical Segments —
Physical extent 0 to 224:
Logical volume    /dev/VG_00/song
Logical extents    0 to 224
Physical extent 225 to 254:
FREE

[root@localhost ~]# lvdisplay -m /dev/VG_00/song
— Logical volume —
LV Name                /dev/VG_00/song
VG Name                VG_00
LV UUID                09CVS7-y162-Y8pp-IUXH-v67C-Pw7a-auFCKj
LV Write Access        read/write
LV Status              available
# open                 1
LV Size                900.00 MiB
Current LE             225
Segments               1
Allocation             inherit
Read ahead sectors     auto
– currently set to     256
Block device           253:2

— Segments —
Logical extent 0 to 224:
Type        linear
Physical volume    /dev/sdb
Physical extents    0 to 224

Step 3: Check the status of current LV

[root@localhost ~]# lvscan
ACTIVE            ‘/dev/VG_00/song’ [900.00 MiB] inherit
ACTIVE            ‘/dev/VolGroup/lv_root’ [10.54 GiB] inherit
ACTIVE            ‘/dev/VolGroup/lv_swap’ [1.97 GiB] inherit

Step 4 : Adding a New PV to VG to move the data from faulty PV to this NEW PV( IN our case /dev/sdb is found faulty)

[root@localhost ~]# vgextend VG_00 /dev/sd
sda   sda1  sda2  sdb   sdc   sdd
[root@localhost ~]# vgextend VG_00 /dev/sdd
Volume group “VG_00” successfully extended

Step 5 : Moving all its extents from /dev/sdb to free extents in VG_00, in our case we have only one pv /dev/sdd which is newly added. So all the extents are moved to /dev/sdd

[root@localhost ~]# pvmove /dev/sdb
/dev/sdb: Moved: 12.9%
/dev/sdb: Moved: 100.0%
[root@localhost ~]#
[root@localhost ~]#

Step 6 : Check for the changes, All the extents from /dev/sdb is moved to /dev/sdd..

[root@localhost ~]# pvscan
PV /dev/sdc    VG VG_01      lvm2 [1020.00 MiB / 1020.00 MiB free]
PV /dev/sdb    VG VG_00      lvm2 [1020.00 MiB / 1020.00 MiB free]
PV /dev/sdd    VG VG_00      lvm2 [1020.00 MiB / 120.00 MiB free]
PV /dev/sda2   VG VolGroup   lvm2 [12.51 GiB / 0    free]
Total: 4 [15.50 GiB] / in use: 4 [15.50 GiB] / in no VG: 0 [0   ]

Step 7: Still our LV is active and all data is intact. nothing is lost 🙂

[root@localhost ~]# lvscan
ACTIVE            ‘/dev/VG_00/song’ [900.00 MiB] inherit
ACTIVE            ‘/dev/VolGroup/lv_root’ [10.54 GiB] inherit
ACTIVE            ‘/dev/VolGroup/lv_swap’ [1.97 GiB] inherit
[root@localhost ~]# cd /striped/
[root@localhost striped]# ls
aa  lost+found  test
[root@localhost striped]# cat aa
dnandsandlandtesteinggg
[root@localhost striped]# cd

Step 8 : Now we are removing the faulty DISK (PV) /dev/sdb from Volume group VG_00

[root@localhost ~]# vgreduce VG_00 /dev/sdb
Removed “/dev/sdb” from volume group “VG_00”

Step 9: OUR Faulty Disk /dev/sdb is free from all VG and ready to be removed from System

[root@localhost ~]# pvscan
PV /dev/sdd    VG VG_00           lvm2 [1020.00 MiB / 120.00 MiB free]
PV /dev/sdc    VG VG_01           lvm2 [1020.00 MiB / 1020.00 MiB free]
PV /dev/sda2   VG VolGroup        lvm2 [12.51 GiB / 0    free]
PV /dev/sdb                       lvm2 [1.00 GiB]
Total: 4 [15.50 GiB] / in use: 3 [14.50 GiB] / in no VG: 1 [1.00 GiB]
[root@localhost ~]# cd /striped/
[root@localhost striped]# ls
aa  lost+found  test
[root@localhost striped]# cat aa
dnandsandlandtesteinggg

Now Our LV /dev/VG_00/song is using the extents from /dev/sdd.

[root@localhost ~]# lvdisplay -m /dev/VG_00/song
— Logical volume —
LV Name                /dev/VG_00/song
VG Name                VG_00
LV UUID                09CVS7-y162-Y8pp-IUXH-v67C-Pw7a-auFCKj
LV Write Access        read/write
LV Status              available
# open                 1
LV Size                900.00 MiB
Current LE             225
Segments               1
Allocation             inherit
Read ahead sectors     auto
– currently set to     256
Block device           253:2

— Segments —
Logical extent 0 to 224:
Type        linear
Physical volume    /dev/sdd
Physical extents    0 to 224

ALL THE BEST !!! . We did all this steps. without unmounting the filesystem or taking the system Down !!! Good Luck !!

Advertisements

Hot add scsci Disk in Centos 6.x/5.x without reboot of OS


Steps to Identify a newly added scsi disk in Centos 6.0 without rebooting OS

[root@localhost ~]# ls /sys/class/scsi_host/host
host0/ host1/ host2/
[root@localhost ~]#

This command will identify and hot add the disk running on host 2 , below we can see then as scsi2..

[root@localhost ~]# echo “- – -” > /sys/class/scsi_host/host2/scan

Now displaying the identified disks /dev/sdc, /dev/sdd, /dev/sdb

[root@localhost ~]# fdisk -l |grep sd
Disk /dev/dm-0 doesn’t contain a valid partition table
Disk /dev/dm-1 doesn’t contain a valid partition table
Disk /dev/sdc doesn’t contain a valid partition table
Disk /dev/sdd doesn’t contain a valid partition table
Disk /dev/sdb doesn’t contain a valid partition table
Disk /dev/sda: 14.0 GB, 13958643712 bytes
/dev/sda1 * 1 64 512000 83 Linux
/dev/sda2 64 1698 13118464 8e Linux LVM
Disk /dev/sdc: 1073 MB, 1073741824 bytes
Disk /dev/sdd: 1073 MB, 1073741824 bytes
Disk /dev/sdb: 1073 MB, 1073741824 bytes

[root@localhost ~]# cat /proc/scsi/scsi
Attached devices:
Host: scsi1 Channel: 00 Id: 00 Lun: 00
Vendor: NECVMWar Model: VMware IDE CDR10 Rev: 1.00
Type: CD-ROM ANSI SCSI revision: 05
Host: scsi2 Channel: 00 Id: 00 Lun: 00
Vendor: VMware, Model: VMware Virtual S Rev: 1.0
Type: Direct-Access ANSI SCSI revision: 02
Host: scsi2 Channel: 00 Id: 01 Lun: 00
Vendor: VMware, Model: VMware Virtual S Rev: 1.0
Type: Direct-Access ANSI SCSI revision: 02
Host: scsi2 Channel: 00 Id: 02 Lun: 00
Vendor: VMware, Model: VMware Virtual S Rev: 1.0
Type: Direct-Access ANSI SCSI revision: 02
Host: scsi2 Channel: 00 Id: 03 Lun: 00
Vendor: VMware, Model: VMware Virtual S Rev: 1.0
Type: Direct-Access ANSI SCSI revision: 02

current status : there are 2 scsi drives with 1 scsi drive (CDROM) on scsi 1 is the harddrive. Now i have added 1 more scsi drive. We will see what happens

Adding one more disk, but identifying with a different command

Another method used to identify the newly added disk : this command will not alter/overwrite any existing configurations

[root@localhost ~]# echo “scsi add-single-device 2 0 4 0” > /proc/scsi/scsi

When we run with a wrong values, below will be the output. there is no changes or damage. i have not encountered any issues. but not recommended to do so !

[root@localhost ~]# echo “scsi add-single-device 0 0 4 0” > /proc/scsi/scsi
-bash: echo: write error: Invalid argument
[root@localhost ~]# echo “scsi add-single-device 0 4 4 0” > /proc/scsi/scsi
-bash: echo: write error: Invalid argument
[root@localhost ~]# echo “scsi add-single-device 0 3 4 0” > /proc/scsi/scsi
-bash: echo: write error: Invalid argument
[root@localhost ~]# echo “scsi add-single-device 0 2 4 0” > /proc/scsi/scsi
-bash: echo: write error: Invalid argument
[root@localhost ~]# echo “scsi add-single-device 0 1 4 0” > /proc/scsi/scsi
-bash: echo: write error: Invalid argument
[root@localhost ~]# echo “scsi add-single-device 1 0 4 0” > /proc/scsi/scsi
-bash: echo: write error: Invalid argument
[root@localhost ~]# echo “scsi add-single-device 4 0 4 0” > /proc/scsi/scsi
-bash: echo: write error: No such device or address
[root@localhost ~]# echo “scsi add-single-device 3 0 4 0” > /proc/scsi/scsi
-bash: echo: write error: No such device or address

The effect of echo “scsi add-single-device 2 0 4 0” > /proc/scsi/scsi is shown below :

[root@localhost ~]# echo “scsi add-single-device 2 0 4 0” > /proc/scsi/scsi
[root@localhost ~]# cat /proc/scsi/scsi
Attached devices:
Host: scsi1 Channel: 00 Id: 00 Lun: 00
Vendor: NECVMWar Model: VMware IDE CDR10 Rev: 1.00
Type: CD-ROM ANSI SCSI revision: 05
Host: scsi2 Channel: 00 Id: 00 Lun: 00
Vendor: VMware, Model: VMware Virtual S Rev: 1.0
Type: Direct-Access ANSI SCSI revision: 02
Host: scsi2 Channel: 00 Id: 01 Lun: 00
Vendor: VMware, Model: VMware Virtual S Rev: 1.0
Type: Direct-Access ANSI SCSI revision: 02
Host: scsi2 Channel: 00 Id: 02 Lun: 00
Vendor: VMware, Model: VMware Virtual S Rev: 1.0
Type: Direct-Access ANSI SCSI revision: 02
Host: scsi2 Channel: 00 Id: 03 Lun: 00
Vendor: VMware, Model: VMware Virtual S Rev: 1.0
Type: Direct-Access ANSI SCSI revision: 02
Host: scsi2 Channel: 00 Id: 04 Lun: 00
Vendor: VMware, Model: VMware Virtual S Rev: 1.0
Type: Direct-Access ANSI SCSI revision: 02

We can see that there is a newly identified disk, Please use fdisk or parted to create required partitions ….

Initializing the Newly added disk before creating partitions

Better to use fdisk to create partitions with fdisk(Initializes the Disk) , as this disks are not initialized yet, and will give below errors, if parted is used

[root@localhost ~]# parted -l |grep sd*
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sda: 14.0GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
Error: /dev/sdb: unrecognised disk label
Error: /dev/sdc: unrecognised disk label
Error: /dev/sdd: unrecognised disk label
Error: /dev/sde: unrecognised disk label

See the below results, parted is not even allowing to create partitions :

[root@localhost ~]# parted /dev/sdc
GNU Parted 2.1
Using /dev/sdc
Welcome to GNU Parted! Type ‘help’ to view a list of commands.
(parted) p
Error: /dev/sdc: unrecognised disk label
(parted) u s
(parted) mkpart primary 64 -1s
Error: /dev/sdc: unrecognised disk label
(parted) p
Error: /dev/sdc: unrecognised disk label
(parted)

See the below output. “Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)”

If you are flexible with fdisk, you can go ahead and create partitions and save it.

If you are not flexible with fdisk and good with parted, just use the below steps , don’t create any partitions. just access the device and type ‘w’ later use parted to create partitions

[root@localhost ~]# fdisk /dev/sdc
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xfa03eeaf.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won’t be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

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): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

Now use parted and create partitions. see the below output, no more errors or warning. you are good to proceed with next steps of creating partitions. Good Luck !!!

[root@localhost ~]# parted /dev/sdc
GNU Parted 2.1
Using /dev/sdc
Welcome to GNU Parted! Type ‘help’ to view a list of commands.
(parted) p
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdc: 1074MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags

(parted)

***** END****

Disk resize steps when we see partitions as a Separate Disk in fdisk


[root@test ~]# fdisk -lu

Disk /dev/sda: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders, total 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00073eef

Device Boot Start End Blocks Id System
/dev/sda1 * 64 208895 104416 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 208896 209715199 104753152 8e Linux LVM

Disk /dev/mapper/VG_00-LV_root: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders, total 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/VG_00-LV_root doesn’t contain a valid partition table

Disk /dev/mapper/VG_00-LV_swap: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders, total 2097152 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/VG_00-LV_swap doesn’t contain a valid partition table

Disk /dev/mapper/VG_00-LV_var: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders, total 62914560 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/VG_00-LV_var doesn’t contain a valid partition table

Disk /dev/mapper/VG_00-LV_tmp: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders, total 4194304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/VG_00-LV_tmp doesn’t contain a valid partition table

Disk /dev/mapper/VG_00-LV_opt: 34.2 GB, 34225520640 bytes
255 heads, 63 sectors/track, 4161 cylinders, total 66846720 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/VG_00-LV_opt doesn’t contain a valid partition table
[root@test ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VG_00-LV_root
9.9G 1.4G 8.0G 15% /
tmpfs 7.8G 0 7.8G 0% /dev/shm
/dev/sda1 99M 32M 63M 34% /boot
/dev/mapper/VG_00-LV_opt
32G 317M 30G 2% /opt
/dev/mapper/VG_00-LV_tmp
2.0G 68M 1.9G 4% /tmp
/dev/mapper/VG_00-LV_var
30G 1.8G 27G 7% /var

[root@test ~]# parted /dev/sda
GNU Parted 2.1
Using /dev/sda
Welcome to GNU Parted! Type ‘help’ to view a list of commands.
(parted) print
Model: VMware Virtual disk (scsi)
Disk /dev/sda: 107GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
1 32.8kB 107MB 107MB primary ext3 boot
2 107MB 80.5GB 80.4GB primary lvm

(parted) u s
(parted) print
Model: VMware Virtual disk (scsi)
Disk /dev/sda: 209715200s
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
1 64s 208895s 208832s primary ext3 boot
2 208896s 157286399s 157077504s primary lvm

(parted) rm 2
Warning: WARNING: the kernel failed to re-read the partition table on /dev/sda
(Device or resource busy). As a result, it may not reflect all of your changes
until after reboot.
(parted) print
Model: VMware Virtual disk (scsi)
Disk /dev/sda: 209715200s
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
1 64s 208895s 208832s primary ext3 boot

You are facing ERROR

(parted) mkpart primary 208896s 209715200s
Error: The location 209715200s is outside of the device /dev/sda.
(parted) print
Model: VMware Virtual disk (scsi)
Disk /dev/sda: 209715200s
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
1 64s 208895s 208832s primary ext3 boot

You Should use the below COMMAND

(parted) mkpart primary 208896s -1s
Warning: WARNING: the kernel failed to re-read the partition table on /dev/sda
(Device or resource busy). As a result, it may not reflect all of your changes
until after reboot.
(parted) print
Model: VMware Virtual disk (scsi)
Disk /dev/sda: 209715200s
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
1 64s 208895s 208832s primary ext3 boot
2 208896s 209715199s 209506304s primary

(parted) toggle 2 lvm
Warning: WARNING: the kernel failed to re-read the partition table on /dev/sda
(Device or resource busy). As a result, it may not reflect all of your changes
until after reboot.
(parted) print
Model: VMware Virtual disk (scsi)
Disk /dev/sda: 209715200s
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
1 64s 208895s 208832s primary ext3 boot
2 208896s 209715199s 209506304s primary lvm

(parted) quit

Reboot the BOX

[root@test ~]# pvscan
PV /dev/sda2 VG VG_00 lvm2 [74.88 GiB / 0 free]
Total: 1 [74.88 GiB] / in use: 1 [74.88 GiB] / in no VG: 0 [0 ]
[root@test ~]# pvresize /dev/sda2
Physical volume “/dev/sda2” changed
1 physical volume(s) resized / 0 physical volume(s) not resized
[root@test ~]# pvscan
PV /dev/sda2 VG VG_00 lvm2 [99.88 GiB / 25.00 GiB free]
Total: 1 [99.88 GiB] / in use: 1 [99.88 GiB] / in no VG: 0 [0 ]
[root@test ~]# lvscan
ACTIVE ‘/dev/VG_00/LV_root’ [10.00 GiB] inherit
ACTIVE ‘/dev/VG_00/LV_var’ [30.00 GiB] inherit
ACTIVE ‘/dev/VG_00/LV_tmp’ [2.00 GiB] inherit
ACTIVE ‘/dev/VG_00/LV_swap’ [1.00 GiB] inherit
ACTIVE ‘/dev/VG_00/LV_opt’ [31.88 GiB] inherit
[root@test ~]# vgscan
Reading all physical volumes. This may take a while…
Found volume group “VG_00” using metadata type lvm2
[root@test ~]# lvextend -l +100%FREE /dev/VG_00/LV_opt
Extending logical volume LV_opt to 56.88 GiB
Logical volume LV_opt successfully resized

[root@test ~]# resize2fs /dev/VG_00/LV_opt
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/VG_00/LV_opt is mounted on /opt; on-line resizing required
old desc_blocks = 2, new_desc_blocks = 4
Performing an on-line resize of /dev/VG_00/LV_opt to 14909440 (4k) blocks.
The filesystem on /dev/VG_00/LV_opt is now 14909440 blocks long.

[root@test ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VG_00-LV_root
9.9G 1.4G 8.0G 15% /
tmpfs 7.8G 0 7.8G 0% /dev/shm
/dev/sda1 99M 32M 63M 34% /boot
/dev/mapper/VG_00-LV_opt
56G 320M 53G 1% /opt
/dev/mapper/VG_00-LV_tmp
2.0G 68M 1.9G 4% /tmp
/dev/mapper/VG_00-LV_var
30G 1.8G 27G 7% /var
[root@test ~]# lvscan
ACTIVE ‘/dev/VG_00/LV_root’ [10.00 GiB] inherit
ACTIVE ‘/dev/VG_00/LV_var’ [30.00 GiB] inherit
ACTIVE ‘/dev/VG_00/LV_tmp’ [2.00 GiB] inherit
ACTIVE ‘/dev/VG_00/LV_swap’ [1.00 GiB] inherit
ACTIVE ‘/dev/VG_00/LV_opt’ [56.88 GiB] inherit

Upgrade Ruby for a particular user not affecting system ruby


Upgrade Ruby for a particular user not affecting system ruby

1. install for specific <User> Account

2. yum -y install git

3. sudo yum -y install zlib-devel openssl-devel openssl openssl097a

4. add the following to /home/<user>/.bashrc  or .bash_profile

unset RUBYLIB
export PATH=”$HOME/.rbenv/bin:$PATH”
eval “$(rbenv init -)”

5. install rbenv

git clone git://github.com/sstephenson/rbenv.git .rbenv

6. install ruby-build

git clone git://github.com/sstephenson/ruby-build.git

cd ruby-build;

vi install.sh | change the prefix to home directory(/home/<user>)
./install.sh

7. install ruby 1.8.7

rbenv-install 1.8.7-p358

8. set the version for your current directory or globally for that user

local –

rbenv local 1.8.7-p358

global

rbenv global 1.8.7-p358

Run Multiple Python Version on a Single system, without altering System Python


Run Multiple Python Version on a Single system, without altering System Python

  1. wget http://www.python.org/ftp/python/2.7/Python-2.7.tar.bz2
  2. tar -xvjf Python-2.7.tar.bz2
  3. cd Python-2.7

Dependency required :

  1. yum install readline-devel
  2. yum install gdbm-devel
  3. yum install sqlite-devel
  1. ./configure –prefix=/usr/local/python2.7
  2. make
  3. make install

This installs python on a separate folder under /usr/local/python2.7

Now Once Python is installed, we can configure particular users to use the latest version of python :

$ vim ~/.bashrc

  1. User specific aliases and functions
    alias python=’/usr/local/python27/bin/python’

$ python
Python 2.7 (r27:82500, Mar 22 2011, 13:20:42)