查看是否安裝vnc
rpm -qa | grep vnc
centos安裝vnc
yum install vnc vnc-server
yum install tightvnc-server
去除端口防火牆
iptables -I INPUT -p tcp --dport 5901 -j ACCEPT
查看是否安裝Gnome桌面環境【vnc viewer連接黑屏可能沒安裝這個桌面環境】
yum grouplist
安裝Gnome桌面環境
yum groupinstall "GNOME Desktop"
新建桌面:1
vncserver :1
輸入vncserver :1后設置密碼
Password: 設置使用VNC連接服務器的密碼
Verify: 再次輸入一遍密碼
Would you like to enter a view-only password (y/n)? 選擇n,以使連接到服務器后可以操作服務器
其他命令:
設置VNC密碼
vncpasswd
查看vncserver的服務情況
vncserver -list
開啟編號為:1的桌面
vncserver :1
關閉編號為:1的vncserver
vncserver -kill :1
更新systemctl使配置生效
systemctl daemon-reload
客戶端黑屏 CentOS 執行:chmod 755 /root/.vnc/xstartup
卸載vnc軟件
yum remove tigervnc-server -y
刪除vnc下的配置
rm -rf /root/.vnc rm -rf /etc/.X11-unit rm -rf /etc/.X*-lock
win10 使用 vnc viewer 連接 linxu 的vnc server

在centos7桌面的下方會有Unencrypted connection表示root是加密的,可以不管。一樣可以進入桌面管理。。如果顯示Unencrypted connection但是桌面黑屏,可能是沒有安裝桌面環境 yum groupinstall "GNOME Desktop

