The full name of VNC is Virtual Network Computing, which belongs to remote control software. Its advantage is that it supports remote graphical control across operating systems.
In the daily operation and maintenance work, because the server is often placed in the computer room, it is impossible for us to go to the computer room every time we need a graphical interface operation, so vnc is a good alternative software.
The following records the operation of installing vnc in centos6 environment:
(1) Check whether vncserver has been installed on this machine
[ root@server ~]# rpm -qa|grep tigervnc
(2) Install vncserver
[ root@server ~]## yum -y install tigervnc-server
(3) Start and set vncserver password
When you start vncserver for the first time, you will be prompted for a password, and then you need to use the vncpasswd command
[ root@server ~]## vncserver
Password:
Verify:
(4) Modify the /root/.vnc/xstartup file
Because of the centos system we use here, the gnome desktop is installed
[ root@server ~]## sed -i 's/twm &/gnome-session &/' /root/.vnc/xstartup
(5) Modify the /etc/sysconfig/vncservers file
In this file, you can set the user who wants to run the VNC desktop and the screen resolution displayed when using vncview to connect. The 1 in VNCSERVERS means VNC runs as desktop 1. If you want to add other desktops, you can modify the configuration
[ root@server ~]## echo -e 'VNCSERVERS="1:root"
VNCSERVERARGS[1]="-geometry 1024x768"
' >> /etc/sysconfig/vncservers
(6) Set to boot up
[ root@server ~]## chkconfig --add vncserver
[ root@server ~]## chkconfig vncserver on
(7) Restart vncserver
[ root@server ~]## service vncserver restart
(8) Firewall port opening
[ root@server ~]## /sbin/iptables -I INPUT -p tcp --dport 5901 -j ACCEPT
[ root@server ~]## /etc/rc.d/init.d/iptables save
(9) Check the startup status
[ root@server ~]## netstat -tulnp
Note: If you access VNC through a VNC client, the port is 5901
(10) Other:
1 ): Modify VNC password
[ root@server ~]# vncpasswd
2 ) Stop the vnc server:
[ root@server ~]# vncserver -kill: desktop number
E.g
[ root@server ~]# vncserver -kill :1
Note: vncserver can only be closed by the user who started it, even root cannot close vncserver opened by other users, unless the process is killed by the kill command.
3 ) Setting the same display port can connect multiple clients
[ root@server ~]# vncserver -alwaysshared
Recommended Posts