CentOS 8 VNCServerのインストール

15551 ワード

CentOS 8 VNCServerのインストール
  • システム情報
  • VNCServer
  • をインストール
  • レプリケーションプロファイル
  • コピーされたプロファイルを編集する
  • オープンサービス
  • VNCServerが稼働しているかどうかをテストする
  • ファイアウォールを閉じるかポートを開く権限
  • その他
  • システム情報
    [root@centos8 ~]# cat /etc/redhat-release 
    CentOS Linux release 8.1.1911 (Core) 
    [root@centos8 ~]# 
    

    デスクトップ環境をインストールするには、デスクトップ環境がインストールされていない場合は、黒い画面に登録します.処理:1.インストールデスクトップ環境(yum install gnome*)2.VNCServerの再起動(systemctl restart vncserver@:1.service)
    VNCServerのインストール
    [root@centos8 ~]# yum install tigervnc-server
    CentOS-8 - AppStream                                                     5.6 kB/s | 4.3 kB     00:00    
    CentOS-8 - Base                                                          4.5 kB/s | 3.9 kB     00:00    
    CentOS-8 - Extras                                                        1.8 kB/s | 1.5 kB     00:00    
    Dependencies resolved.
    =========================================================================================================
     Package                     Architecture       Version                      Repository             Size
    =========================================================================================================
    Installing:
     tigervnc-server             x86_64             1.9.0-15.el8_1               AppStream             255 k
    
    Transaction Summary
    =========================================================================================================
    Install  1 Package
    
    Total download size: 255 k
    Installed size: 849 k
    Is this ok [y/N]: y
    Downloading Packages:
    tigervnc-server-1.9.0-15.el8_1.x86_64.rpm                                382 kB/s | 255 kB     00:00    
    ---------------------------------------------------------------------------------------------------------
    Total                                                                    119 kB/s | 255 kB     00:02     
    warning: /var/cache/dnf/AppStream-a520ed22b0a8a736/packages/tigervnc-server-1.9.0-15.el8_1.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 8483c65d: NOKEY
    CentOS-8 - AppStream                                                     949 kB/s | 1.6 kB     00:00    
    Importing GPG key 0x8483C65D:
     Userid     : "CentOS (CentOS Official Signing Key) "
     Fingerprint: 99DB 70FA E1D7 CE22 7FB6 4882 05B5 55B3 8483 C65D
     From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
    Is this ok [y/N]: y
    Key imported successfully
    Running transaction check
    Transaction check succeeded.
    Running transaction test
    Transaction test succeeded.
    Running transaction
      Preparing        :                                                                                 1/1 
      Installing       : tigervnc-server-1.9.0-15.el8_1.x86_64                                           1/1 
      Running scriptlet: tigervnc-server-1.9.0-15.el8_1.x86_64                                           1/1 
      Verifying        : tigervnc-server-1.9.0-15.el8_1.x86_64                                           1/1 
    
    Installed:
      tigervnc-server-1.9.0-15.el8_1.x86_64                                                                  
    
    Complete!
    [root@centos8 ~]# 
    

    プロファイルのコピー
    [root@centos8 ~]# cp /lib/systemd/system/[email protected] /etc/systemd/system/vncserver@:1.service
    [root@centos8 ~]# 
    

    コピーしたプロファイルの編集
    [root@centos8 ~]# vim /etc/systemd/system/vncserver@\:1.service
    [root@centos8 ~]# 
    
    #   
    ExecStart=/usr/bin/vncserver_wrapper <USER> %i
    
    #          (   root)
    
    #   
    ExecStart=/usr/bin/vncserver_wrapper root %i
    

    サービスを開始
    [root@centos8 ~]# systemctl daemon-reload
    [root@centos8 ~]# systemctl start vncserver@:1.service
    [root@centos8 ~]# vncserver
    
    You will require a password to access your desktops.
    
    Password:
    Verify:
    Would you like to enter a view-only password (y/n)? n
    A view-only password is not used
    
    New 'centos8:1 (root)' desktop is centos8:1
    
    Creating default startup script /root/.vnc/xstartup
    Creating default config /root/.vnc/config
    Starting applications specified in /root/.vnc/xstartup
    Log file is /root/.vnc/centos8:1.log
    
    [root@centos8 ~]#
    

    VNCServerが起動しているかどうかをテストします
    [root@centos8 ~]# nc -zv localhost 5901
    Ncat: Version 7.70 ( https://nmap.org/ncat )
    Ncat: Connected to ::1:5901.
    Ncat: 0 bytes sent, 0 bytes received in 0.01 seconds.
    [root@centos8 ~]# 
    

    ファイアウォールを閉じるか、ポート権限をオンにします.
    ファイアウォールを閉じる
    [root@centos8 ~]# systemctl status firewalld
    ● firewalld.service - firewalld - dynamic firewall daemon
       Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
       Active: active (running) since Sun 2020-06-21 22:40:18 CST; 14min ago
         Docs: man:firewalld(1)
     Main PID: 890 (firewalld)
        Tasks: 2 (limit: 11460)
       Memory: 29.7M
       CGroup: /system.slice/firewalld.service
               └─890 /usr/libexec/platform-python -s /usr/sbin/firewalld --nofork --nopid
    
    Jun 21 22:40:16 centos8 systemd[1]: Starting firewalld - dynamic firewall daemon...
    Jun 21 22:40:18 centos8 systemd[1]: Started firewalld - dynamic firewall daemon.
    [root@centos8 ~]# systemctl stop firewalld
    [root@centos8 ~]# 
    

    ポート権限を有効にします.permanentは永続的に有効です.このパラメータが再起動されないと無効になります.
    [root@centos8 ~]# firewall-cmd --zone=public --add-port=5901/tcp --permanent
    success
    [root@centos8 ~]# firewall-cmd --reload
    success
    [root@centos8 ~]# 
    

    その他
    親試験SELinuxは関係なく使用にも影響しない