CenOS7.1安裝VNC——讓win7遠端桌面linux

來源:互聯網
上載者:User

標籤:

參考:http://wic.xingning.gov.cn/blog/29

        https://linux.cn/article-5335-1.html

1、檢查是否安裝VNC,

rpm -q tigervnc tigervnc-server

2、安裝X-Window

yum check-updateyum groupinstall "X Window System"yum install gnome-classic-session gnome-terminal nautilus-open-terminal control-center liberation-mono-fontsunlink /etc/systemd/system/default.targetln -sf /lib/systemd/system/graphical.target /etc/systemd/system/default.targetreboot #重啟機器

3、安裝VNC

yum install tigervnc-server -y

4、從VNC備份庫中複製service檔案到系統service服務管理目錄下【原文這裡存在錯誤,不是建立[email protected]:1.service檔案夾】

 cp /lib/systemd/system/[email protected] /etc/systemd/system/[email protected]:1.service #複製並被重新命名為[email protected]:1.service

5、修改[email protected]:1.service檔案

#進入/etc/systemd/system目錄
cd /etc/systemd/system
#編輯設定檔
vim [email protected]:
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
#如果不是root使用者 PIDFile=/home/anjos/.vnc/%H%i.pid

6、重新載入 systemd

#由於在systemd中添加了東東,得讓系統重新載入systemctl daemon-reload

7、為[email protected]:1.service設定密碼

    vncpasswd

8、關閉防火牆

    CentoS7預設採用新防火牆firewall,不在用iptables

   [使用firewall] 

                     firewall-cmd --permanent --add-service vnc-server#添加存取權限

                     systemctl restart firewalld.service#重啟firewalld

        #systemctl stop firewalld.service #停止firewall(start,啟動)

                     #systemctl disable firewalld.service #設定開機禁止firewall(enable 開機啟動)

   [使用iptables]

                     yum -y install iptables-services#安裝iptables

                     vi /etc/sysconfig/iptables#修改iptables防火規則,在合適的位置加上如下一句

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

        systemctl restart iptables.service #重啟防火牆使配置生效-----systemctl status iptables.service#查看狀態

        systemctl stop iptables.service #啟動iptables(start)

        systemctl disable iptables.service #禁止防火牆開機啟動(enable)#設定防火牆開機啟動

   [注意]安裝iptables後可以使用

    service iptables status#查看防火牆狀態

    service iptables stop#關閉防火牆

    chkconfig iptables --list#查看防火牆開機啟動狀態

    chkconfig iptables off#關閉防火牆開機啟動

9、啟動VNC服務(設定開機啟動)

systemctl enable [email protected]:1.servicesystemctl start [email protected]:1.service

10、在win7上下載VNC Viewer

     :http://www.realvnc.com/download/viewer/

     下載後,直接雙擊exe即可

11、訪問

       使用你的ip加上一個1即可

      

      

      

    

    

 

CenOS7.1安裝VNC——讓win7遠端桌面linux

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.