VNC的安裝與配置

2021-09-07 01:48:22 字數 3808 閱讀 5633

一,安裝tigervnc-server vnc軟體包

[root@localhost ~]# yum install tigervnc-server

設定開機自啟動

[root@localhost ~]# chkconfig --level 35 vncserver on

檢視配置檔案所在位置

[root@localhost ~]# rpm -qc tigervnc-server

/etc/sysconfig/vncservers

二.目的:以vistor使用者啟動第乙個埠,即5901,以student使用者啟動第二個埠,即5902

[root@localhost ~]# vim /etc/sysconfig/vncservers

vncservers="1:visitor 2:student"

vncserverargs[1]="-geometry 1400x900 -nolisten tcp -localhost

vncserverargs[2]="-geometry 1400x900 -nolisten tcp -localhost

以vnc使用使用者登入系統,建立vnc密碼,vncpasswd

[root@localhost ~]# su - visitor

[visitor@localhost ~]$ vncpasswd

password: 輸入密碼

password must be at least 6 characters - try again

password: 再次輸入密碼

verify:

啟動服務一次,生成 /home/visitor/.vnc/xstartup

[visitor@localhost ~]$ vncserver 

new 'localhost.localdomain:1 (visitor)' desktop is localhost.localdomain:1

log file is /home/visitor/.vnc/localhost.localdomain:1.log

檢視已經開啟的vnc服務,關閉服務

[visitor@localhost ~]$ vncserver -list

tigervnc server sessions:

x display #     process id

:1              5567

[visitor@localhost ~]$ vncserver -kill :1

killing xvnc process id 5567

[visitor@localhost ~]$ exit

logout

[root@localhost ~]# su - student

[student@localhost ~]$ vncpasswd 

password:

verify:

[student@localhost ~]$ vncserver 

xauth:  creating new authority file /home/student/.xauthority

new 'localhost.localdomain:1 (student)' desktop is localhost.localdomain:1

creating default startup script /home/student/.vnc/xstartup

log file is /home/student/.vnc/localhost.localdomain:1.log

[student@localhost ~]$ vncserver -list

tigervnc server sessions:

x display #     process id

:1              8764

[student@localhost ~]$ vncserver -kill :1

killing xvnc process id 8764

[student@localhost ~]$ exit

logout

三,啟動服務

[root@localhost ~]# /etc/init.d/vncserver start

正在啟動 vnc 伺服器:1:visitor 

new 'localhost.localdomain:1 (visitor)' desktop is localhost.localdomain:1

log file is /home/visitor/.vnc/localhost.localdomain:1.log

2:student 

new 'localhost.localdomain:2 (student)' desktop is localhost.localdomain:2

log file is /home/student/.vnc/localhost.localdomain:2.log

[確定]

四.新增防火牆配置

[root@localhost ~]# vim /etc/sysconfig/iptables

-a input -m state --state new -m tcp -p tcp --dport 5901 -j accept

-a input -m state --state new -m tcp -p tcp --dport 5902 -j accept

[root@localhost ~]# service iptables restart

iptables: flushing firewall rules:                         [  ok  ]

iptables: setting chains to policy accept: filter          [  ok  ]

iptables: unloading modules:                               [  ok  ]

五.遠端訪問

六.使用安全的ssh進行連線

vnc 是明文的,不安全的.連線過程可能會被竊聽,干擾.可以使用ssh通道加密,然後再由遠端主機的回環位址通訊,加大了安全性.

[root@localhost ~]# vim /etc/sysconfig/vncservers

vncserverargs[1]="-localhost"

[11:30:18 talen@bjb0300 ~ ]$ vncviewer -via [email protected] localhost:1

這裡的localhost是遠端主機的回環位址,由遠端主機解析

七.生成密碼檔案,無輸入密碼登入

[root@localhost ~]# vncpasswd virtual

password:

verify:

[13:43:02 talen@bjb0300 study ]$ vncviewer -passwd ~/study/virtual -via [email protected] localhost:3

八.多使用者配置

vncservers="3:root 2:student"

vncserverargs[2]="-geometry 800x600 -localhost"

vncserverargs[3]="-geometry 1024x768 -localhost"

VNC的安裝和配置

服務端環境 centos 6.7 客戶端環境 windows 7 可以直接rpm安裝vnc的服務端 rpm ivh tigervnc server 1.1.0 16.el6.x86 64.rpm如果rpm安裝時發現有依賴,建議直接使用yum安裝,輕鬆解決依賴問題 yum install tigerv...

vnc安裝配置

root xcorder vncserver you will require a password to access your desktops.password verify xauth creating new authority file root xauthority new xcord...

VNC安裝配置

vncserver端安裝 1.yum或rpm安裝vncserver端 命令yum y install vnc server 或者rpm方式 rpm ivh vnc server 2.編輯配置檔案 vim etc sysconfig vncservers 新增兩行檔案 第一行 vncservers 2...