Install packages (with Yum source installed, do not install with source code)
Yum Install VNC vnc-server
After the installation is successful, the configuration is as follows:
[[Email protected] ~]# vncserver #设置 vnc password, input: (Enter the user under a user is it, if the su imiss switch to Imiss user, the input vncserver is another desktop, the same to set the password, The password to be set under this user will be required for Vncserver to be launched under this account. You'll require a password to access your desktops. Password:password must is at least6Characters-try againPassword:Verify:xauth:creating new Authorityfile/root/. Xauthoritynew'localhost.localdomain:1 (Root)'Desktop is Localhost.localdomain:1Creating default startup script/root/.vnc/xstartupstarting Applications specifiedinch/root/.vnc/XstartuplogfileIs/root/.vnc/localhost.localdomain:1. Log[[email protected]~]# vncpasswd Password:password must be at least6Characters-try Againpassword:verify:[[email protected]~]#
To modify a configuration file:
Vim ~/.vnc/xstartup (last two lines)
#xterm-geometry 80x24+ten- ls"$VNCDESKTOP Desktop" &&Gnome-session &
Vim/etc/sysconfig/vncservers (last two lines)
# vncservers="2:myusername"# vncserverargs[2]="- Geometry 800x600-nolisten tcp-localhost" vncservers="1:root" vncserverargs[1]="-geometry 800x600"
Vi/etc/sysconfig/iptables (Configure firewall)
5901 -J Accept5902 -J Accept5903 -j Accept
#VNC the server listens on the port starting from 5900, Display:1 listens 5901,display:2 listens 5902, and so on. The CentOS firewall default is not allowed to connect these ports, so you need to use the following steps to open the firewall (requires root permission):
[Email protected] ~]# service iptables restartiptables:setting chains to policy Accept:nat mangle filte[ok
]iptables:flushing firewall rules: [ OK ]iptables:unloading modules: [ OK ]iptables: Applying firewall rules: [ OK ]
Start the service
[[Email protected] ~~2'localhost.localdomain:2 (root)' Desktop is localhost.localdomain:2 in/root/.vnc/file is/root /.vnc/localhost.localdomain:2. Log [ OK ~]#
Turn off VNC
Vncserver-Kill :2#注意kill后面要有一个空格
Connection
CentOS Open VNC