centos 7 安裝和配置vncserver

轉自http://blog.csdn.net/a105421548/article/details/38437639


這幾天公司培訓,有個前輩推薦試用下centos7,正好培訓之餘有點空閒時間和服務器一臺。就開始搗鼓的服務器。開始在服務器上安裝了centos 7.考慮到遠程桌面控制的需求就準備安裝vncserver。

安裝步驟:

       關閉防火牆,centos的防火牆是firewalld,關閉防火牆的命令systemctl stop firewalld.service 。關閉enforce,setenforce 0。

 1.安裝tigervncserver,yum install tigervnc-server tigervnc-server-module

 2.拷貝配置文件cp /lib/systemd/system/[email protected] /etc/systemd/system/vncserver@:1.service

 3.進入到配置文件目錄cd /etc/systemd/system

 4.修改配置文件vim vncserver@:1.service

配置文件內容爲:

[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target

[Service]
Type=forking
User=root
ExecStart=/usr/bin/vncserver :1 -geometry 1280x1024 -depth 16 -securitytypes=none -fp /usr/share/X11/fonts/misc
ExecStop=/usr/bin/vncserver -kill :1

[Install]
WantedBy=multi-user.target

 5.  啓用配置文件 systemctl enable vncserver@:1.service

 6. 設置登陸密碼:vncpasswd

 7. 啓動vncserver:systemctl start vncserver@:1.service

 8 . 啓動狀態查看:systemctl status vncserver@:1.service

 9.查看端口狀態:netstat -lnt | grep 590*

 10.查看報錯信息:grep vnc /var/log/messages



問題:樓主,按照你的方法,建好之後win7下VNC-Viewer打開遠程桌面是黑屏,樓主遇到過這種情況嗎

在xstartup文件中添加一行gnome-session & ,然後vncserver -kill :1,再啓動vncserver :1就可以了!


Linux VNC黑屏(轉)

如果遠程Linux的VNC桌面很久沒有輸入,那麼使用VNC View打開遠程linux桌面時,桌面顯示不出來,顯示一片黑屏,並且點擊鍵盤或者鼠標仍然毫無反應,仍然一片黑屏。
這時候需要在vnc server上設置一下。

編輯 /root/.vnc/xstartup 
[root@localhost ~]# vi /root/.vnc/xstartup   

去掉下面兩行的註釋: 
unset SESSION_MANAGER  
exec /etc/X11/xinit/xinitrc  
執行下面的命令重啓vnc server:
[root@localhost ~]# vncserver -kill :1  
[root@localhost ~]# vncserver :1 



如果是用Centos 7 默認防火牆的可能需要

[root@wic ~]# firewall-cmd --permanent --add-service vnc-server
[root@wic ~]# systemctl restart firewalld.service

第六步,設默認啓動並開啓VNC

[root@wic ~]# systemctl enable vncserver@:1.service
[root@wic ~]# systemctl start vncserver@:1.service


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章