1. VNC server configuration on RedHat
This article takes the VNC Server not installed in the current Linux system as the basis. If you have installed it, Skip section 1st!
Prerequisites:
1. Install tigervnc Server
# yum search tigervnc-server
# yum install tigervnc-server.x86_64
# vncpasswd
First, run vncpasswd as the user identity to be remotely logged on to set the login password, at least six digits. This password is used during client connection.
2.Configure graphical interface
Modify the configuration file, activate the graphical interface, and run the following command:
# vi /root/.vnc/xstartup
Comment out this line
# TWM & // comment the row
Add a row at the end
Gnome-session & // Add this row
Save and exit
3. Start the VNC service
Execute Command
# /etc/init.d/vncserver start
Or
# service vncserver start
Prompt after startup:
Starting VNC server: no displays configured [FAILED]
Solution:
Run the following command to modify the last two lines:
# vim /etc/sysconfig/vncservers
Modify the last two rows, for example:
VNCSERVERS="1:root"VNCSERVERARGS[1]="-geometry 1024x768"
Note: The first act service is configured. Currently, only one VNC service is configured and started with the user root. If you need to log on with another user, you can modify the value of vncservers, for example, "1: root 2: Tiger "(Tiger is another user in the system ). The second line can be commented out, which is to configure the window resolution. You need to remove the-localhost
The VNC Server is automatically started with the system.
Execute Command
# sudo chkconfig --level 345 vncserver on
4. Stop the VNC service
Execute Command
# /etc/init.d/vncserver stop
Or
# service vncserver stop
Ii. Access Linux Through VNC Viewer in Windows
First install RealVNC, download it from the Internet, start-run VNC Viewer, enter the IP address, and the following: 1 indicates to log on with the root user, 1: Root configured on RH, if you want to log on with another user, adjust the number after the colon. The password is previously configured.
Solution to connection failure
Run the command to check what port the VNC listens to. open the port in the firewall.
# netstat -ntupl|grep vnc
The returned list is as follows:
1. tcp 0 0 0.0.0.0:5901 0.0.0.0:* LISTEN 4411/Xvnc 2. tcp 0 0 0.0.0.0:6001 0.0.0.0:* LISTEN 4411/Xvnc 3. tcp 0 0 :::6001 :::* LISTEN 4411/Xvnc
Modify the firewall configuration file and open port 5901.
# vi /etc/sysconfig/iptables
You can copy a row of port 22 and paste it to modify it to restart the Firewall Service.
# service iptables restart