Installing Xen Server Tools on Scientific Linux

Scientific Linux is clone of CentOS but Xen fails to recognise it. 

First Step is to mount the Cdrom

mount -t iso9660 /dev/cdrom /mnt

Then change to directory

cd /mnt/Linux

Then fire the command by giving distro name and manjor vesion in command line

./install.sh -d centos -m 6

Select y and reboot.

You are done

Advertisements

Regex to Detect Credit Card Data

Credit Card data is normally masked with *. But the problem is how to detect in side a block of text. If you are using PHP then you can use this Regex

/(?:\d[ -]*?){13,16}/

to detect any of the credit card format

16 digit:

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

####-####-####-####

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

15 digit:

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

####-####-####-###

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

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

####-######-#####

In case of JS the same work just remove the forward slashes.

Install Ruby 1.9.3 ( or multiple ruby verson ) on CentOS 6.3 using RVM

RVM provides easy set of commands to install single or multiple versions of Ruby on single server.

Step 1: Upgrade your system with latest packages. Make sure that update will not affect to your running apps ( if any )on server.

# yum update

Step 2: Install some recommended rpms on your server using yum.

yum install gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison iconv-devel

Step 3: Install RVM on your system using below command.

# curl -L get.rvm.io | bash -s stable

Output:

% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 13466  100 13466    0     0  17289      0 --:--:-- --:--:-- --:--:-- 17289
Downloading RVM from wayneeseguin branch stable
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1067k  100 1067k    0     0   517k      0  0:00:02  0:00:02 --:--:-- 1015k

Installing RVM to /usr/local/rvm/
    Creating group 'rvm'
    Adding rvm PATH line to /root/.bashrc /root/.zshrc.
    Adding rvm loading line to /root/.bash_profile /root/.zprofile.

# RVM:  Shell scripts enabling management of multiple ruby environments.
# RTFM: https://rvm.io/
# HELP: http://webchat.freenode.net/?channels=rvm (#rvm on irc.freenode.net)
# Cheatsheet: http://cheat.errtheblog.com/s/rvm
# Screencast: http://screencasts.org/episodes/how-to-use-rvm

# In case of any issues run 'rvm requirements' or read 'rvm notes'

Installation of RVM in /usr/local/rvm/ is almost complete:

  * First you need to add all users that will be using rvm to 'rvm' group,
    and logout - login again, anyone using rvm will be operating with `umask u=rwx,g=rwx,o=rx`.

  * To start using RVM you need to run `source /etc/profile.d/rvm.sh`
    in all your open shell windows, in rare cases you need to reopen all shell windows.

# Maanas Royy,
#
#   Thank you for using RVM!
#   I sincerely hope that RVM helps to make your life easier and
#   more enjoyable!!!
#
# ~Wayne

Step 4: Setup RVM environment.

# source /etc/profile.d/rvm.sh

Step 5: Install required Ruby version.

# rvm install 1.9.3

Output:

Searching for binary rubies, this might take some time.
No binary rubies available for: redhat/6.3/x86_64/ruby-1.9.3-p429.
Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies.
Installing requirements for redhat, might require sudo password.
Installing required packages: libxml2-devel, libxslt-devel..................................................................
Installing Ruby from source to: /usr/local/rvm/rubies/ruby-1.9.3-p429, this may take a while depending on your cpu(s)...
ruby-1.9.3-p429 - #downloading ruby-1.9.3-p429, this may take a while depending on your connection...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 9806k  100 9806k    0     0   336k      0  0:00:29  0:00:29 --:--:--  476k
ruby-1.9.3-p429 - #extracting ruby-1.9.3-p429 to /usr/local/rvm/src/ruby-1.9.3-p429
ruby-1.9.3-p429 - #extracted to /usr/local/rvm/src/ruby-1.9.3-p429
ruby-1.9.3-p429 - #configuring.............................................................................................................................................................................................................................................................................................................................................................................................................................................................
ruby-1.9.3-p429 - #compiling.............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
ruby-1.9.3-p429 - #installing ............................................................................................................................................................................................................................................
Retrieving rubygems-1.8.25
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  371k  100  371k    0     0   629k      0 --:--:-- --:--:-- --:--:--  655k
Extracting rubygems-1.8.25 ...
Removing old Rubygems files...
Installing rubygems-1.8.25 for ruby-1.9.3-p429.....................
Installation of rubygems completed successfully.
Saving wrappers to '/usr/local/rvm/wrappers/ruby-1.9.3-p429'........

ruby-1.9.3-p429 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
ruby-1.9.3-p429 - #importing default gemsets, this may take time.......................
Install of ruby-1.9.3-p429 - #complete

Step 6: If you want using multiple versions of ruby, you can install it also using rvm else skip this step

# rvm install 1.8.6

Step 7: Setup default ruby version to be used by applications.

# rvm use 1.9.3 --default

Output:

Using /usr/local/rvm/gems/ruby-1.9.3-p392

Step 8: Check your current ruby version.

# ruby --version

Output:

ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-linux]

I hope above steps will help you, Thanks.