自宅サーバー ≫ Linux Server ≫ CentOS Stream 8 ≫ VNCサーバー(tigervnc)

 
VNCサーバーの準備

CentOSのインストール時に “X Windows System”・“GNOME Desktop”・“Japanese Supportを選択していない場合は必要なソフトをインストール

なお、既に上記ソフトがインストール済の場合は VNCサーバーのインストール” へ

X Window System(GNOME デスクトップ環境 ) のインストール
 
 [root@centos]# dnf -y group install "Server with GUI"
 
Japanese Support のインストール
 
 [root@centos]# dnf -y install langpacks-ja glibc-langpack-ja.x86_64
 
VNCサーバーのインストール
 
 [root@centos]# dnf -y install tigervnc-server
 
パスワード設定
 
 [root@centos]# vncpasswd
 Password:********   <--- パスワード入力
 Verify:
********     <--- パスワード再入力
 Would you like to enter a view-only password (y/n)?
y or n
                                                    ↑--- y = 接続毎パスワード入力 n = パスワード無接続
 Password:
********   <--- パスワード入力   <--- y を入力した場合は接続用パスワードを入力                               
 Verify:
********     <--- パスワード再入力
 
VNCサーバーの起動
 
 [root@centos]#
vncserver :1
 
※上記で起動すると警告メッセージが表示される
  内容は“今後のリリース時はユニットシステムに置き換えられ、削除される。詳細については、/usr/share/doc/tigervnc/HOWTO.md をお読みください。”との事
現時点では問題なく起動する
なので一旦VNCサーバーを停止します
VNCサーバーの停止
 
 [root@centos]#
vncserver -kill :1
 
HOWTO.md に基づいて設定ファイル作成
config の設定
 
 [root@centos]#
vi ~/.vnc/config
 ## Supported server options to pass to vncserver upon invocation can be listed
 ## in this file. See the following manpages for more: vncserver(1) Xvnc(1).
 ## Several common ones are shown below. Uncomment and modify to your liking.
 ##
 # securitytypes=vncauth,tlsvnc
 # desktop=sandbox
 # geometry=2000x1200
 # localhost
 # alwaysshared
 
 
最終行に以下追記
 session=gnome                    <--- 使用するウィンドウシステム
 securitytypes=vncauth,tlsvnc    
<--- セキュリティタイプ
 desktop=sandbox                  <--- デスクトップタイプ
 geometry=
1024x768                <--- 表示解像度
 
vncserver.users の設定
 
 [root@centos]# vi /etc/tigervnc/vncserver.users
 # TigerVNC User assignment
 #
 # This file assigns users to specific VNC display numbers.
 # The syntax is <display>=<username>. E.g.:
 #
 # :2=andrew
 # :3=lisa
 
 
最終行に以下追記 接続するユーザー分だけ記述
 
:1=******    <--- :1 = ディスプレイ番号    ****** = ユーザー名 
 
:2=******    <--- :2 = ディスプレイ番号    ****** = ユーザー名 
 
デーモンのリロード
 
 [root@centos]# systemctl --system daemon-reload
 
VNCサーバーの起動
 
 [root@centos]# systemctl start vncserver@:1.service
 
VNCサーバーの自動起動設定
 
 [root@centos]#
systemctl enable vncserver@:1
 
VNC の自動起動確認
 
 [root@centos]#
systemctl is-enabled vncserver@:1
 enabled
    <--- enabled になっていればOK
 

戻る