Linux commands: Configuration and use of the VNC service

Source: Internet
Author: User


The installation configures the VNC service so that the Linux host can be managed through a graphical interface:

At present the more popular way: XDM (X display manager) program and VNC program, the personal sense of VNC solution is more convenient;

One is because the VNC scheme is relatively simple to configure, and the other is that the VNC scheme supports a variety of connection methods, such as browser access

Linux desktops, eliminating the hassle of having to install clients.


Installation configuration VNC pre-preparation, a Linux Redhat server, followed by the specific configuration instructions :


One, confirm and install VNC SERVER

1. First confirm whether the server is installed with VNC server and can be viewed by command;

[Email protected] ~]# RPM-QA vnc* #查看是否安装VNC Server

vnc-4.1.2-14.el5_3.1 #VNC客户端

vnc-server-4.1.2-14.el5_3.1 #vnc服务端

2. If the VNC Server,redhad system CD is not installed with the installation package, the configuration CD can be installed directly from the Yum source

[Email protected] ~]# yum-y install vnc*

Loaded Plugins:rhnplugin, security

.............

Running Transaction

Installing:vnc 1/1

Installed:

Vnc.x86_64 0:4.1.2-14.el5_3.1

complete!

Installation complete, start VNC service!


Two, start configuring VNC SERVER

[email protected] ~]# vncpasswd #设定当前用户登录VNC的密码

Password:

Verify:


[email protected] ~]# Vncserver #启动VNCSERVER


New ' johntest.com:2 (root) ' Desktop is johntest.com:1 #访问VNC方式用户名: 1


Starting applications specified In/root/.vnc/xstartup

Log file Is/root/.vnc/johntest.com:1.log

Connecting the current vncserver via the remote Windows client VNC software

650) this.width=650; "src=" https://s2.51cto.com/wyfs02/M00/8F/AB/wKiom1joT6iihqEuAAGD0hogug0245.jpg "style=" float : none; "title=" 1.jpg "alt=" Wkiom1jot6iihqeuaagd0hogug0245.jpg "/>

650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M02/8F/AB/wKiom1joT6jRVqtXAAER6hOlzTc761.jpg "style=" width : 700px;height:380px; "title=" 2.jpg "width=" "height=" 380 "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" Wkiom1jot6jrvqtxaaer6holztc761.jpg "/>

The Linux system has been logged on remotely via VNC, but at this point the desktop is just a simple interface, if you need to enable the GNOME desktop

The program needs to pass the following settings:


[email protected] ~]# CD. VNC #进入到vnc服务的文件夹进行配置启动脚本

[email protected]. vnc]# ls

Johntest.com:1.log johntest.com:1.pid johntest.com:2.log johntest.com:2.pid passwd xstartup

[email protected]. vnc]# Vim Xstartup #修改如

650) this.width=650; "src=" https://s5.51cto.com/wyfs02/M01/8F/AB/wKiom1joUS3Rpz-2AAJZTh6g2Xo743.jpg "title=" 1.jpg "alt=" Wkiom1jous3rpz-2aajzth6g2xo743.jpg "/>

After you modify the settings, you need to restart the system, otherwise the settings will not take effect, or all open VNC Remote Desktop processes

Terminate and then rerun the Vncserver service.

Check the VNC service to run several processes first:

[email protected] ~]# ps-aux |grep VNC #查看vnc进程

Warning:bad syntax, perhaps a bogus '-'? See/usr/share/doc/procps-3.2.7/faq

Root 2514 0.1 0.8 47540 7432 pts/0 S 10:56 0:00 xvnc:1-desktop johntest.com:1 (Root)-httpd/u sr/share/vnc/classes-auth/root/. Xauthority-geometry 1024x768-depth 16-rfbwait 30000-rfbauth/root/.vnc/passwd-rfbport 5901-PN

Root 2713 2.0 0.8 47544 7424 pts/0 S 10:58 0:00 xvnc:2-desktop johntest.com:2 (Root)-httpd/u sr/share/vnc/classes-auth/root/. Xauthority-geometry 1024x768-depth 16-rfbwait 30000-rfbauth/root/.vnc/passwd-rfbport 5902-PN

By looking at the Discovery run 2 VNC processes, you need to terminate these 2 VNC running processes:

[email protected] ~]# vncserver-kill:1 #关闭第一个vnc进程

Killing Xvnc process ID 4289

[email protected] ~]# vncserver-kill:2 #关闭第二个vnc进程

Killing Xvnc process ID 4338

[Email protected] ~]# vncserver #重新启动vncserver

New ' johntest.com:1 (root) ' Desktop is johntest.com:1


Starting applications specified In/root/.vnc/xstartup

Log file Is/root/.vnc/johntest.com:1.log

Test again through the remote Windows connection, whether the desktop is now normal:

650) this.width=650; "src=" https://s5.51cto.com/wyfs02/M00/8F/AB/wKiom1joVhLwuVa-AAjH3Y4DRew771.jpg "title=" 1.jpg "Width=" "height=" 438 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:700px;height:438px; "alt=" Wkiom1jovhlwuva-aajh3y4drew771.jpg "/>

Here, the VNC server configuration is complete.

The following is a further configuration of the multi-VNC server side:

1, set the user information and resolution; (permanent)

To edit the Vncserver configuration document:

[email protected] ~]# vim/etc/sysconfig/vncservers #在最后面添加以下几行设置


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.

It is also possible to temporarily modify the resolution and color depth via the command line, which fails after restarting, with the following command:

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

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


Third, the client connection and use;

1. Access method

A. Under Linux, run the Vncviewer command, and the server address in the form of a Linux system that uses the Vncviewer command must have a VNC application installed, otherwise it will not be able to use the 10.109.134.249:1

B. Under Windows, you can run the Windows version of the VNC program.

C. browser access, http://10.109.134.249:5801 connection (VNC port starting from 5800 and so on, usually 5800,5900)


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

Vncserver Start Vncserver

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.

This article is from the "Learn Linux history" blog, please be sure to keep this source http://woyaoxuelinux.blog.51cto.com/5663865/1914078

Linux commands: Configuration and use of the VNC service

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.