VNC server configuration, startup, restart and connection, graphics management Linux system

Source: Internet
Author: User

Environment: RedHat Linux 5 Enterprise Edition.
Xwindows:gnome (Red Hat default installed graphical interface)

Although we can use the SSH connection to operate Linux remotely via the character interface, it is inconvenient for more familiar graphics people, so it is necessary to open the Remote Desktop for Linux. There are two popular ways: XDM (X display manager) and VNC, and I personally prefer the VNC scenario because the VNC solution is relatively easy to configure and the VNC solution supports a variety of connection methods, such as accessing the Linux desktop through a browser, Eliminate the hassle of having to install the client.

Next go to the specific configuration instructions:

First, confirm and install Vncserver.

1, first verify that your server is configured with Vncserver, you can click on the command line below the command to view:

[[Email protected]: ~] #rpm-qa |grep VNC

Vnc-server-4.1.2-14.el5 #返回VNCSEVER服务器端版本说明你已经安装了VNCSERVER.

2, if Vncsever is not installed, locate the installation package from the CD to install it.

First mount the disc (also called extract) to a directory here is the rhel5-64 directory created under/var/ftp/pub/

Mount-o Loop rhel-server-5.3-x86_64-dvd.iso/var/ftp/pub/rhel5-64/

Then locate the VNC-SERVER-4.1.2-14.EL5.X86_64.RPM installation package in the/var/ftp/pub/rhel5-64/server directory and install it directly using the RPM command;

RPM-IVH vnc-server-4.1.2-14.el5.x86_64.rpm


Two, start configuring Vncserver

1, start Vncserver, the first start vncserver will prompt for password, here is divided into administrator accounts and ordinary accounts, the starting mode slightly different.

Administrator:

[Email protected]/]# Vncserver

You'll require a password to access your desktops.

password:123456 #输入vnc Connection Password

verify:123456 #确认vnc密码

Xauth:creating new Authority file/root/. Xauthority

New ' Localhost.localdomain:1 (root) ' Desktop is Localhost.localdomain:1

Creating default startup Script/root/.vnc/xstartup
Starting applications specified In/root/.vnc/xstartup
Log file Is/root/.vnc/localhost.localdomain:1.log


Normal User:

[[email protected]/] #su Ceboy #ceboy username
[Email protected]/]$ Vncserver

You'll require a password to access your desktops.

password:123456 #输入vnc Connection Password

verify:123456 #确认vnc密码

Xauth:creating new Authority file/home/ceboy/. Xauthority

New ' Localhost.localdomain:2 (ceboy) ' Desktop is Localhost.localdomain:2

Creating default startup Script/home/ceboy/.vnc/xstartup
Starting applications specified In/home/ceboy/.vnc/xstartup
Log file Is/home/ceboy/.vnc/localhost.localdomain:2.log

#这里要注意: Each user can start their own vncserver Remote Desktop, while each user can start multiple vncserver Remote Desktop, they use the IP port number: ip:1, Ip:2, ip:3 to identify, differentiate, using the same port will allow the other logged in the user automatically exit. In addition, most of the Vncserver configuration files and log files are in the user home directory. VNC directory.

Users can customize the startup numbers such as:

[Email protected]/]$ Vncserver:2 #注意: There must be a space in front of the 2.
A VNC Server is already running As:2

Third, the related desktop configuration, RedHat Linux supports two graphics modes: KDE mode and GNOME mode.

1. What graphics mode does your RH use? This is generally only a login to the GUI to know, or through the PS-A command list all currently running programs, see if there is KDE or gnome words to judge.

If you are a GNOME desktop, then you need to modify the/root/.vnc/xstartup configuration file.

[email protected]. vnc]# VI Xstartup

#!/bin/sh
# Uncomment the following-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" &
Gnome-session Gnome #添加这一句是连接时使用gnome Desktop environment
TWM &

It is best to restart the system once the settings have been modified, otherwise the settings will not take effect. I used the method of killing the vncserver process and then re-running Vncserver.

[[email protected]. VNC] #vncserver-kill:1 #这里你启动vncserver时是什么端口号要对应上.
[[email protected]. VNC] #vncserver: 1 #重启VNCSERVER, note: 1 must be preceded by a space.

2, set the user information and resolution.

[Email protected]: ~] #vi/etc/sysconfig/vncservers

# The Vncservers variable is a list of display:user pairs.
#
# Uncomment the lines below to start a VNC server on Display:2
# as my ' myusername ' (adjust this to your own). You'll also
# need to set a VNC password; Run ' man vncpasswd ' to see how
# to does that.
#
# do not RUN the this SERVICE if your the local area network is
# untrusted! For a secure-to-the-using VNC, see
# <<a href= "http://www.uk.research.att.com/archive/vnc/sshvnc.html" >url:http://www.uk.research.att.com/ archive/vnc/sshvnc.html;.
# use "-nolisten TCP" to prevent X connections to your VNC server via TCP.
# Use the "-nohttpd" to prevent web-based VNC clients connecting.
# use "-localhost" to prevent remote VNC clients connecting except when
# Doing so through a secure tunnel. See the '-via ' option in the
# ' Man vncviewer ' manual page.

vncservers= "1:root 2:ceboy" #此处添加用户, generally only add a 1:root also on the line.

vncserverargs[1]= "-geometry 800x600-nolisten tcp-nohttpd-localhost"
vncserverargs[2]= "-geometry 1024x768-nolisten tcp-nohttpd-localhost"

#注意: Above is the resolution of the root and Ceboy two users respectively, note that the port number is distinguished.

In addition, you can temporarily modify the resolution and color depth through the command line, this way will be lost after restarting, here temporarily, the command is as follows:

[Email protected]: ~] #vncserver-geometry 800x600 #设置vncserver的分辨率

[Email protected]: ~] #vncserver-depth #设置vncserver的色深

Here Vncserver server side is configured to complete.

Four, client connection and use.

1, Access mode
A, under Linux, run the vncviewer command, the server address is written in a form such as 192.168.1.11:1
b, under Windows, run the Windows version of Vncviewer, using a similar usage to Linux.
C, with the browser (platform-independent), as a Java applet to implement, in a form like http://192.168.1.11:5801 to start (VNC Port starting from 5800, and so on, generally will be 5800,5900)

Here are some common sense:

2, Change password

You can run VNCPASSWD

3, Stop Vncserver

#vncserver-kill:1
#vncserver-kill:2

Note that vncserver can only be turned off by the user who started it, instant root can not be turned off by other users vncserver, can only kill the process with kill command violence.

4, Stability settings

Vncserver by default when multiple clients connect to the same vncserver display port, the Vncserver port old connection, and the new connection service, can maintain the old connection by-dontdisconnect rejecting the new connection request.

5, the same monitor can connect multiple clients

#vncserver-alwaysshared

6, restart the service

Service Vncserver Restart

7, let the system start automatically start Vncserver.

Log in to the Redhat Linux GUI using a VNC connection, click on "System"--"manage"--"Server Settings"-"service", check it in "Background service" and click Save.


To resolve a problem that is not connected:
1, the firewall can not be connected to open
Turn off Firewall service iptables stop
View firewall status Service iptables status
View Process PS AXF | grep vnc/iptables

VNC server configuration, startup, restart and connection, graphics management Linux system

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.