Centos6.8 deploy vnc service

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

Centos6.8 deploy vnc service
CentOS 7 deploy saltstack service
Centos7.2 deployment vnc service record
Centos7.6 deploy django+nginx+uwsgi
CentOS 7 deploy OpenLDAP+FreeRadius
Deploy GitBook under CentOS7
CentOS 8 enable NTP service
CentOS 7 install Docker service
CentOS 6.8 deploy zookeeper cluster
Deploy JDK+Tomcat8 under CentOS
Deploy vuepress on centos7
Centos7 build DNS service
Deploy Jenkin on centos7
CentOS7.6 server deployment VNC
CentOs7.3 build Solr stand-alone service
CentOs7.3 build RabbitMQ 3.6 stand-alone service
CentOS 7.2 deploy Node.js development environment
Deploy front-end projects using centOS 7
CentOs7.3 build ZooKeeper-3.4.9 stand-alone service
CentOS 7.2 deploy mail server (Postfix)
CentOS7.7 deploy k8s (1 master + 2 node)
CentOs7.3 build SolrCloud cluster service
Centos 7 install jdk and package service service
CentOS7.7 deploy k8s (3 master + 3 node + 1 client)
CentOS 7 set up NTP, SSH service
CentOS7.7 deploy k8s + Prometheus (1 master + 2 node)
CentOS 8 (2)
Deploy and optimize Tomcat under Centos
CentOS 8 - install and configure NFS service
CentOS 8 (1)
CentOS 7 Tomcat service installation and configuration
CentOS 7.2 deploy website access log analyzer-Piwik
Build WeChat applet service based on CentOS
Build WeChat applet service based on CentOS
Create CentOS Docker image with httpd service
Connect Centos7 remotely via SSH and VNC
Deploy Docker and configure Nginx in CentOS
CentOS7 build gerrit code review service method