Tuesday, September 24, 2013

Install and configure VNC server on Redhat/CEntOS 6.x

Install and configure VNC server on Redhat/CEntOS 6.x

1. Install VNC server (Make sure your yum repo is set up).
# yum groupinstall Desktop
# yum install tigervnc-server
# yum install xorg-x11-fonts-Type1
# chkconfig vncserver on

2. Configure VNC access for each user.
# vi /etc/sysconfig/vncservers

VNCSERVERS="2:jay 3:dev 4:sam"
VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -localhost"

VNCSERVERARGS[3]="-geometry 800x600 -nolisten tcp -localhost"

VNCSERVERARGS[4]="-geometry 1024x600"

........ so on...

or

VNCSERVERS="2:jay"
VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -localhost"
VNCSERVERS="3:dev"
VNCSERVERARGS[3]="-geometry 800x600 -nolisten tcp -localhost"
VNCSERVERS="4:sam"
VNCSERVERARGS[4]="-geometry 1024x600"



Note:
- session 2 for Jay and session 3 for dev user is configured with screen size 800x600.
- If you don't specify nolisten and localhost option, you have to open a VNC port on firewall.
- With the use of these options, you will be using secure ssh port 22 with ssh tunel.

3. Create VNC password for users who want to access VNC server.
# su - jay
$ vncpasswd
Password:
Verify:
$
Now, set up vncpassword for rest of the users.

4. Restart VNC server.
# service vncserver status/start/restart

5. Connect to the VNC server.

$ vncviewer sama:2  (sama is a server name; hostname)

Enter your pw, and you should be able to login and session should start.

5.a. Enable firewall

# iptables -I INPUT 5 -m state --state NEW -m tcp -p tcp -m multiport --dports 5901:5903,6001:6003 -j ACCEPT
# service iptables save
# service iptables restart
# service vncserver restart

if fails,
kill the vnc server
$ vncserver -kill :2

$ vi .vnc/xstartup

Commentout the entry
#twn &
exec gnome-session &

Restart the VNC server
# service vncserver restart


Note: If the connection to the VNC server is without secure ssh tunnel, you have to configure your firewall to allow this vnc client connection.

If you are connecting VNC server through ssh tunnel

$ vncviewer -via jay@sama localhost:2

Enter your pw, your vnc session will start.

Connecting through your desktop

1. Download and install VNCViewer

http://www.realvnc.com/download/viewer/
http://sourceforge.net/projects/tigervnc/

2. Open the viewer and enter the server name: sama:4
Encription: Prefer off

and connect, it will prompt you for pw, enter your user name and the pw that you created using vncpasswd

3. To kill the VNCServer session,
$ vncserver -kill :4  (kill the session with whatever session that theuser belongs to )

Tuesday, September 3, 2013

Removing LVM disk


How to remove physical disk from the system and add new LUN
1. List Volume group
# vgs; pvs
2. Remove the device
# vgreduce dbdatavg DB004p1
3. Remove physical device
# pvremove DB004p1
4.



[root@mylnx200 mapper]# vgs
  VG       #PV #LV #SN Attr   VSize   VFree
  dbdatavg   5   2   0 wz--n- 809.17G 304.17G
  dblogvg    5   4   0 wz--n- 505.72G  65.72G
  system     1   3   0 wz--n-  84.44G  52.44G
[root@mylnx200 mapper]# pvs
  PV                 VG       Fmt  Attr PSize   PFree
  /dev/cciss/c0d0p5  system   lvm2 a--   84.44G  52.44G
  /dev/mpath/DB001p1 dbdatavg lvm2 a--  202.29G      0
  /dev/mpath/DB002p1 dbdatavg lvm2 a--  202.29G      0
  /dev/mpath/DB003p1 dbdatavg lvm2 a--  202.29G 101.88G
  /dev/mpath/LOG01p1 dblogvg  lvm2 a--  101.14G   1.14G
  /dev/mpath/LOG02p1 dblogvg  lvm2 a--  101.14G   1.14G
  /dev/mpath/LOG03p1 dblogvg  lvm2 a--  101.14G      0
  /dev/mpath/LOG04p1 dblogvg  lvm2 a--  101.14G  63.43G
  /dev/mpath/LOG05p1 dblogvg  lvm2 a--  101.14G      0
  DB004p1            dbdatavg lvm2 a--  101.14G 101.14G
  DB005p1            dbdatavg lvm2 a--  101.14G 101.14G
  DB006p1                     lvm2 a--  101.15G 101.15G
  DB007p1                     lvm2 a--  101.15G 101.15G
  DB008p1                     lvm2 a--  101.15G 101.15G

[root@mylnx200 mapper]# vgreduce  dbdatavg DB004p1
  Removed "DB004p1" from volume group "dbdatavg"
[root@mylnx200 mapper]# vgreduce dbdatavg DB005p1
  Removed "DB005p1" from volume group "dbdatavg"
[root@mylnx200 mapper]# pvremove DB004p1
  Labels on physical volume "DB004p1" successfully wiped
[root@mylnx200 mapper]# pvremove DB005p1
  Labels on physical volume "DB005p1" successfully wiped
[root@mylnx200 mapper]# pvremove DB006p1
  Labels on physical volume "DB006p1" successfully wiped
[root@mylnx200 mapper]# pvremove DB007p1
  Labels on physical volume "DB007p1" successfully wiped
[root@mylnx200 mapper]# pvremove DB008p1
  Labels on physical volume "DB008p1" successfully wiped
[root@mylnx200 mapper]# pvs
  PV                 VG       Fmt  Attr PSize   PFree
  /dev/cciss/c0d0p5  system   lvm2 a--   84.44G  52.44G
  /dev/mpath/DB001p1 dbdatavg lvm2 a--  202.29G      0
  /dev/mpath/DB002p1 dbdatavg lvm2 a--  202.29G      0
  /dev/mpath/DB003p1 dbdatavg lvm2 a--  202.29G 101.88G
  /dev/mpath/LOG01p1 dblogvg  lvm2 a--  101.14G   1.14G
  /dev/mpath/LOG02p1 dblogvg  lvm2 a--  101.14G   1.14G
  /dev/mpath/LOG03p1 dblogvg  lvm2 a--  101.14G      0
  /dev/mpath/LOG04p1 dblogvg  lvm2 a--  101.14G  63.43G
  /dev/mpath/LOG05p1 dblogvg  lvm2 a--  101.14G      0

[root@mylnx200 mapper]# pvcreate /dev/mapper/DB004p1
  Writing physical volume data to disk "DB004p1"
  Physical volume "DB004p1" successfully created
[root@mylnx200 mapper]# pvcreate /dev/mapper/DB005p1
  Writing physical volume data to disk "DB005p1"
  Physical volume "DB005p1" successfully created
[root@mylnx200 mapper]# pvcreate /dev/mapper/DB006p1
  Writing physical volume data to disk "DB006p1"
  Physical volume "DB006p1" successfully created
[root@mylnx200 mapper]# pvs
  PV                 VG       Fmt  Attr PSize   PFree
  /dev/cciss/c0d0p5  system   lvm2 a--   84.44G  52.44G
  /dev/mpath/DB001p1 dbdatavg lvm2 a--  202.29G      0
  /dev/mpath/DB002p1 dbdatavg lvm2 a--  202.29G      0
  /dev/mpath/DB003p1 dbdatavg lvm2 a--  202.29G 101.88G
  /dev/mpath/LOG01p1 dblogvg  lvm2 a--  101.14G   1.14G
  /dev/mpath/LOG02p1 dblogvg  lvm2 a--  101.14G   1.14G
  /dev/mpath/LOG03p1 dblogvg  lvm2 a--  101.14G      0
  /dev/mpath/LOG04p1 dblogvg  lvm2 a--  101.14G  63.43G
  /dev/mpath/LOG05p1 dblogvg  lvm2 a--  101.14G      0
  DB004p1                     lvm2 a--  101.15G 101.15G
  DB005p1                     lvm2 a--  101.15G 101.15G
  DB006p1                     lvm2 a--  101.15G 101.15G
[root@mylnx200 mapper]# pvcreate /dev/mapper/DB007p1
  Writing physical volume data to disk "DB007p1"
  Physical volume "DB007p1" successfully created
[root@mylnx200 mapper]# pvcreate /dev/mapper/DB008p1
  Writing physical volume data to disk "DB008p1"
  Physical volume "DB008p1" successfully created
[root@mylnx200 mapper]# pvs
  PV                 VG       Fmt  Attr PSize   PFree
  /dev/cciss/c0d0p5  system   lvm2 a--   84.44G  52.44G
  /dev/mpath/DB001p1 dbdatavg lvm2 a--  202.29G      0
  /dev/mpath/DB002p1 dbdatavg lvm2 a--  202.29G      0
  /dev/mpath/DB003p1 dbdatavg lvm2 a--  202.29G 101.88G
  /dev/mpath/LOG01p1 dblogvg  lvm2 a--  101.14G   1.14G
  /dev/mpath/LOG02p1 dblogvg  lvm2 a--  101.14G   1.14G
  /dev/mpath/LOG03p1 dblogvg  lvm2 a--  101.14G      0
  /dev/mpath/LOG04p1 dblogvg  lvm2 a--  101.14G  63.43G
  /dev/mpath/LOG05p1 dblogvg  lvm2 a--  101.14G      0
  DB004p1                     lvm2 a--  101.15G 101.15G
  DB005p1                     lvm2 a--  101.15G 101.15G
  DB006p1                     lvm2 a--  101.15G 101.15G
  DB007p1                     lvm2 a--  101.15G 101.15G
  DB008p1                     lvm2 a--  101.15G 101.15G
[root@mylnx200 mapper]#