Although we can use SSH connection to remotely operate Linux through a character interface, it is very inconvenient for people who are familiar with graphics, so it is necessary to open Linux remote desktop. There are currently two popular methods: XDM (X display manager) solution and VNC solution. I personally prefer the VNC solution. One is that the VNC solution is relatively easy to configure, and the other is that the VNC solution supports multiple connection methods. For example, accessing the Linux desktop through a browser eliminates the trouble of installing a client.
Next enter the specific configuration instructions:
Simple Application Server
USD1.00 New User Coupon
* Only 3,000 coupons available.
* Each new user can only get one coupon(except users from distributors).
* The coupon is valid for 30 days from the date of receipt.
1. Confirm and install VNC SERVER.
1. First confirm whether your
server is configured with VNC
SERVER, you can type the following command in the command line to check:
[root@localhost: ~]#rpm -qa |grep vnc
vnc-server-4.1.2-14.el5 #Return to the VNCSEVER server-side version indicating that you have installed VNC
SERVER.
2. If VNCSEVER is not installed, find the installation package from the CD and install it.
First mount the CD (also called decompression) to a directory, here is a rhel5-64 directory created under /var/ftp/pub/
mount -o loop rhel-server-5.3-x86_64-dvd.iso /var/ftp/pub/rhel5-64/
Then find the vnc-server-4.1.2-14.el5.x86_64.rpm installation package in the /var/ftp/pub/rhel5-64/Server directory and install it directly using the RPM command;
rpm -ivh vnc-server-4.1.2-14.el5.x86_64.rpm
2. start to configure VNC SERVER
1. Start VNC SERVER. When you start VNC
SERVER for the first time, you will be prompted to enter a password. This is divided into administrator accounts and ordinary accounts. The startup method is slightly different.
administrator:
[root@localhost /]# vnc server
You will require a password to access your desktops.
Password: 123456 #Enter the vnc connection password
Verify: 123456 #Confirm vnc password
xauth: creating new authority file /root/.Xauthority
New ‘localhost.localdomain:1 (root)’ desktop is localhost.localdomain:1
Creating default startup script /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/localhost.localdomain:1.log
general user:
[root@localhost /]#su ceboy #ceboy is the username
[ceboy@localhost /]$ vncserver
You will require a password to access your desktops.
Password: 123456 #Enter the vnc connection password
Verify: 123456 #Confirm vnc password
xauth: creating new authority file /home/ceboy/.Xauthority
New ‘localhost.localdomain:2 (ceboy)’ desktop is localhost.localdomain:2
Creating default startup script /home/ceboy/.vnc/xstartup
Starting applications specified in /home/ceboy/.vnc/xstartup
Log file is /home/ceboy/.vnc/localhost.localdomain:2.log
#Note here: each user can start his own VNC SERVER remote desktop, and each user can start multiple VNC SERVER remote desktops, they are identified by ip plus port number: ip:1, ip:2, ip:3, Differentiate, using the same port will automatically log out users who log in separately. In addition, most of the configuration files and log files of VNC SERVER are in the .vnc directory under the user's home directory.
The user can customize the activation number such as:
[ceboy@localhost /]$ vnc server :2 #Note: There must be a space before 2.
A VNC server is already running as :2
3. related desktop configuration, RedHat Linux supports two graphics modes: KDE mode and gnome mode.
1. What graphics mode your RH uses? Generally, you can only find out when you log in to the graphical interface to check, or list all currently running programs through the ps -A command, and see if there is KDE or gnome to judge.
If you are a gnome desktop, then you need to modify the configuration file of /root/.vnc/xstartup.
[root@localhost .vnc]# vi xstartup
#!/bin/sh
# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER #Remove the comment on this line
# exec /etc/X11/xinit/xinitrc #Remove the comment of this line
[-x /etc/vnc/xstartup] && exec /etc/vnc/xstartup
[-r $HOME/.Xresources] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80×24+10+10 -ls -title “$VNCDESKTOP Desktop” &
gnome-session gnome #Add this sentence to use the gnome desktop environment when connecting
twm &
It is best to restart the system once after setting modification, otherwise the setting will not take effect. The method I use is to kill the VNCSERVER process and re-run VNCSERVER.
[root@localhost .vnc]#vncserver -kill :1 #Here you need to correspond to the port number when you start vncserver.
[root@localhost .vnc]#vncserver :1 #Restart VNCSERVER, note that there must be a space before :1.
2. Set user information and resolution.
[root@localhost: ~]#vi /etc/sysconfig/vncservers
# The VNCSERVERS variable is a list of display:user pairs.
#
# Uncomment the lines below to start a VNC server on display :2
# as my ‘myusername’ (adjust this to your own). You will also
# need to set a VNC password; run ‘man vncpasswd’ to see how
# to do that.
#
# DO NOT RUN THIS SERVICE if your local area network is
# untrusted! For a secure way of using VNC, see
# <<A href="http://www.uk.research.att.com/archive/vnc/sshvnc.html">URL:http://www.uk.research.att.com/archive/vnc/ sshvnc.html >.
# Use “-nolisten tcp” to prevent X connections to your VNC server via TCP.
# Use “-nohttpd” to prevent web-based VNC clients connecting.
# Use “-localhost” to prevent remote VNC clients connecting except when
# doing so through a secure tunnel. See the “-via” option in the
# `man vncviewer’ manual page.
VNC SERVERS=”1:root 2:ceboy” #Add users here, generally only one 1:root will do.
VNC SERVERARGS[1]=”-geometry 800×600 -nolisten tcp -nohttpd -localhost”
VNC SERVERARGS[2]=”-geometry 1024×768 -nolisten tcp -nohttpd -localhost”
#Note: The above is the resolution of the two users root and ceboy respectively set. Note that they are distinguished by port numbers.
In addition, you can temporarily modify the resolution and color depth through the command line, which will be lost after restarting. It is not used here temporarily. The command is as follows:
[root@localhost: ~]#vnc server -geometry 800×600 #Set the resolution of vnc server
[root@localhost: ~]#vnc server -depth 16 #Set the color depth of vnc server
The VNC SERVER server configuration is now complete.
4. client connection and use.
1. Access method
a. Under linux, just run the vncviewer command, the server address is written like 192.168.1.11:1
b. Under windows, just run the windows version of vncviewer, the usage is similar to that under linux.
c. Use a browser (platform-independent) to implement as a java applet, and start it in the form of http://192.168.1.11:5801 (vnc port starts from 5800 and so on, usually 5800, 5900)
The following are some common sense:
2. Modify the password
Just run vncpasswd
3. Stop vncserver
#vncserver -kill :1
#vncserver -kill :2
Note that vncserver can only be shut down by the user who started it. Even root cannot shut down vncserver opened by other users. You can only use the kill command to violently kill the process.
4. Stability setting
By default, when multiple clients connect to the display port of the same vncserver, vncserver port the old connection and serves the new connection. You can use -dontdisconnect to reject the new connection request and keep the old connection.
5. The same monitor can be connected to multiple clients
#vncserver -alwaysshared
6. Restart the service
service vncserver restart
7. Let VNCSERVER start automatically when the system starts.
Use VNC connection to log in to the RedHat Linux graphical interface, click "System"-"Management"-"Server Settings"-"Services", find VNC SERVER in the "Background Service", check it, and click Save.
Ways to solve the problem of not being connected:
1. The firewall is turned on and cannot connect
Turn off the firewall service iptables stop
View firewall status service iptables status
View process ps axf | grep vnc/iptables