Friday, June 24, 2011

Setup a Subversion Server step by step

check if subversion is installed or not

command #rpm -qa | grep subverion

if not then install by yum command

command  #yum install subversion

after installation create an directory where you want to configure projects reposatories

 

 1. Create a Repository

svnadmin create /svnrepos

2. Create a SVN User

vi /svnrepos/conf/svnserve.conf
In that file add these three lines:
anon-access = none
auth-access = write
password-db = passwd
Create a password file:
vi /svnrepos/conf/passwd
In that file add a line for your user:
# add users in the format : user = password
tony = mypassword

3. Import Your Project

(assuming you’ve put your project files in /projects/myrailsproject)
svn import /projects/myrailsproject file:///svnrepos/myrailsproject

4. Start the SVN Server as Daemon

svnserve -d
Done! You should now have a svn server running with one project named myrailsproject.
Try checking it out of the repository:
svn co svn://192.168.0.2/svnrepos/myyrailsproject
Since we set anon-access to none you should be prompted for username and password which you created in the file /svnrepos/conf/passwd.

Thursday, June 16, 2011

Linux Server Rebuild journal on a ext3 file system

You may encounter problems with journal in file system. It means that, your system will boot normally as it should. But after sometime, the partitions will be remounted as Read-Only file system since kernel is unable to read the blocks int the journal. In this situation, we used to try fixing with a manual file system check. But it solves the problems in a rare case. So, the only way to fix this issue by rebuilding the journal. This can be achieved using the following steps.
Note : Please make sure that you have booted  the machine with a Rescue CD or through Single User Mode.
Consider, the partition /dev/sda5 is having corrupted journals,
Un-mount the partition
umount /dev/sda5
Perform a FSCK
fsck -y /dev/sda5
Remove the journal support
tune2fs -O ^has_journal /dev/sda5
Perform fsck again
fsck -y /dev/sda5
Covert to ext3 (or) Enable journal
tune2fs -j /dev/sda5
After executing the above command, remount the partition (or) reboot the system/server. This will fix the problem.

Wednesday, June 15, 2011

Installing Linux Kernal-Based Virtual Machine (KVM) on CentOS 5.4 Server step by step

Step 1. Set SELINUX to “disabled”
# vim /etc/selinux/config
SELINUX=disabled
Step 2: Check that hardware support hardware virtualisation
# egrep '(vmx|svm)' --color=always /proc/cpuinfo
Your output should be something like this
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush
dts acpi mmx fxsr sse sse2 ss ht tm syscall nx pdpe1gb rdtscp lm constant_tsc nonstop_tsc pni monitor
ds_cpl vmx smx est tm2 cx16 xtpr popcnt lahf_lm
.......
If you do not get this output, then we can conclude that your hardware does not support virtualisation
Before you do a yum, make sure you  have EPEL Repository enabled. For more information see Red Hat Enterprise Linux / CentOS Linux Enable EPEL (Extra Packages for Enterprise Linux) Repository
Step 3: Install the KVM and virtinst (tools to create virtual machines)
yum install kvm kmod-kvm qemu libvirt python-virtinst
Reboot the System
# shutdown -r now
Step 4: Verify that the kernel has is loaded
# lsmod | grep kvm
the output should be something like
kvm_amd               50452  0
kvm 109264 1 kvm_intel
Check that the KVM is installed
# virsh -c qemu:///system list
Id Name                 State
----------------------------------
Step 5: Setting up of a Network Bridge so that the VM can be accessed from other hosts on the same network
a. Install the Bridge
# yum install bridge-utils
b. Configure the Bridge. Create the “bridge configuration file”. Ensure the BOOTPROTO, BROADCAST, IPADDR, NETMASK and NETWORK are the same as /etc/sysconfig/network-scripts
# vim /etc/sysconfig/network-scripts/ifcfg-br0
DEVICE=br0
TYPE=Bridge
BOOTPROTO=static
BROADCAST=192.168.50.255
IPADDR=192.168.50.100
NETMASK=255.255.255.0
NETWORK=192.168.50.0
ONBOOT=yes
c. Modify the /etc/sysconfig/network-scripts/ifcfg-eth0. Amend as follows
# Chelsio Communications Inc T310 10GbE Single Port Adapter
DEVICE=eth0
#BOOTPROTO=static
HWADDR=00:xx:00:xx:00:xx
ONBOOT=yes
BRIDGE=br0
#IPADDR=192.168.50.100
#NETWORK=192.168.50.0
#NETMASK=255.255.255.0
d. Disable NetworkManager
# chkconfig NetworkManager off
# service NetworkManager stop
# chkconfig network on
e. Restart the Network
# service network start
f. Verify that the Network Bridge is working
# ifconfig
br0       Link encap:Ethernet  HWaddr xx:xx:xx:xx:xx:xx
          inet addr:192.168.50.100  Bcast:192.168.50.255  Mask:255.255.255.0
          inet6 addr: fe80::210:a7ff:fe05:afeb/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:17 errors:0 dropped:0 overruns:0 frame:0
          TX packets:53 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1160 (1.1 KiB)  TX bytes:14875 (14.5 KiB)

eth0      Link encap:Ethernet  HWaddr yy:yy:yy:yy:yy:yy
          inet6 addr: fe80::210:a7ff:fe05:afeb/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:13662 errors:7 dropped:160 overruns:4 frame:0
          TX packets:11646 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:15144608 (14.4 MiB)  TX bytes:1379942 (1.3 MiB)
          Interrupt:74 Base address:0xcc00

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:38 errors:0 dropped:0 overruns:0 frame:0
          TX packets:38 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:4308 (4.2 KiB)  TX bytes:4308 (4.2 KiB)

virbr0    Link encap:Ethernet  HWaddr 00:00:00:00:00:00
          inet addr:192.168.122.1  Bcast:192.168.122.255  Mask:255.255.255.0
          inet6 addr: fe80::200:ff:fe00:0/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:35 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b)  TX bytes:9987 (9.7 KiB)
Step 6: Installing Virt-Manager on CentOS on a remote or local server
# yum install virt-manager
================================================================================
 Package           Arch     Version                             Repository
                                                                           Size
================================================================================
Installing:
 virt-manager      x86_64   0.6.1-12.el5                        base      1.5 M
Installing for dependencies:
 e4fsprogs-libs    x86_64   1.41.9-3.el5                        base      104 k
 gnome-python2-gnomekeyring
                   x86_64   2.16.0-3.el5                        base       17 k
 gtk-vnc           x86_64   0.3.8-3.el5                         base       81 k
 gtk-vnc-python    x86_64   0.3.8-3.el5                         base       12 k
 libvirt           x86_64   0.6.3-33.el5_5.3                    updates   2.0 M
 libvirt-python    x86_64   0.6.3-33.el5_5.3                    updates   137 k
 python-virtinst   noarch   0.400.3-9.el5_5.1                   updates   380 k
 xen-libs          x86_64   3.0.3-105.el5_5.5                   updates   156 k
 xz-libs           x86_64   4.999.9-0.3.beta.20091007git.el5    base       95 k

Transaction Summary
================================================================================
Install      10 Package(s)
Upgrade       0 Package(s)

Total download size: 4.5 M
Is this ok [y/N]:
Step 7: Install Virtual Machines using virt-install
a. Do put an ISO of the Operating System into Server so that you can build the Virtual Machine From. If you only have the disk but not the ISO, you may want to look at “Making Disc Images using mkisofs” from Linux Toolkit
b. Do also take a look at the Guest Support Status from KVM to know what is supported for the version of KVM.
Step 8: Prepare the Virtual Machine
 Prepare a Installation Script for easier management.
a. For CentOS Virtual Machine
# vim kvm_centos5.4.sh
virt-install \
--connect qemu:///system \
--name centos5.4_n01 \
--vcpus=2 \
--ram 1024 \
--disk path=/nfs_shared/vms/centos5.4_n01.img,size=40, \
--cdrom=/nfs_shared/ISO/CentOS-5.4-x86_64-bin-DVD.iso \
--network=bridge:br0 \
--accelerate \
--vnc \
--noautoconsole \
--os-type=linux \
--os-variant=rhel5.4 \
--hvm
b. For Windows XP Machine
# vim kvm_winXp.sh
virt-install \
--connect qemu:///system \
--name winxp_n01 \
--vcpus=1 \
--ram 1024 \
--disk path=/nfs_shared/vms/winxp_n01.img,size=25, \
--cdrom=/nfs_shared/ISO/Windows_XP2.iso \
--network=bridge:br0 \
--accelerate \
--vnc \
--noautoconsole \
--os-type=windows \
--os-variant=winxp \
--hvm
Some notes:
  • Do note that the disk path should be on a shared drive if you are planning to use “migration” from physical nodes to another physical node.
  • noautoconsole -> No connection to it is started by default although you can make a connection to it via virt-manager.
  • accelerate -> The VM will runin using kernel acceleration if available.
  • os-type and os-variant -> Please check the man virt-install for more information on the exact paramters.
Step 9: Run the script
You should see something like this
Starting install...
Creating storage file...                                 |  40 GB     00:00
Creating domain...                                       |    0 B     00:01
Domain installation still in progress. You can reconnect to
the console to complete the installation process.
Step 10: Continue the installation through Virt-Manager Console.
If you are on the graphical console, just type
# virt-manager
you should be able to see the node name. double-clicked the node icon, you should be able to continue the rest of the installation

Kernel Based Virtual Machine

Linux Kernel-Based Virtual Machine (KVM) is a full virtualisation solution for Linux on x86 hardware containing virtualization extension (Intel VT or AMD-V). It consists of a loadable kernel module, kvm.ko, that provides the core virtualization infrastructure and a processor specific module, kvm-intel.ko or kvm-amd.ko. KVM also requires a modified QEMU although work is underway to get the required changes upstream.

/usr/bin/ld cannot find -lf2c for CentOS 5

If you encounter this error "/usr/bin/ld: cannot find -lf2c", you are obviously missing f2c package. Do download the f2c-20031026-3.0.1.el5.x86_64.rpm package found at  f2c-20031026-3.0.1.el5.x86_64.rpm - CentOS 5 (RHEL 5) - ATrpms


# wget http://dl.atrpms.net/el5-x86_64/atrpms/stable/f2c-20031026-3.0.1.el5.x86_64.rpm
# rpm -Uvh f2c-20031026-3.0.1.el5.x86_64.rpm
# ldconfig

Understanding how a linux command work internally on server

You can use strace command to understanding how a linux command work internally. For example, to check on the date command


# strace -c /bin/date

strace is a system call monitor command and provides information about system calls made by an application, including the call arguments and return value.

% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
   nan    0.000000           0         5           read
   nan    0.000000           0         1           write
   nan    0.000000           0        36        30 open
   nan    0.000000           0         7           close
   nan    0.000000           0        14         9 stat
   nan    0.000000           0         8           fstat
   nan    0.000000           0         1           lseek
   nan    0.000000           0        16           mmap
   nan    0.000000           0         7           mprotect
   nan    0.000000           0         3           munmap
   nan    0.000000           0         3           brk
   nan    0.000000           0         2           rt_sigaction
   nan    0.000000           0         1           rt_sigprocmask
   nan    0.000000           0         1         1 access
   nan    0.000000           0         1           execve
   nan    0.000000           0         1           uname
   nan    0.000000           0         1           getrlimit
   nan    0.000000           0         1           arch_prctl
   nan    0.000000           0         1           futex
   nan    0.000000           0         1           set_tid_address
   nan    0.000000           0         1           clock_gettime
   nan    0.000000           0         1           set_robust_list
------ ----------- ----------- --------- --------- ----------------
100.00    0.000000                   113        40 total

Disabling USB port on linux server

To disable USB port on the machine, you can edit the grub.conf

# vim /boot/grub/grub.conf

Add the kernel parameter
kernel /vlinuz ..... rhgb quiet nousb

Reboot your system and you will notice all your usb ports disabled

Tuesday, June 14, 2011

How do I mount a NFS share with NFS version 4 (nfs4) through an encrypted SSH tunnel ?

Resolution:
The basic setup is similar to a normal mount process with nfs shares, except some config changes and that the IP addresses are changed to 127.0.0.1 (the loopback address). Here is the configuration on the server as well as the client:

Server Configuration:

  1. In the /etc/exports file, the share is exported by inserting the following line: 

    /myshare      127.0.0.1(rw,fsid=0,insecure,no_subtree_check,sync)

  2. Re-export the share or restart the nfs service: 

    # exportfs -rv
    exporting localhost.localdomain:/myshare
    or 

    # exportfs -v
    /myshare        localhost.localdomain(rw,wdelay,insecure,root_squash,no_subtree_check,fsid=0)


The server configuration is done.

Client Configuration:

  1. In the /etc/fstab file, give the mount parameters as follows: 

    127.0.0.1:/     /mnt/nfs4       nfs4    rw,hard,intr,proto=tcp,port=3333,noauto  0 0

  2. Now setup an SSH tunnel with port forwarding. Any encryption can be used, for example the blowfish encryption is used here. The standard port for nfs mount is 2049, but for the local port, it is not compulsory to use this port. Any random port can be used and the NFSv4 clients and SSH tunnels do not care which ports they use. Open up an SSH session from the NFS client to the NFS server: 

    # ssh -c blowfish -L 3333:127.0.0.1:2049 <server-address>
    root@server's password:

  3. Back on the NFS client host (client), open another terminal session as "root" and then mount the filesystem: 

    # mount -v /mnt/nfs4
    127.0.0.1:/ on /mnt/nfs4 type nfs4 (rw,hard,intr,proto=tcp,port=3333,addr=127.0.0.1)
    The NFSv4 share will be mounted as if it were local, but actually it is an encrypted remote filesystem.
  4. In order to unmount it, first use the command: 

    # umount -v /mnt/nfs4

  5. Exit the SSH session.

Integrating NIS + KERBEROS + NFS4

share "/test" on stationX.example.com to  allowed thru NFSV4 using "Kerberos" security method with example TESTSERVER1.EXAMPLE.COM  and IP 192.168.30.119
Integrating NIS + KERBEROS + NFS4

Configuring NIS
/etc/sysconfig/network
NISDOMAIN=testserver1
YPSERV_ARGS='-p 808'
Save and exit
nisdomainname testserver1
service network restart
chkconfig network on
yum -y install ypserv*
service ypserv restart
chkconfig ypserv on
service portmap restart
chkconfig portmap on
NOTE: NTP time should same on both machines else there might be an issue with the Kerberos
Useradd user1 < Donot provide password>
/usr/lib/ypinit –m            or make –C /var/yp
On stationY.example.com
System->Administration->Authentication->Enable NIS Support
NIS Domain -> testserv1
NIS Server -> stationx.example.com
ypcat passwd  “this must show user by anme user1 and after adding every user you must type
“make –C /var/yp” then only user will be added to NFS database

Configuring Kerberos
yum -y install krb5*
chkconfig kadmin on
chkconfig krb5kdc on
Note : Before configuration take the backups of the original files

Help :
kadmin.local:  ?
Available kadmin.local requests:
add_principal, addprinc, ank         Add principal
delete_principal, delprinc              Delete principal
modify_principal, modprinc          Modify principal
change_password, cpw                                 Change password
get_principal, getprinc                    Get principal
list_principals,                                    listprincs,
get_principals,                                  getprincs
add_policy, addpol                          Add policy
modify_policy, modpol                 Modify policy
delete_policy, delpol                     Delete policy
get_policy, getpol                            Get policy
list_policies,                                       listpols,
get_policies,                                      getpols
get_privs, getprivs                          Get privileges
ktadd, xst                                            Add entry(s) to a keytab
ktremove, ktrem                             Remove entry(s) from a keytab
lock                                                        Lock database exclusively (use with extreme caution!)
unlock                                                   Release exclusive database lock
list_requests, lr, ?                            List available requests.
quit, exit, q                                         Exit program.
vi /etc/krb5.conf
[libdefaults]
default_realm = TESTSERVER1.EXAMPLE.COM
[realm]
TESTSERVER1.EXAMPLE.COM = {
  kdc = 192.168.30.119:88
  admin_server = 192.168.30.119:749
remove default_domain
[domain_realm] CAREFUL DO NOT BE IN HURRY HERE
[domain_realm]
 testserver1.example.com = TESTSERVER1.EXAMPLE.COM
 stationy.example.com = TESTSERVER1.EXAMPLE.COM
[adddefaults]
  validate = true
save and exit

vim /var/kerberos/krb5kdc/kadm5.acl
*/admin@TESTSERVER1.EXAMPLE.COM *
vim /var/kerberos/krb5kdc/kdc.conf
[kdcdefaults]
 v4_mode = nopreauth
 kdc_tcp_ports = 88

[realms]
 TESTSERVER1.EXAMPLE.COM = {
 master_key_type = des3-hmac-sha1    (Uncomment)
 default_principal_flags=+preauth (need to be added)
  acl_file = /var/kerberos/krb5kdc/kadm5.acl
  dict_file = /usr/share/dict/words
  admin_keytab = /var/kerberos/krb5kdc/kadm5.keytab
  supported_enctypes = des3-hmac-sha1:normal arcfour-hmac:normal des-hmac-sha1:normal des-cbc-md5:normal des-cbc-crc:normal des-cbc-crc:v4 des-cbc-crc:afs3
 }

krb5_util create -r STATIONX.EXAMPLE.COM -s
any password this is very import to remember and secure it
kadmin.local
addprinc user1 {password say abc123}
addprinc root/admin
ktadd -k /var/kerberos/krb5kdc/kadm5.keytab kadmin/admin { to check kadmin5.acl }
ktadd -k /var/kerberos/krb5kdc/kadm5.keytab kadmin/changepw
addprinc -randkey host/testserver1.example.com
ktadd -k /etc/krb5.keytab host/testserver1.example.com
quit
restorecon -R -v /var/kerberos/krb5kdc
restorecon -R -v /var/log
service kadmin restart
service krb5kdc restart
scp /etc/krb5.conf stationY.example.com:/etc  { where you needed to add the host to the Kerberos}
On stationY.example.com



System  -> Administration -> Authentication -> Enable kerberos Support

chcon -t krb5_conf_t /etc/krb5.conf
kadmin -p root/acdmin
addprinc -randkey host/stationY.example.com
ktadd -k /etc/krb5.keytab host/stationY.example.com
restorecon /etc/krb5.keytab
Note : login on tty1 as user1 and password abc123
type klist you must see an ticket form Kerberos server
Configuring NFS On testserver1.example.com
useradd nfsuser
vim /etc/sysconfig/nfs
LOCKD_TCPPORT=1200
LOCKD_UDPPORT=1200
MOUNTD_PORT=1201
STATD_PORT=1202
SECURE_NFS="yes"
Mkdir /test
Chmod 775 /test
Chown nfsuser.nfsuser /test
vim /etc/exports  ( man export)
Options : gss/krb5  (authentication only)
  gss/ krb5i (integrity protection) 
 gss/krb5p (privacy protection)
      /nfsv4share gss/krb5i(rw,sync,fsid=0,no_subtree_check)
Save and exit
vim /etc/exports    /exports  gss/krb5i(rw,sync,fsid=0,crossmnt)
   /exports/home/nfs     gss/krb5i(rw,sync)
Same and exit
exportfs –r
kadmin.local
addprinc  -randkey nfs/testserver1.example.com
ktadd  nfs/testserver1.example.com
ktadd -e des-cbc-md5:normal -k /etc/krb5.keytab nfs/testserver1.example.com
quit
Note : des-cbc-md5:normal from cat /var/kerberos/krb5kdc/kdc.conf
/etc/init.d/rpcidmapd restart
Chkconfig rpcidmapd  on
/etc/init.d/rpcsvcgssd restart
Chkconfig rpcsvcgssd  on
/etc/init.d/rpcgssd restart
Chkconfig rpcgssd  on
/etc/init.d/kadmin restart
Chkconfig kadmin  on
/etc/init.d/krb5kdc restart
Chkconfig krb5kdc  on
/etc/init.d/nfs restart
Chkconfig nfs on
/etc/init.d/portmap restart
Chkconfig portmap on
/etc/init.d/ypserv restart
Chkconfig ypserv on
make -C /var/yp ( this command will be used when every new user has been added into the NIS server to update username in NIS database

On Client Server
 kadmin -p root/admin
addprinc  -randkey nfs/stationY.example.com
ktadd  nfs/stationY.example.com                            
ktadd -e des-cbc-md5:normal -k /etc/krb5.keytab nfs/stationY.example.com
quit
vim /etc/sysconfig/nfs
SECURE_NFS="yes"
Save and exit
/etc/init.d/rpcidmapd restart
Chkconfig rpcidmapd on
/etc/init.d/rpcsvcgssd restart
Chkconfig rpcsvcgssd on
/etc/init.d/rpcgssd restart
Chkconfig rpcgssd on
/etc/init.d/nfs restart
Chkconfig nfs on
mkdir –p /mnt/test
Vim /etc/fstab
testserver1 .example.com:/ /mnt/nfsv4share nfs4  default,sec=krb5i 0 0
mount –a   à give some error
1)      Check for iptables
2)      Check for selinux
3)      Check for configeations
4)      And restart all the services
TEST
login in tty1 as nfsuser;
cd /mnt/test;
 touch a b

Monday, June 13, 2011

Daily command in linux server

Enable auto run on service guard package

    cmmodepkg -v -e packagename
   
New user creation file with password "Colt1234"defaulty

    useradd -p PHVI86MeOtRlg

userdbget/userdbset in Cluster Servers for failure logins

    userdbget -i -u <username>
    userdbset -d -u <username> AUTH_MAXTRIES

How to check big files under any filesystem

    find . -xdev -size +10000000c -exec ls -lrt {} \;

How to compress files in larger size

while :;do read L;T=/tmp/p1;gzip -9 <$L >$T && tail -1000 $L >$T-2 && cat $T-2 >$L && mv $T $L.`date +"%d%m%Y"`.gz;rm -f $T-2; echo ok;done
du - sk * | sort -n

nfs options that we user by default

cd /stage <on the required server>

# showmount -e <server name>
# mount -o soft,intr,rsize=32768,wsize=32768,timeo=30,retrans=999,retry=999 lonunx01:/dbarecovery /stage


To find a word / string value in a file /dir in Linux / HP-UX

# grep <word/string value> *

To Enable Packages on Cluster Server in HP-UX

Login with root : su –
Password: xxxxxxxxx
<root># cmviewcl
# cmmodpkg –v –e <package name>


To find utilization of folder size in file system
# du -sk * | sort -n

To search whether the pacakage is installed / not in HP-UX
# swlist -l product | gerp -i <package name>

To search a file in a complete filesystem in HP-UX
# find / |grep <filename>

To search a file # whereis <filename>

To copy a file/dir from one server to another in both unix
# scp <file/dir> <username>@remotehost:<destination path>

To change ownership of a file/dir in Both Unix
# chown <ownername>:<groupname> <filename>
# chown -R <ownername>:<groupname> <dir name>



portnumbers in servers

port number                application
21                         ftp
22                         ssh
23                         telnet
25                          smtp mail port
53                         dns port
67                         dhcp server
79                         finger command for smtp mail server ETRN finger port
80                         http port
110                        pop3 port
115                       sftp port
123                       network time protocal port
143                       imap4 port
177                       xmanager port tcp
389                       ldap port
443                       hhtp port (ssl)
445                       microsoft active directory and smb protocal port
465                       google mail outgoing mail server
636                       ldap(ssl)
993                       secure internet message access protocalport
1433                      sql server port
1434                      sql  server monitoring port
1521                      oracle port
2000                      cisco ip phone port
3306                      default mysql port
3389                      remote desktop port and terminal server port
5900                      real vnc default remote control port
6000                     tcp port for xmanager port
8080                     http internet traffic port

Sunday, June 12, 2011

NFSv4 New Features

File system name space
NFSv4 provides a different model file system name-space model than did previous versions. Servers, rather than exporting multiple file systems, export a single "pseudo file system," formed from multiple actual file systems, and potentially customized for each client.

NFSv4 as a stateful protocol
Previous NFS protocols were stateless in the sense that the NFS server maintained no information or state about its clients.NFSv4, however, is stateful; the NFSv4 server maintains information about its clients, the files they hold open, and locks.Using stateful design enhance performance and scalability.

Delegation
Clients may perform operations on files with minimal interaction with the server. NFSv4 introduces file delegation. An NFSv4 server can allow an NFSv4 client to access and modify a file in it's own cache without sending any network requests to the server, until the server indicates via a callback that another client wishes to access a file. This reduces the amount of traffic between NFSv4 client and server considerably in cases where no other clients wish to access a set of files concurrently.

Security
A strong security model is mandated, where client/server interactions are done using the GSS-API framework. Three security mechanisms are needed: Kerberos, LIPKEY, and SPKM-3. Which one is actually used is negotiated between client and server. Security principals are now given as strings (e.g., user@domain) rather than as user IDs as was done in the earlier versions. Authorization uses both standard UNIX-like permissions as well as Windows ACLs.

How to Recover from Corrupted RPM Database

When installing rpm packages or using up2date to update packages  on Oracle / RedHat Enterprise Linux, you may get the following error,

$ sudo up2date --nox --register
rpmdb: PANIC: fatal region error detected; run recovery
error: db4 error(-30978) from dbenv->open: DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db3 -  (-30978)
error: cannot open Packages database in /var/lib/rpm
An error has occurred:
exceptions.TypeError
See /var/log/up2date for more information

This error is caused by a corrupted RPM database, run the following commands to recover the database.
# cd /var/lib/rpm
# rm -f __db.*
# rpm --rebuilddb

The "--rebuilddb" rebuilds the database indices from the installed RPM package headers.

Saturday, June 11, 2011

Gnome Network Manager VPN Tab Disabled on linux

I've the NetworkManager service is installed and started under Linux desktop. The applet is running. The NetworkManager can display available network hardware and wireless networks. But, I'm unable to add VPN support as the Add tab is greyed out. I need to use both PPTP and Cisco vpn clients. How do I fix this problem under Debian or Ubuntu Linux?

The Gnome NetworkManager has pluggable support for VPN software, including Cisco compatible VPNs (using vpnc), openvpn, and Point-to-Point Tunneling Protocol (PPTP). You need to simply install the NetworkManager VPN plugin and configure the user's machines with the VPN's settings. The first time they connect, the user will be asked for their passwords.
Gnome Network Manager Cisco PPTP VPN Connections
Fig.01: Gnome Network Manager Cisco PPTP VPN Connections
The Add tab is greyed out when required plugins are not installed for Gnome NetworkManager. The following plugins should be installed under Debian / Ubuntu Linux:

  1. network-manager-openvpn and network-manager-openvpn-gnome - network management framework OpenVPN plugin GNOME GUI
  2. network-manager-pptp and network-manager-pptp-gnome - network management framework PPTP plugin GNOME GUI
  3. network-manager-strongswan - network management framework strongSwan ipsec vpn plugin
  4. network-manager-vpnc and network-manager-vpnc-gnome - network management framework (VPNC plugin GNOME GUI)
To install all of the above plugins use the apt-get command as follows:
$ sudo apt-get install network-manager-openvpn network-manager-pptp network-manager-vpnc
The following plugins should be installed under RHEL / Fedora / CentOS / Scientific Linux / Red Hat Enterprise Linux desktop systems:
  1. NetworkManager-openvpn : NetworkManager VPN plugin for OpenVPN
  2. NetworkManager-pptp : NetworkManager VPN plugin for pptp
  3. NetworkManager-vpnc : NetworkManager VPN plugin for vpnc
To install all of the above plugins use the yum command as follows:
# yum install NetworkManager-vpnc NetworkManager-pptp NetworkManager-openvpn
Now, you can add vpn connection to your system using NetworkManager itself. You may need to restart the NetworkManager as follows:
# /etc/init.d/network-manager restart

Fig.02: Linux Gnome Desktop Cisco PPTP VPN Client Support Added

Sunday, June 5, 2011

kill all users session under Linux


You need to use the pkill command which will look up or signal processes based on name. It can send the specified signal to each process.
# pkill -9 -u username
In this example, list all process owned by a user called lighttpd, enter:

# ps -fp $(pgrep -d, -u lighttpd)
To kill all process owned by lighttpd user, enter:
# pkill -9 -u lighttpd

Find Out CPU Architecture Information on Linux


 You can use /proc/cpuinfo file or use the lscpu command to get info about CPU architecture.

$ less /proc/cpuinfo

Or

$ lscpu