Introduction:
You must understand:
When the vncserver is called, it will enable the server listening port according to your configuration,
By default, the port starts from 5900 and your desktop number is added.
For example, if your desktop number is 1, the connection Port Number of vnc is 5900 + 1 = 5901.
For example, if your desktop number is 10000, the connection Port Number of vnc is 5900 + 10000 = 15900.
========================================================== ====================================
The VNC server is configured below to enable the user root) to remotely connect to the linux system GUI through the vnc client (provided that the desktop is installed on your server)
1. Check whether VNC is installed in linux.
Enter the following command in the terminal window:
rpm -q vnc-server
The returned information is as follows:
package vnc-server is not installed
The vnc server is not installed.
2. Run the following command for installation:
yum install vnc vnc-server
3. Start the VNC service
vncserverYou will require a password to access your desktops.Password:Verify:
You will be prompted to enter the password, which is required for remote logon. Enter the password and press Enter.
4. Switch to the root account: su root and enter the password of the root account.
Vi/etc/sysconfig/vncservers # vnc configuration fileVNCSERVERS = "10000: root" # cancel the previous #10000: root desktop number: User) # VNCSERVERARGS [2] = "-geometry 800x600-nolisten tcp-localhost"
Save and exit
5. configure the firewall to allow port 10000 + 5900 = port 15900 to pass through the firewall or remote connection to the VNC Server)
Vi/etc/sysconfig/iptables-a input-m state -- state NEW-m tcp-p tcp -- dport 15900-j ACCEPT allows port 15900 to pass the firewall)
Save and exit
6. Restart the vnc server.
/Etc/init. d/vncserver restart or service vncserver restart
7. Restart the firewall to make the port configuration take effect.
/etc/init.d/iptables restartservice iptables restart
8. Set the vnc server to automatically start upon startup
Method 1: run the "ntsysv" command to start the graphical service configuration program. Add an asterisk to The vncserver service and click "OK". The configuration is complete.
Method 2: Use "chkconfig" to operate in command line mode. Use the following command:
chkconfig vncserver onchkconfig --list vncservervncserver 0:off 1:off 2:on 3:on 4:on 5:on 6:off
9. Change the vnc connection password
Vncpasswd
At this point, the VNC server has been set up and can be connected using the VNC client.
Vnc Server: Your ip: 15900
Note: If the gray screen appears after the connection, you can set it as follows:
Enter the user's home directory, cd/home/user
If you log on with the root account, the current directory is the root directory of the user.
Cd ~ /. Vncvi xstartup # edit # twm & # comment out this line of gnome-session & # Add this line
Save and exit to connect normally!
This is a success. Next you can use http: // IP: port to log on to the WEB, for example
Http: // IP: 5801. You can also use IP: 1 in vncviewer to log on.
Original article: http://blog.haohtml.com/archives/12281