1)啟動(dòng)桌面1的服務(wù)
[root@testdb ~]# vncserver :1
New 'testdb:1 (root)' desktop is testdb:1
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/testdb:1.log
2)手工殺掉已經(jīng)啟動(dòng)的VNC服務(wù)進(jìn)程
[root@testdb ~]# ps -ef | grep -i vnc | grep -v grep
root 1178 1 0 11:07 pts/2 00:00:00 Xvnc :1 -desktop testdb:1 (root) -httpd /usr/share/vnc/classes -auth /root/.Xauthority -geometry 1024x768 -depth 16 -rfbwait 30000 -rfbauth /root/.vnc/passwd -rfbport 5901 -pn
root 1182 1 0 11:07 pts/2 00:00:00 vncconfig -iconic
[root@testdb ~]# kill -9 1178
3)確認(rèn)進(jìn)程已經(jīng)殺掉
[root@testdb ~]# ps -ef | grep -i vnc | grep -v grep
4)再次啟動(dòng)桌面1的VNC服務(wù),這里可以看到報(bào)錯(cuò)
[root@testdb ~]# vncserver :1
Warning: testdb:1 is taken because of /tmp/.X1-lock
Remove this file if there is no X server testdb:1
A VNC server is already running as :1
5)按照錯(cuò)誤提示的內(nèi)容列林,需要?jiǎng)h除/tmp/.X1-lock文件
[root@testdb ~]# rm -f /tmp/.X1-lock
啟動(dòng)嘗試栓撞,仍然報(bào)錯(cuò)
[root@testdb ~]# vncserver :1
Warning: testdb:1 is taken because of /tmp/.X11-unix/X1
Remove this file if there is no X server testdb:1
A VNC server is already running as :1
同樣昵时,按照提示的錯(cuò)誤尊搬,進(jìn)一步刪除/tmp/.X11-unix/X1文件
[root@testdb ~]# rm -f /tmp/.X11-unix/X1
再次啟動(dòng)嘗試,OK途样,啟動(dòng)成功江醇!
[root@testdb ~]# vncserver :1
New 'testdb:1 (root)' desktop is testdb:1
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/testdb:1.log
6)如果服務(wù)器異常關(guān)機(jī)很可能會(huì)出現(xiàn)5)的問題,根據(jù)提示刪除文件何暇,最后運(yùn)行命令開啟VNC服務(wù)
systemctl start vncserver@:1.service