The configuration and use of VNC on Rhel 6.x

Source: Internet
Author: User
VNC is a bit like a remote Desktop for Windows, and it's handy to use in real-world work.

1, install Vncserver service
# yum Install Tigervnc-server
# Service Vncserver Status
Xvnc is stopped

2, view vncserver status, start vncserver input initialization password
# Service Vncserver Status
Xvnc is stopped
# Vncserver
You'll require a password to access your desktops.
Password:
Verify:
Xauth: (stdin): 1:bad display Name "Oradb:1" in "Add" command
New ' oradb:1 (root) ' Desktop is oradb:1
Creating default startup Script/root/.vnc/xstartup
Starting applications specified In/root/.vnc/xstartup
Log file Is/root/.vnc/oradb:1.log
# ps-ef|grep-i VNC
Root 4700 1 0 00:13 pts/0 00:00:00/usr/bin/xvnc:1-desktop oradb:1 (Root)-auth/root/. Xauthority-geometry 1024x768-rfbwait 30000-rfbauth/root/.vnc/passwd-rfbport 5901-FP Catalogue:/etc/X11/fontpath.d- Pn
Root 4706 4705 0 00:13 pts/0 00:00:00 vncconfig-iconic
Root 4840 2562 0 00:14 pts/0 00:00:00 VNC
# Service Vncserver Status
XVNC (PID 4700) is running ...
# netstat-anp|grep-i 4700
TCP 0 0 0.0.0.0:5901 0.0.0.0:* LISTEN 4700/xvnc
TCP 0 0 0.0.0.0:6001 0.0.0.0:* LISTEN 4700/xvnc
TCP 0 0::: 6001:::* LISTEN 4700/xvnc
UNIX 2 [ACC] STREAM listening 140192 4700/xvnc @/tmp/. X11-unix/x1
UNIX 2 [ACC] STREAM listening 140193 4700/xvnc/tmp/. X11-unix/x1
UNIX 3 [] STREAM CONNECTED 147009 5262/dbus-daemon @/tmp/dbus-apo0gcgaxg
UNIX 3 [] STREAM CONNECTED 147008 5578/gvfsd-metadata
UNIX 3 [] STREAM CONNECTED 141237 4700/xvnc @/tmp/. X11-unix/x1
UNIX 3 [] STREAM CONNECTED 141232 4700/xvnc @/tmp/. X11-unix/x1
UNIX 3 [] STREAM CONNECTED 141227 4700/xvnc @/tmp/. X11-unix/x1
UNIX 3 [] STREAM CONNECTED 141011 4700/xvnc @/tmp/. X11-unix/x1
UNIX 3 [] STREAM CONNECTED 141006 4700/xvnc @/tmp/. X11-unix/x1
UNIX 3 [] STREAM CONNECTED 140905 4700/xvnc @/tmp/. X11-unix/x1
UNIX 3 [] STREAM CONNECTED 140816 4700/xvnc @/tmp/. X11-unix/x1
UNIX 3 [] STREAM CONNECTED 140770 4700/xvnc @/tmp/. X11-unix/x1
UNIX 3 [] STREAM CONNECTED 140622 4700/xvnc @/tmp/. X11-unix/x1
UNIX 3 [] STREAM CONNECTED 140392 4700/xvnc @/tmp/. X11-unix/x1
UNIX 3 [] STREAM CONNECTED 140253 4700/xvnc @/tmp/. X11-unix/x1
UNIX 3 [] STREAM CONNECTED 140223 4700/xvnc @/tmp/. X11-unix/x1
UNIX 3 [] STREAM CONNECTED 140210 4700/xvnc @/tmp/. X11-unix/x1


3, if the use of vnc-viewer expected to appear graphical interface (6.x is the default graphical interface, do not adjust), you need to make the following adjustments (add two lines).
# vi/etc/sysconfig/vncservers

# vncservers= "2:myusername"
# vncserverargs[2]= "-geometry 800x600-nolisten tcp-nohttpd-localhost"
Vncservers= "2:root"
vncserverargs[2]= "-geometry 1024x768"

A simple explanation for two lines of code
Vncservers= "2:root" indicates that the 5802 port number corresponds to the root account.
vncserverargs[2]= "-geometry 1000x720" indicates resolution


4, modify the X11 configuration file, red annotation removed (5.x is the default logoff, 6.x is the default to open)
# Vi/root/.vnc/xstartup
#!/bin/sh

# Uncomment the following two lines for normal desktop:
Unset Session_manager
Exec/etc/x11/xinit/xinitrc

[-x/etc/vnc/xstartup] && Exec/etc/vnc/xstartup
[-R $HOME/. Xresources] && Xrdb $HOME/. Xresources
Xsetroot-solid Grey
Vncconfig-iconic &
Xterm-geometry 80x24+10+10-ls-title "$VNCDESKTOP Desktop" &
TWM &

5, restart the Vncserver service
# Service Vncserver Restart

6, do not recommend vncserver with the OS, if necessary can use Chkconfig configuration
# chkconfig--level Vncserver on

7, use Vnc-viewer to connect vncserver, usually use the client is Vnc-viewer, can download from this website https://www.realvnc.com/download/viewer/

8, re-modify VNC's login password
# VNCPASSWD

New Vncserver Session
# Vncserver:3

Kill Vncserver's conversation.
# Vncserver-kill:3

View the current Vncserver session
# vncserver-list

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.