1. Configure the VNC Server
Edit the vi/etc/sysconfig/vncservers file and add a VNC user.
Add the following line to the end of the vncservers file:
-------------
VNCSERVERS = "1: root"
--------------
Note:
*. The added user (root User) must already exist.
*. "1" indicates the session number. You can add multiple sessions to provide multiple remote desktop services at the same time.
2. Configure the VNC Server password
Run the command: # vncpasswd to set the vnc logon password.
After the password is set, a file named "passwd" is generated under the path/root/. vnc.
If you want to change the VNC Server password, run the # vncpasswd command again.
3. Start the vncserver service
# Vncserver (xstartup file is available only after startup)
4. Modify the VNC service Remote Desktop Startup Mode
Vi/root/. vnc/xstartup
Comment out the last line of twm & and modify it as follows:
--------------
# Twm &
Startkde &
--------------
Save the file and start the vncserver service again. # service vncserver restart
Test connection: IP Address: 1 (for example, 10.160.202.8.0: 1]
5. Common commands of VNC Server
*. Vncserver restart command:
# Service vncserver stop
# Service vncserver start
Or:
# Service vncserver restart
*. Command for viewing the vncserver service status:
# Service vncserver status
*. View the vncserver listening port command:
# Netstat-tlnp | grep vnc
By default, the VNC Server provides the following port numbers for access through a browser: 5800 + session numbers. The port numbers for access through the VNC Viewer client are 5900 + session numbers.
If you need to provide a cross-firewall server, the firewall needs to open the corresponding port.
*. Run the following command to end the service:
# Vncserver-kill: Session ID
For example: # vncserver-kill: 1 // end the service whose session number is 1
This article is from "1"