ローカルホストで起動している VNC サーバーをプロキシして、クライアントコンピューターから Web ブラウザ経由で接続できるようにします。
# EPEL からインストール |
[root@localhost ~]# yum --enablerepo=epel -y install novnc python-websockify numpy |
[root@localhost ~]# cd /etc/pki/tls/certs |
[root@localhost certs]# openssl req -x509 -nodes -newkey rsa:2048 -keyout /etc/pki/tls/certs/novnc.pem -out /etc/pki/tls/certs/novnc.pem -days 365 |
Generating a 2048 bit RSA private key ..........................................+++ ..........................................+++ writing new private key to '/etc/pki/tls/certs/novnc.pem' ----- You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) [AU]:JP # 国 State or Province Name (full name) [Some-State]:Tokyo # 地域(県) Locality Name (eg, city) []:Hiroshima # 都市 Organization Name (eg, company) [Internet Widgits Pty Ltd]:Server World # 組織名 Organizational Unit Name (eg, section) []:IT Solution # 組織の部門名 Common Name (eg, YOUR name) []:hoge.com # サーバーのFQDN Email Address []:xxx@hoge.com # 管理者アドレス |
当例では、「cent」ユーザーがポート「5901」で VNC サーバーを起動しているとします。
VNC 起動ユーザーで Websockify を起動し、localhost:5901 をポート 6080 でプロキシします。
[hoge@localhost ~]$ websockify -D --web=/usr/share/novnc/ --cert=/etc/pki/tls/certs/novnc.pem 6080 localhost:5901 |
WebSocket server settings: - Listen on :6080 - Flash security policy server - Web server. Web root: /usr/share/novnc - SSL/TLS support - Backgrounding (daemon) |
任意のクライアントで Web ブラウザを起動し、「https://(サーバーのホスト名またはIPアドレス):6080/」にアクセスすると、以下のように noVNC の画面が表示されます。 VNC パスワードでログイン可能です。
接続できました。Web ブラウザ上で CentOS の操作ができます。