Build vnc in linux

Source: Internet
Author: User
Tags pcanywhere
Set up vnc in linux-Linux Enterprise Application-Linux server application information. The following is a detailed description. VNC is still the best remote control software in LINUX. But it is not too close to Chinese users. For example, in LINUX, Chinese Input cannot be output by Hot Key. Although there are a few deficiencies, it still cannot block its position in the LINUX system. Let's take a look at its charm. First of all, copy and paste are very casual. Copy the local machine and paste it directly in the remote machine. Very convenient.

Network remote control technology refers to a computer (master) to control another computer (controlled), and when the master is on the control end, just as users sit in front of the controlled terminal, they can execute the controlled application and use the system resources of the controlled terminal.
VNC (Virtual Network Computing) is a set of software developed by the AT&T lab that can control remote computers. It adopts the GPL authorization terms and anyone can obtain the software for free. The VNC software consists of VNC server and VNC viewer. You must first install the VNC server on the controlled computer before you can control the controlled terminal on the control terminal.
(In windows, is a well-known network remote control software ?? Symantec released pcAnywhere.
VNC server and VNC viewer support multiple operating systems, such as Unix, Linux, Solaris, windows, and MacOS, therefore, you can install the VNC server and VNC viewer in different operating systems for control. If the current master computer does not have VNC viewer installed, you can control the control end through a general web browser.
The workflow for running the entire VNC is as follows:
(1) connect the VNC client to the VNC Server through a browser or VNC Viewer.
(2) The VNC Server sends a dialog window to the client, requiring that you enter the connection password and access the VNC Server display device.
(3) After the client enters the online password, the VNC Server verifies that the client has access permissions.
(4) If the client passes the VNC Server verification, the client requires the VNC Server to display the desktop environment.
(5) The VNC Server uses X Protocol to require X Server to assign control of the display to the VNC Server.
(6) The VNC Server will be sent to the client using the VNC communication protocol in the desktop environment of X Server in the future, and allow the client to control the desktop environment and input device of the VNC Server.

"Installation and Use of VNC 』
My operating environment: Redhat9.0 on the control side and Windows XP on the control side.
1. Load VNC Server
VNC Server: http://gwbn.onlinedown.net/soft/1271.htm

2. install.
Vnc-3.3.7-x86_linux.tar.gz (if the source code, see the instructions in the package), when downloading the Linux version of VNC, You can decompress the file to a folder, such as/home/vnc, copy the vncserver, vncpasswd, and Xvnc files to the/usr/bin directory. If you want to remotely control a Linux computer through the Integrated Java interface of the VNC server, you also need to create a sub-directory/usr/local/vnc/classes. After this subdirectory is created, copy the VNCJava. class file to this directory. (Generally, redhat 9.0 comes with the above files, so you can directly use the terminal to execute it ).

In FC8, run YUM directly, and then click the giant. I have never looked at how to install it.

3. Start VNC Server on Linux
Run the vncserver command:
[Root @ linux root] # vncserver
You will require a password to access your tops.
Password: ---- to prevent anyone from remotely controlling the computer. Therefore, when
When you start the VNC server once, you must set a password for remote control. This is your login VNC password must be safe enough. It seems that users can be configured in any article. However, 80% of users are not used to distinguishing users. Because VNC can Virtualize N desktops. Hooko, with LINUX users, is very good and powerful.
Creating default startup script/root/. vnc/xstartup
Starting applications specified in/root/. vnc/xstartup
Log file is/root/. vnc/linux: 1.log
(After the preceding steps, the VNC Server is started. If you want to change the VNC Server password, you only need to execute the vncpasswd command .)

5. remote control from the browser.
Start the VNC Server and open your browser. in the address bar, enter the address or IP address of the controlled terminal, and add the port number ": 5800 + display number" to the address to control the computer.
For example: http: // 192.168.01.: 5801 (if the display number is 1, the display number set for the first time is 1, then 5800 + 1 = 5801 is used .)

If you see the window, it indicates that you have succeeded. You can remotely control it by entering the password in the password box.

It's okay. Who should use a browser ..... Boring step

6. FAQ

A. How can I log on to the controlled terminal through A graphical interface?

Edit ~ /. 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 gray
Vncconfig-iconic &
# Xterm-geometry 80x24 + 10 + 10-ls-title "$ VNCDESKTOP Desktop "&
Gnome-session & it is recommended to select this... Add # To the front of all others #
Startkde &
Twm &

Gnome-session is used to start the Gnome GUI; startkde is used to start the kde gui; twm is used to start the text interface. Choose one of the three.

A. How to automatically start the vnc service at startup

Choose system Settings> Server Settings> services, select vncserver, and click Save ".

Modify/etc/sysconfig/vncservers

VNCSERVERS = "1: root 2: phred 3: sysadmin" 1 stands for "desktop 1" and root stands for the user name; multiple user desktops can be started simultaneously
VNCSERVERARGS [1] = "-geometry 800x600-alwaysshared-depth 24"

-Alwaysshared indicates that multiple users are allowed to log on at the same time. The value of depth is 8, 16, 24, and 32.



This step is a bit advanced... It is also complicated. In fact, the client can complete the configuration of 80%. I have a better method, because SSH is enabled by default. Open VNC over SSH. There is only one command. Security is more important.




A. Why is there only one Terminal window on the desktop after the connection?
Try to modify/root/. vnc/xstartup and change the last line of twm & to gnome-session & or kde & (it is said that KDE is not stable in the current VNC Viewer)

B. Why can't I connect after I restart the VNC Server?
When you restart the VNC Server, the system will specify a new display number. You must use this new number. Otherwise, the connection will fail.

Slave --------------------------------------------------------------------------------------------------------------------------------

View the vnc desktop number and monitoring process

[Root @ linux/] # netstat-tlnp | grep vnc

The vncserver command has some useful parameters, which can be viewed using vncserver -- help.
A brief explanation:
Vncserver [:] [-name] [-geometry x] [-depth]
[-Pixelformat format]
Vncserver-kill: display

:
The display Number of the vnc service. You can specify it by yourself. Do not use the default value of the system to ensure security. It must be a non-zero positive integer.
Vncserver: 99
During use, you must enter the correct display number to connect. In the browser, add the display number to the port number. The default port is 5800. For remote connection, enter XXX. XXX: 5899.

-Name: Specifies the vncserver desktop name.
For example, to display the name as "Red Hat"
Vncserver-name Red Hat

-Geometry x indicates the desktop resolution. The default value is 1024x768.
Vncserver-geometry 800x600
This command is useful in practice. For example, if the local resolution is 1024x768, if the remote vnc resolution is not set, the desktop display will be incomplete.

-Depth: Specifies the display color. The value ranges from 8 to 8 ~ 32
Vncserver-depth 16
Display in 16 bits color

-Pixelformat: the specified pigment format is roughly the same as-depth, but the representation method is different.
Vncserver-pixelformat RGB888
Display in 24 bits color

Vncserver-kill: display
End vnc service and Remote Desktop
Vncserver-kill: 1
For more detailed usage, use man.

The Windows Manager set in vnc is twm, which may be different from the one you use. You can change the configuration file of vnc to your favorite one by modifying the configuration file. The method is as follows:
Modify the. vnc/xstartup file in the user directory
#! /Bin/sh
[-R $ HOME/. Xresources] & xrdb $ HOME/. Xresources
Xsetroot-solid gray
Vncconfig-iconic &
Xterm-geometry 80x24 + 10 + 10-ls-title "$ VNCDESKTOP Desktop "&
Twm &
#! Comment out all the content after/bin/sh and change it
~ /. Xclients
Save files
Now you can test whether the modification is successful. kill the vncserver service first.
Vncserver-kill:
Or
Pa aux | grep Xvnc
Kill PID
Restart vncserver and use vncviewer to connect to the Remote Desktop.

In the previous article about vnc server settings (http: // bbs.chinaunix.net/forum/viewtopic.php? T = 368552 & highlight = yunqing), we can run vncserver on a linux server for remote access, but note that, if you directly use vncviewer for access, there are two disadvantages:
1. Password transmission is in plain text and can be easily listened.
2. the firewall needs to open port 59xx, which is impossible in the normal unit.
Fortunately, we have ssh, a powerful tool, like X11 Forwarding. We can use the ssh tunnel to protect the communication process. The following is a brief introduction.

Assume that the vncserver runs on screen 1 of myserver (IP Address: 192.168.x.x), that is, It listens for 192.168.x.x: 5901, and the user name is foo.

Scenario 1: The vnc client is linux
This situation is very simple. ssh suites are installed by default in general linux releases.
1. log on to the server using ssh

Ssh-L 5901: localhost: 5901-l foo myserver

Or directly use an IP address.

Ssh-L 5901: localhost: 5901-l foo 192.168.x.x

2. Run vncviewer (or other similar tools) on another terminal on the local machine)
Vncviewer localhost: 1

Scenario 2: The vnc client is windows
1. Download an ssh client, personal recommendations putty, only one program, do not need to install, simple and functional. Download http://www.chiark.greenend.org.uk here /~ Sgtatham/putty/download.html
Download putty.exe and run it directly on the desktop.
2. Run putty, enter the IP address of the server, and enter a name. Here, myserver serves as the session name, and press save to save. See Appendix
3. Click tunnels on the left of the dialog box to select related settings, enter 5901 in source port, enter localhost: 5901 in Destination, and press Add, as shown in the following figure.
4. Click session on the left side, return to session settings, and press save to save the settings. Click open to log on to the server.
5. run vnc-viewer (if not, download http://www.realvnc.com/download.html, just use an exe file) and enter localhost: 1 in the Server. See the attachment, after the password is entered, a linux desktop will appear in windows, and it is very safe. Cool can play this step, all of which I worship. Ha



Highlights of VNC Problems

1. What is VNC?

VNC has two definitions: software and protocol.

VNC is Virtual Network Computing

Software is a shared software under the GNU public license that complies with the VNC protocol ,. at the beginning, it was developed by AT&T's UK lab [now the Group has established RealVNC. this mainly enables the computer to remotely control another computer. Many companies have developed various VNC Based on VNC, which can run on various operating systems.

VNC protocol. Communication protocol between the Controller and the controlled computer. The protocol used by VNC is RFB. [many people do not know it] RFB Protocol is here. Http://realvnc.com/docs/rfbproto.pdf

2. What are the advantages of VNC?

First, the biggest advantage of VNC is cross-platform. Because the interface processing methods of different operating systems are different, some people have developed different VNC versions, because they all comply with the VNC protocol, so the compatibility is better. Someone else has made a Java client that can run the client on machines that can run JVM.

[Of course, Microsoft, uanywhere, and Linux have their own solutions, such as Terminal, PcAnywhere, and Xceed. But they do not open code...]

Second, there are many versions, open source code, and everyone can continuously improve it.

[This is an open benefit]

Third, speed. The speed is quite fast, if your network bandwidth is good.



3. vnc pk ms Terminal

VNC: Windows account/password is not required. This is convenient for one-time users. Otherwise, it is not safe to add users to Windows every time.

Windows: Windows Server can be accessed by multiple users. VNC can only be used by two people (controlled and controlled computers.

VNC: allows control and controlled screens to be displayed and operated simultaneously. In this way, you can perform Demo and shared communication. Windows does not have this function!



Installation and Use of VNC --



Http://bangnet.blogdriver.com/bangnet/628595.html
Install and use VNC.
Note: The content of this article is simple and is intended for beginners.
This article is divided into two parts: the first part is the introduction of VNC, and the second part is the installation and use of VNC.
This article summarizes the actual operations of the younger brother Based on the books and the younger brother. If there are errors and omissions, please point out.
Fish_ys 2003.8.25

"VNC Introduction 』
Network remote control technology refers to a computer (master) to control another computer (controlled), and when the master is on the control end, just as users sit in front of the controlled terminal, they can execute the controlled application and use the system resources of the controlled terminal.
VNC (Virtual Network Computing) is a set of software developed by the AT&T lab that can control remote computers. It adopts the GPL authorization terms and anyone can obtain the software for free. The VNC software consists of VNC server and VNC viewer. You must first install the VNC server on the controlled computer before you can control the controlled terminal on the control terminal.
(In windows, is a well-known network remote control software ?? Symantec released pcAnywhere.
VNC server and VNC viewer support multiple operating systems, such as Unix, Linux, Solaris, windows, and MacOS, therefore, you can install the VNC server and VNC viewer in different operating systems for control. If the current master computer does not have VNC viewer installed, you can control the control end through a general web browser.
The workflow for running the entire VNC is as follows:
(1) connect the VNC client to the VNC Server through a browser or VNC Viewer.
(2) The VNC Server sends a dialog window to the client, requiring that you enter the connection password and access the VNC Server display device.
(3) After the client enters the online password, the VNC Server verifies that the client has access permissions.
(4) If the client passes the VNC Server verification, the client requires the VNC Server to display the desktop environment.
(5) The VNC Server uses X Protocol to require X Server to assign control of the display to the VNC Server.
(6) The VNC Server will be sent to the client using the VNC communication protocol in the desktop environment of X Server in the future, and allow the client to control the desktop environment and input device of the VNC Server.

"Installation and Use of VNC 』
My operating environment: Redhat8.0 on the control side and Windows XP on the control side.
1. Load the VNC Server and VNC viewer.
VNC Server: http://www.linuxeden.com/download/softdetail.php? Softid = 744
VNC viewer: http://download.pchome.net/php/dl.php? Sid = 1, 2603
2. install.
Rpm? Uvh vnc-3.3.6-2.i386.rpm (if the source code please see the instructions in the package)
Install winvnc.exe
3. Start VNC Server on Linux
Run the vncserver command:
[Root @ linux root] # vncserver
You will require a password to access your tops.
Password: ---- to prevent anyone from remotely controlling the computer. Therefore, when
Verify: --- when you start the VNC server once, you must set a password for remote control.
New 'X' desktop is linux: 1 ---- remember this line will be used later.
Creating default startup script/root/. vnc/xstartup
Starting applications specified in/root/. vnc/xstartup
Log file is/root/. vnc/linux: 1.log
(After the preceding steps, the VNC Server is started. If you want to change the VNC Server password, you only need to execute the vncpasswd command .)
4. Run VNC Viewer on Microsoft Windows
Run unzip vncviewer.exe directly. The Connection details dialog box is displayed.
In the Connection details dialog box, enter the IP address of the VNC server (or host name and display device number) in the "VNC Server" text box (see 3. Start this line of the VNC server on Linux. New 'X' desktop is linux: 1 to get this information. For example: 192.168.0.1: 1 (1 after the colon is the display device number generated by the VNC Server). After you click the "OK" button, the VNC Server starts to check the entered information. If the information is incorrect, the system displays the "Failed to connect to server" error message: if the information is correct, the "VNC Authentication" dialog box appears.
If the password entered in the "VNC Authentication" dialog box is correct, you can successfully open the Linux desktop window.
5. remote control from the browser.
Start the VNC Server and open your browser. in the address bar, enter the address or IP address of the controlled terminal, and add the port number ": 5800 + display number" to the address to control the computer.
For example: http: // 192.168.01.: 5801 (if the display number is 1, the display number set for the first time is 1, then 5800 + 1 = 5801 is used .)

6. FAQ
A. Why is there only one Terminal window on the desktop after the connection?
Try to modify/root/. vnc/xstartup and change the last line of twm & to gnome-session & or kde & (it is said that KDE is not stable in the current VNC Viewer)

B. Why can't I connect after I restart the VNC Server?
When you restart the VNC Server, the system will specify a new display number. You must use this new number. Otherwise, the connection will fail.
(The above are just some of my problems, and there are not many VNC problems, which are not comprehensive. I hope to provide more valuable comments)

To keep the vncserver port unchanged at each startup
I used vnc and finally connected to redhat on wingdows, but what I saw was xteam.
While I am using the kde Desktop. How can I solve the problem?
Is the password generated by the VNCPASSWD and the system passwd the same? It is still different.
Or whether the password of the remote machine accessed through vnc should be the same as the root user of the vnc Server
The password is consistent.
Thank you.
Set vncserver startup variables:
To ensure that the vncserver port number remains unchanged at each startup (5901)
Add the following command to the/etc/rc. d/rc. local file:
Rm-f/tmp/. X11-unix/X *
Rm-f/. vnc/*. pid
Rm-f/. vnc/*. log
In this way, the system will first Delete the temporary files left when the last abnormal shutdown is started.
Improvements for linux vnc server:
The Desktop Management Environment set by the vnc server on linux is twm, which is too simple.
Modify the $ HOME/. vnc/xstartup file.
Add # To the front of all content rows, and add the following at the end:
Startkde &
Of course, you can replace it with your preferred desktop. I use kde to replace twm, and the speed will be slower, but it is much more convenient to use.
Note that you must restart the vnc server.
Modify the/usr/bin/vncserver file and set the related row
$ Geometry 800X600;
$ Depth 16;
In this way, the vncserver is started on a desktop of 800X600 16t.
In addition, VNCSERVER has its own separate password and ROOT password.

First of all, thanks. Now I can connect to the redhat kde Desktop.
However, no vncserver file exists in my/usr/bin file.
So it seems that the self is relatively small, especially the deformation of Chinese characters.
Ask what the vncserer file functions are and how to compile them.
The Internet is a good thing, and it is because of so many selfless dedication. The scenery here is so touching
Generally, we operate on linux Hosts. If one day I am in another country or on another computer on this network, I will operate on the linux host again. There are many methods. Next I will introduce vnc, a control software that can use graphics and web pages. vnc has two programs in win and linux versions, one is the server, the other is the viewer, and the Controller is the viewer.
The vnc software is installed by default when linux7.2 is installed. We only need to start it.
Enter the vncserver at the command prompt and prompt you to enter the password. It is better to enter the password twice. Otherwise, the password will be broken!
Now, vnc is running.

Install the vnc viewer on other customers' computers on the network and run it:
Enter the IP address and window number of your linux host, for example:
Enter the correct password after 192.168.0.1: 1.

How can I see that the interface is not my gonme interface? This can be solved. Log on to the linux host and edit/$ home/. vnc/xstartup. Add the # sign in front of all the rows to make them invalid and add a line.
Gnome-session &
After saving it, log on to the client and you will see the beautiful and concise gnome interface! Other operations are the same as those on linux Hosts.

You can also use Internet Explorer on other computers. Enter the following in the ie address bar:
Http: // linux host ip Address: 5801. You can enter the correct password on the screen to access the linux host.
Related Article

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.