Thursday, July 3, 2014

Install git on Red Hat Enterprise Linux Server release 5.4

Install git on Red Hat Enterprise Linux Server release 5.4

    rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm

    yum install git

Monday, May 12, 2014

svn merge trunk to branch command line


1. Find last revision merged from trunk to branch.

      svn log -v --stop-on-copy

2. Checkout the branch into a directory.

      mkdir branch_dir
      cd branch_dir
      svn co branch_url


3. Merge trunk into branch.


      svn merge -rBranchCreatedTrunk:HEAD trunk_url branch_dir
              BranchCreatedTrunk (from Step 1)

         Use appropriate merge options:-
        (e)  edit             - change merged file in an editor
        (df) diff-full        - show all changes made to merged file
        (r)  resolved         - accept merged version of file
        (dc) display-conflict - show all conflicts (ignoring merged version)
        (mc) mine-conflict    - accept my version for all conflicts (same)
        (tc) theirs-conflict  - accept their version for all conflicts (same)
        (mf) mine-full        - accept my version of entire file
        (tf) theirs-full      - accept their version of entire file (same)
        (p)  postpone         - mark the conflict to be resolved later
        (l)  launch           - launch external tool to resolve conflict
        (s)  show all         - show this list





Friday, May 2, 2014

Edit files in place using perl.

Edit files in place using perl.


perl -p -i -e 's/>10</>15</g' ca-service.xml gw-service.xml ga-service.xml

Wednesday, December 4, 2013

Remove package in Solaris.

Remove package in Solaris.

pkgrm ISONService

Will remove package named ISONService completely.

Add package in Solaris.

Add package in Solaris.

pkgadd –d . ISONService

Will add a package named ISONService. The pkgadd will search package in  current directory (.). 

Monday, July 29, 2013

Create SVN Branch

Create SVN Branch

Its always better to work on SVN branch rather than on main source trunk. This way you wont messup the original working version and still use repository for keeping track of your changes.
Creating an svn branch is very easy. In your shell or terminal client, type:
 
# svn copy https://machine.yourdomain.net:9443/svn/MainProjectName/Subproject/trunk https://machine.yourdomain.net:9443/svn/MainProjectName/Subproject/branches/ChangeTask103 --username yourusername -m "change task 103"

To get a "working copy" of the latest source files from branch, use svn checkout with branch URL.


#svn checkout https://machine.yourdomain.net:9443/svn/MainProjectName/Subproject/branches/ChangeTask103 --username yourusername

Command Line SVN Checkout

Command Line SVN Checkout 


To get a "working copy" of the latest source files, you must check out the source files. The checkout process copies the files onto your system from the repository.
In your shell or terminal client, type:


#svn --version
svn, version 1.6.11 (r934486)
   compiled Apr 11 2013, 17:28:04

Copyright (C) 2000-2009 CollabNet.
Subversion is open source software, see http://subversion.tigris.org/
This product includes software developed by CollabNet (http://www.Collab.Net/).

The following repository access (RA) modules are available:

* ra_neon : Module for accessing a repository via WebDAV protocol using Neon.
  - handles 'http' scheme
  - handles 'https' scheme
* ra_svn : Module for accessing a repository using the svn network protocol.
  - with Cyrus SASL authentication
  - handles 'svn' scheme
* ra_local : Module for accessing a repository on local disk.
  - handles 'file' scheme


# svn checkout https://machine.yourdomain.net:9443/svn/MainProjectName/Subproject/trunk --username yourusername
Error validating server certificate for 'machine.yourdomain.net:9443':
 - The certificate is not issued by a trusted authority. Use the
   fingerprint to validate the certificate manually!
 - The certificate hostname does not match.
Certificate information:
 - Hostname: machine.yourdomain.net
 - Valid: from Thu, 26 Oct 2006 14:46:48 GMT until Mon, 12 Jan 2015 14:46:48 GMT
 - Issuer: Your Team, Your Company & Company, Your Ville, Your State, US
 - Fingerprint: FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF
(R)eject, accept (t)emporarily or accept (p)ermanently? p
Authentication realm: <https://machine.yourdomain.net:9443> Your Team Repository
Password for 'yourusername':

-----------------------------------------------------------------------
ATTENTION!  Your password for authentication realm:

   <https://machine.yourdomain.net:9443>  Your Team Repository

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
'/home/yourusername/.subversion/servers'.
-----------------------------------------------------------------------
Store password unencrypted (yes/no)? yes
A    trunk/deployments
A    trunk/deployments/release
Checked out revision 5095.

#

Now do an ls command to see the checked out folder. 
Go into the checked folder and do 'svn info' command to verify the checkout.

# ls
trunk
# cd trunk/
# svn info
Path: .
URL: https://machine.yourdomain.net:9443/svn/MainProjectName/Subproject/trunk
Repository Root: https://machine.yourdomain.net:9443/svn/MainProjectName
Repository UUID: eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee
Revision: 5095
Node Kind: directory
Schedule: normal
Last Changed Author: yourusername
Last Changed Rev: 5093
Last Changed Date: 2013-07-24 16:35:04 -0400 (Wed, 24 Jul 2013)


Thursday, July 25, 2013

Add a new user in CentOS

Add a new user in CentOS

Login as root.
The useradd creates the new account (say myuser) and the /home/myuser home directory. The password for the user is set using passwd command.

# useradd --home /home/myuser myuser
# passwd myuser
Changing password for user myuser.
New password:
BAD PASSWORD: it is based on a dictionary word
Retype new password:
passwd: all authentication tokens updated successfully.
# su - myuser
# pwd
/home/myuser

Setup Network Card in CentOS Basic Server

Setup Network Card in CentOS Basic Server

Step 1. Login to the system as root.

Step 2. Setup a DHCP IP
The eth0 is the first network interface card in a server by default.
To enable for a DHCP IP modify the interface configuration file of eth0.
A sample interface configuration file is given below.
# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=00:24:81:16:28:A5
TYPE=Ethernet
UUID=80e845b8-bfc8-4ef5-b2af-800d2b8b5ee2
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=dhcp


Step 3. Setup DNS Server names.
The DNS server cnfiguration will help the server to resolve domain name request into IP.
A sample DNS configuration file is given below.
# cat /etc/resolv.conf
; generated by /sbin/dhclient-script
nameserver 172.52.52.199
nameserver 12.11.23.199
nameserver 152.54.48.199


Step 4. Restart network interface.
The restart of network service is required after editing above files.
# /etc/init.d/network restart

Use ifconfig command to check the network interface
# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:24:81:16:28:A5
          inet addr:XXX.XX.XX.XX Bcast:XXX.XX.XX.XX Mask:255.255.255.0
          inet6 addr: ffff::fff:ffff:ffff:ffff/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4865 errors:0 dropped:0 overruns:0 frame:0
          TX packets:594 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:951393 (929.0 KiB)  TX bytes:141212 (137.9 KiB)
          Interrupt:19 Memory:f0000000-f0020000

Wednesday, July 24, 2013

Change timezone in CentOS

Change timezone in CentOS

cp /usr/share/zoneinfo/EST5EDT /etc/localtime 

OR change ZONE in /etc/sysconfig/clock

eg:-
# cat /etc/sysconfig/clock
# The time zone of the system is defined by the contents of /etc/localtime.
# This file is only for evaluation by system-config-date, do not rely on its
# contents elsewhere.
ZONE="America/New York"

Tuesday, July 23, 2013

Build C++ module with Node.js v0.10.13

Build C++ module with Node.js v0.10.13

#wget http://nodejs.org/dist/v0.10.13/node-v0.10.13.tar.gz
#tar -zxvf /tmp/node-v0.10.13.tar.gz
#./configure --prefix=/opt/node-v0.10.13
#make
#sudo make install


The make install did not copy the header files in release folder(like node-0.8.18). So copy the files manually as below. 

#cd /opt/node-v0.10.13
#sudo mkdir include
#cd include
#sudo mkdir node
#cd node
#sudo cp -p /tmp/node-v0.10.13/src/node.h .
#sudo cp -p /tmp/node-v0.10.13/src/node_buffer.h .
#sudo cp -p /tmp/node-v0.10.13/src/node_object_wrap.h .
#sudo cp -p /tmp/node-v0.10.13/src/node_version.h .
#sudo cp -p /tmp/node-v0.10.13/deps/v8/include/v8-debug.h .
#sudo cp -p /tmp/node-v0.10.13/deps/v8/include/v8-preparser.h .
#sudo cp -p /tmp/node-v0.10.13/deps/v8/include/v8-profiler.h .
#sudo cp -p /tmp/node-v0.10.13/deps/v8/include/v8-testing.h .
#sudo cp -p /tmp/node-v0.10.13/deps/v8/include/v8.h .
#sudo cp -p /tmp/node-v0.10.13/deps/v8/include/v8stdint.h .
#sudo cp -p /tmp/node-v0.10.13/deps/uv/include/uv.h .
#sudo mkdir uv-private
#cd
uv-private
#sudo cp -p /tmp/node-v0.10.13/deps/uv/include/uv-private/uv-linux.h .
#sudo cp -p /tmp/node-v0.10.13/deps/uv/include/uv-private/ngx-queue.h .
#sudo cp -p /tmp/node-v0.10.13/deps/uv/include/uv-private/uv-unix.h .



Include following path in your makefile to compile against node-v0.10.13

 -I/opt/node-v0.10.13/include/node


You can also edit tools/install.py in node build folder and add above list of files for 'make install' to copy header files.

Work with a sample github project

Work with a sample github project

# git --version
git version 1.7.11.3        

# git config --global user.name myusername

# env GIT_SSL_NO_VERIFY=true git clone https://github.company.net/myusername/Hello-World.git
Cloning into 'Hello-World'...
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 3 (delta 0)
Unpacking objects: 100% (3/3), done.

# git remote -v
origin    https://github.company.net/myusername/Hello-World (fetch)
origin    https://github.company.net/myusername/Hello-World (push)
#touch readme.md
#touch package.json
#git add .
 
#git commit 

Install company security certificate is you have
# sudo git config --system http.sslcainfo ~centos/Downloads/decoded.crt


If you don't have company security certificate add env GIT_SSL_NO_VERIFY=true before git command

# git push -u origin master
Counting objects: 8, done.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 2.20 MiB | 625 KiB/s, done.
Total 5 (delta 2), reused 0 (delta 0)
To https://github.company.net/myusername/Hello-World
   1e019b3..42cbab1  master -> master
Branch master set up to track remote branch master from origin.


Enter username password to authenticate

Install new version of 'git' in CentOS 6.4

Install new version of 'git' in CentOS 6.4

# wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.i686.rpm
# rpm -K rpmforge-release-0.5.3-1.el6.rf.i686.rpm
rpmforge-release-0.5.3-1.el6.rf.i686.rpm: (sha1) dsa sha1 md5 gpg OK
# rpm -i rpmforge-release-0.5.3-1.el6.rf.i686.rpm
# yum clean all

# yum update
# git --version
git version 1.7.1


The new git version is 1.7.11.3. So remove old (1.7.1) and install new.
# yum remove git

Disable base repo
# cd /etc/yum.repos.d
# vi CentOS-Base.repo
and add line enable=0 to base group

Enable rpmforge-extras repo
# vi rpmforge.repo
and add line enable=1 to rpmforge-extras group

# yum provides git
to list all git versions available to install

# yum install git-1.7.11.3-1.el6.rfx.i686
# git --version
git version 1.7.11.3


Enable base repo and disable rpmforge-extras repo. 

Add sudo privilege on CentOs

Add sudo privilege on CentOs

login as root
# visudo
and add this line to the end of the file
username ALL=(ALL) ALL

Friday, July 19, 2013

Build an old version of gcc

Build an old version of gcc


# wget http://gcc.petsads.us/releases/gcc-3.4.6/gcc-3.4.6.tar.gz
# tar -zxvf  gcc-3.4.6.tar.gz
# mkdir gcc-3.4.6-build
# cd gcc-3.4.6-build/

# ../gcc-3.4.6/configure --prefix=/opt/gcc-3.4.6 --mandir=/opt/gcc-3.4.6/share/man --infodir=/opt/gcc-3.4.6/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-java-awt=gtk --host=i386-redhat-linux --disable-java-awt --without-x
# make
# make install
 


# /opt/gcc-3.4.6/bin/gcc -v
Reading specs from /opt/gcc-3.4.6/lib/gcc/i386-redhat-linux/3.4.6/specs
Configured with: ../gcc-3.4.6/configure --prefix=/opt/gcc-3.4.6 --mandir=/opt/gcc-3.4.6/share/man --infodir=/opt/gcc-3.4.6/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-java-awt=gtk --host=i386-redhat-linux --disable-java-awt --without-x
Thread model: posix
gcc version 3.4.6

Wednesday, July 17, 2013

Select default version of java

Select default version of java


# alternatives --config java

There are 3 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
   1           /usr/lib/jvm/jre-1.5.0-gcj/bin/java
   2           /usr/lib/jvm/jre-1.6.0-openjdk/bin/java
*+ 3           /usr/lib/jvm/jre-1.7.0-openjdk/bin/java

Enter to keep the current selection[+], or type selection number: 2


# java -version
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.11.90) (rhel-1.62.1.11.11.90.el6_4-i386)
OpenJDK Client VM (build 20.0-b12, mixed mode) 

Upgrade SVN to 1.8 on CentOS VM

Upgrade SVN to 1.8 on CentOS VM

# wget http://www.apache.org/dist/subversion/subversion-1.8.0.tar.gz
(or any latest available in 
http://www.apache.org/dist/subversion/)
 
# tar subversion-1.8.0.tar.gz  
# vcd subversion-1.8.0
# ./get-deps.sh
# ./configure
# make
# make check
# sudo make install

Virtualbox Guest Additions on a CentOS

Virtualbox Guest Additions on a CentOS

Start CentOS VM image.
Do Alt+F2 and login as 'root'

then do... 

# yum update 
# yum install gcc 
# yum install kernel-devel 
# mount /dev/scd0 /media/VBOXADDITIONS_4.2.16_86992/
# sh /media/VBOXADDITIONS_4.2.16_86992/VBoxLinuxAdditions.run

When the process is complete, reboot the system