First, install the desktop environment. I chose xfce, lightweight desktop, which is small and practical and does not occupy too much memory (xfce <Kde, Kde <gnome ).
No xfce exists in the default centos source. First install the epel source and then install the desktop:
wget http://download.Fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm rpm -ivh epel-release-6-8.noarch.rpm yum groupinstall xfce
After the desktop is installed, the vncserver is installed. Now we know that the VNC in centos is tigervnc. Because it is a server, we only need to install tigervnc-Server:
yum install tigervnc-server
After the installation is complete, start the configuration. Now, take the root user as an example:
vi /etc/sysconfig/vncservers
Add at the end
VNCSERVERS="1:root "VNCSERVERARGS[1]="-geometry 800x600 -nolisten tcp"
Then, set the password for the vncserver:
vncpasswd
Start VNC service
vncserver
Modify configuration file
vi /root/.vnc/xstartup
Replace the content with the following:
#!/bin/sh/usr/bin/startxfce4
After saving, add the execution permission to xstartup:
chmod +x ~/.vnc/xstartup
After the configuration, restart the vncserver:
service vncserver restart
Run the following command to check whether port 5901 is Enabled:
netstat -lptn
Note that if the port is opened but cannot be connected, you must set firewall rules. Otherwise, the port 59xx cannot be connected.
Use VNC to remotely manage VPS (centos System)