Centos 7系統配置安裝VNC環境教程

來源:互聯網
上載者:User

首先試試伺服器裝了VNC沒

[root@wic ~]# rpm -q tigervnc tigervnc-server

沒安裝的話會直接出現

package tigervnc is not installed
package tigervnc-server is not installed

如果沒有安裝X-Windows 案頭的話要先安裝Xwindows

[root@wic ~]# yum check-update
[root@wic ~]# yum groupinstall "X Window System"
[root@wic ~]# yum install gnome-classic-session gnome-terminal nautilus-open-terminal control-center liberation-mono-fonts
[root@wic ~]# unlink /etc/systemd/system/default.target
[root@wic ~]# ln -sf /lib/systemd/system/graphical.target /etc/systemd/system/default.target
[root@wic ~]# reboot

第一步,安裝VNC packages:

[root@wic ~]# yum install tigervnc-server -y

第二步,修改配置資訊,在/etc/systemd/system/下建立檔案夾vncserver@:1.service 把example config 檔案從/lib/systemd/system/vncserver@.service複製到裡面

[root@wic ~]# cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service
然後開啟這個設定檔/etc/systemd/system/vncserver@:1.service替換掉預設使用者名
找到這一行

ExecStart=/sbin/runuser -l <USER> -c "/usr/bin/vncserver %i"
PIDFile=/home/<USER>/.vnc/%H%i.pid
這裡我直接用root 使用者登入,所以我替換成
ExecStart=/sbin/runuser -l root -c "/usr/bin/vncserver %i"
PIDFile=/root/.vnc/%H%i.pid

如果是其他使用者的話比如john替換如下

ExecStart=/sbin/runuser -l <USER> -c "/usr/bin/vncserver %i"
PIDFile=/home/<USER>/.vnc/%H%i.pid

第三步,重載入 systemd

[root@wic ~]# systemctl daemon-reload
第四步,為VNC設密碼
[root@wic ~]# vncpasswd

第五步,由於我這邊的Centos 7 是用iptable防火牆的所以

vim /etc/sysconfig/iptables

在合適位置加上

-A INPUT -m state --state NEW -m tcp -p tcp --dport 5900:5903 -j ACCEPT

重啟iptable

service iptables restart

如果是用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

這樣基本上Centos 端就設好了,Windows 端要去下一個VNC Viewer 的軟體。串連一下試試看著有點簡陋但是上去了的

 


相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.