用户工具

站点工具


linux:vnc

差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

两侧同时换到之前的修订记录前一修订版
后一修订版
前一修订版
linux:vnc [2021/07/06 20:54] – [2.3 realvnc默认分辨率修改] zhangguolinux:vnc [2026/10/15 21:29] (当前版本) – 外部编辑 127.0.0.1
行 1: 行 1:
-===== - VNC =====+## - VNC
 这里主要讨论vncserver服务,它是支持多种的vncviewer软件接入的。 这里主要讨论vncserver服务,它是支持多种的vncviewer软件接入的。
  
行 19: 行 19:
  
  
-==== - VNC建立vncserver服务 ==== +### - VNC建立vncserver服务 
-一般情况下,是采用如下命令来建立vncserver服务:\\ +一般情况下,是采用如下命令来建立vncserver服务:\ 
-<code>vncserver -geometry 1900x980 :1</code>+ 
 +``` 
 +vncserver -geometry 1900x980 :1 
 +``` 
 :1是port号, 可以根据实际情况进行修改,如果有人已经占住该端口号,那么就需要更换一个端口号。不指定的话,系统会自动分配一个port号 :1是port号, 可以根据实际情况进行修改,如果有人已经占住该端口号,那么就需要更换一个端口号。不指定的话,系统会自动分配一个port号
  
行 28: 行 32:
 如果需要建立多个vncserver服务的话,那么就需要执行多次上述的命令。 如果需要建立多个vncserver服务的话,那么就需要执行多次上述的命令。
  
-==== - 设置防火墙 ==== +### - 设置防火墙 
-=== - CentOS 6 === +#### - CentOS 6
 vncserver默认从端口开始5900,需要设置防火墙开放相应端口或者是关闭防火墙 vncserver默认从端口开始5900,需要设置防火墙开放相应端口或者是关闭防火墙
-<code bash>+ 
 +```bash
 [root@ayls-s3 init.d]# vi /etc/sysconfig/iptables [root@ayls-s3 init.d]# vi /etc/sysconfig/iptables
 # Firewall configuration written by system-config-firewall # Firewall configuration written by system-config-firewall
行 48: 行 52:
 COMMIT COMMIT
 [root@ayls-s3 init.d]#  /etc/init.d/iptables  restart [root@ayls-s3 init.d]#  /etc/init.d/iptables  restart
-</code>+```
  
  
  
  
-===== - REALVNC ===== 
  
 +## - REALVNC
 注意: realvnc在CentOS6上可以正常使用,在CentOS7上桌面没有任务栏,导致基本无法使用。 注意: realvnc在CentOS6上可以正常使用,在CentOS7上桌面没有任务栏,导致基本无法使用。
  
-==== - REALVNC server开机启动 ====+### - REALVNC server开机启动
 realvnc方式跟tigervnc不一样,realvnc支持 server mode, user mode, vitual mode。 realvnc方式跟tigervnc不一样,realvnc支持 server mode, user mode, vitual mode。
-^  mode          ^ 描述                                                       ^ + 
-|  server mode   | 远端机与受控主机看到的是同一个桌面,类比如向日葵,teamview之类的远程桌面。            | +| mode | 描述 | 
-|  user mode     | 跟上面类似,商业版才有                                              | +| --- | --- | 
-|  virtual mode  | 类似于建立vncserver服务,是虚拟出来的画面,就像vncserver :1这样方式建立的服务,商业版才有  |+| server mode | 远端机与受控主机看到的是同一个桌面,类比如向日葵,teamview之类的远程桌面。 | 
 +| user mode | 跟上面类似,商业版才有 | 
 +| virtual mode | 类似于建立vncserver服务,是虚拟出来的画面,就像vncserver :1这样方式建立的服务,商业版才有 |
  
  
行 70: 行 76:
  
 CentOS6配置: CentOS6配置:
-<code bash>+ 
 +```bash
 # 开启服务  # 开启服务 
 /etc/init.d/vncserver-x11-serviced   start /etc/init.d/vncserver-x11-serviced   start
行 78: 行 85:
 chkconfig   vncserver-x11-serviced   on  chkconfig   vncserver-x11-serviced   on 
 chkconfig   vncserver-virtuald   on chkconfig   vncserver-virtuald   on
-</code>+``` 
  
  
 CentOS7配置: CentOS7配置:
-<code bash>+ 
 +```bash
 # 开机启动 # 开机启动
 systemctl enable vncserver-virtuald.service systemctl enable vncserver-virtuald.service
行 89: 行 98:
 # 查看状态 # 查看状态
 systemctl status vncserver-virtuald.service systemctl status vncserver-virtuald.service
-</code> +```
  
-==== - REALVNC CONFIG ==== 
  
  
 +### - REALVNC CONFIG
 VNC configuration files VNC configuration files
  
行 110: 行 118:
     -Policy VNC configuration files     -Policy VNC configuration files
  
-注释:\\  +注释:\ 
-  -<color #ed1c24>system-wide VNC Server configuration file (for example /etc/vnc/config.d/common.custom)</color> +  -<span style="color:#ed1c24">system-wide VNC Server configuration file (for example /etc/vnc/config.d/common.custom)</span> 
-  -<color #ed1c24>Per-user vnc config file是指用户目录~/.vnc/里面的配置文件</color> +  -<span style="color:#ed1c24">Per-user vnc config file是指用户目录~/.vnc/里面的配置文件</span> 
-  -<color #ed1c24>command line options, 是指加在vnc命令上的参数,比如vncserver命令</color> +  -<span style="color:#ed1c24">command line options, 是指加在vnc命令上的参数,比如vncserver命令</span> 
-  -<color #ed1c24>policy files to the /etc/vnc/policy.d directory</color>+  -<span style="color:#ed1c24">policy files to the /etc/vnc/policy.d directory</span>
  
 This means that a particular parameter specified at the command line overrides the same parameter specified in a per-user or in a system-wide VNC configuration file, but is itself overridden by the same parameter specified in a policy VNC configuration file. Policy cannot be changed by users. This means that a particular parameter specified at the command line overrides the same parameter specified in a per-user or in a system-wide VNC configuration file, but is itself overridden by the same parameter specified in a policy VNC configuration file. Policy cannot be changed by users.
行 126: 行 134:
  
  
-^ Process         ^ Policy template file  ^ Contains parameters for...                                       ^ Notes                                     ^ 
-| core            | Xvnc                  | Connectivity, security, locale, performance, logging, and more.  |                                           | 
-| User interface  | vncserverui-virtual   | Locale, file transfer, and chat.                                 |                                           | 
-| Daemon          | vncserver-virtuald    | Connectivity, security, logging.                                 |  Performance controlled per-user by Xvnc. | 
  
 +| Process | Policy template file | Contains parameters for... | Notes |
 +| --- | --- | --- | --- |
 +| core | Xvnc | Connectivity, security, locale, performance, logging, and more. | |
 +| User interface | vncserverui-virtual | Locale, file transfer, and chat. | |
 +| Daemon | vncserver-virtuald | Connectivity, security, logging. | Performance controlled per-user by Xvnc. |
  
-==== - realvnc默认分辨率修改 ====+ 
 +### - realvnc默认分辨率修改
 参考网页:https://mlog.club/article/4538833 参考网页:https://mlog.club/article/4538833
  
 vnc virtual mode的默认分辨率是1024x768, 很多时候需要定制默认分辨率,方法如下: vnc virtual mode的默认分辨率是1024x768, 很多时候需要定制默认分辨率,方法如下:
  
-创建文件''/etc/vnc/config.custom'',文件内容如下: +创建文件`/etc/vnc/config.custom`,文件内容如下: 
-<code>+ 
 +```
 -geometry 1366x768 -geometry 1366x768
  
 # 联想小新pad Pro 2021更适合 1280x768分辨率。 # 联想小新pad Pro 2021更适合 1280x768分辨率。
-</code>+```
  
  
-That requires passing a geometry parameter on the commandline, of course. RealVNC also supports configuration of the VNC service through various configuration files. However, confusingly, config for "Xvnc" (the underlying RealVNC server used on UNIX systems that communicates with X, and which needs to take the geometry config parameter) has to go in a different location from the "normal" RealVNC config files; either ''/etc/vnc/config.custom'' for server-wide settings, or ''~/.vnc/config'' for user-specific settings. These are wholly separate from the other RealVNC config files and finding this out was pretty tough. As I said, the docs on this are terrible. So, in order to not have to specify resolution at the commandline, create the file ''/etc/vnc/config.custom'' and give it the following contents: 
  
-''-geometry 1280x1024''+That requires passing a geometry parameter on the commandline, of course. RealVNC also supports configuration of the VNC service through various configuration files. However, confusingly, config for "Xvnc" (the underlying RealVNC server used on UNIX systems that communicates with X, and which needs to take the geometry config parameter) has to go in a different location from the "normal" RealVNC config files; either `/etc/vnc/config.custom` for server-wide settings, or `~/.vnc/config` for user-specific settings. These are wholly separate from the other RealVNC config files and finding this out was pretty tough. As I said, the docs on this are terrible. So, in order to not have to specify resolution at the commandline, create the file `/etc/vnc/config.custom` and give it the following contents:
  
 +`-geometry 1280x1024`
  
-==== - centos7安装信息 ==== 
  
 +### - centos7安装信息
  
-<code bash>+```bash
 NOTICE: common configuration in /etc/pam.d contains the following modules: NOTICE: common configuration in /etc/pam.d contains the following modules:
    pam_faildelay.so    pam_faildelay.so
行 179: 行 190:
 For VNC Server in Virtual Mode daemon: For VNC Server in Virtual Mode daemon:
   firewall-cmd --zone=public --permanent --add-service=vncserver-virtuald   firewall-cmd --zone=public --permanent --add-service=vncserver-virtuald
 +```
  
-</code> +### - REALVNC 下载
-==== - REALVNC 下载 ==== +
 一、软件下载(VNC-Server-6.2.0-Linux-x64.rpm) 一、软件下载(VNC-Server-6.2.0-Linux-x64.rpm)
  
行 189: 行 199:
  
 四、安装序列号 四、安装序列号
-<code>+ 
 +```
 /usr/bin/vnclicense -add VKUPN-MTHHC-UDHGS-UWD76-6N36A /usr/bin/vnclicense -add VKUPN-MTHHC-UDHGS-UWD76-6N36A
 69NCN-JRLBC-QD28Y-5KLY2-UEE6A 69NCN-JRLBC-QD28Y-5KLY2-UEE6A
行 196: 行 207:
 6XQQQ-WXL4Q-NN4KX-NUTC6-8ZK6A 6XQQQ-WXL4Q-NN4KX-NUTC6-8ZK6A
 PGUFQ-HTZBB-WNHU7-YHDQC-A7R6A PGUFQ-HTZBB-WNHU7-YHDQC-A7R6A
-</code>+```
  
  
  
-===== - tigervnc On CentOS 6 ===== 
  
-==== - tigervnc server开机批量启动 ==== +## - tigervnc On CentOS 6 
-需要软件tigervnc,直接yum安装即可, ''yum install -y tigervnc*''+### - tigervnc server开机批量启动 
 +需要软件tigervnc,直接yum安装即可, `yum install -y tigervnc*`
  
-=== - 设置开机启动 === +#### - 设置开机启动
-<code>chkconfig vncserver on</code>+
  
-=== - 重启服务 === +``` 
-<code>service vncserver restart</code>+chkconfig vncserver on 
 +```
  
-=== - 多用户 === + 
-编辑文件,vi /etc/sysconfig/vncservers \\ +#### - 重启服务 
 + 
 +``` 
 +service vncserver restart 
 +``` 
 + 
 + 
 +#### - 多用户 
 +编辑文件,vi /etc/sysconfig/vncservers\
 如果是单用户: 如果是单用户:
-<code>+ 
 +```
 VNCSERVERS="1:user1" VNCSERVERS="1:user1"
 VNCSERVERARGS[1]="-geometry 800x600" VNCSERVERARGS[1]="-geometry 800x600"
-</code>+``` 
 如果是多用户: 如果是多用户:
-<code>+ 
 +```
 VNCSERVERS="1:user1 2:user2 3:user3" VNCSERVERS="1:user1 2:user2 3:user3"
 VNCSERVERARGS[1]="-geometry 800x600" VNCSERVERARGS[1]="-geometry 800x600"
 VNCSERVERARGS[2]="-geometry 800x600" VNCSERVERARGS[2]="-geometry 800x600"
 VNCSERVERARGS[3]="-geometry 800x600" VNCSERVERARGS[3]="-geometry 800x600"
-</code>+``` 
 以此类推 以此类推
  
  
 默认情况下,1:user1对应5901,2:user2对应5902(VNC的默认监听端口是5900,监听端口规则为590+usernumber),如下 默认情况下,1:user1对应5901,2:user2对应5902(VNC的默认监听端口是5900,监听端口规则为590+usernumber),如下
-<code>VNCSERVERS="usernumber:myusername"</code>+ 
 +``` 
 +VNCSERVERS="usernumber:myusername" 
 +``` 
 #下面这项配置为登录桌面配置,其中的“1”为用户序号,800x600为分辨率,-nolisten tcp为阻止tcp包,-localhost代表只监听本地, #下面这项配置为登录桌面配置,其中的“1”为用户序号,800x600为分辨率,-nolisten tcp为阻止tcp包,-localhost代表只监听本地,
-<code>VNCSERVERARGS[1]="-geometry 800x600 -nolisten tcp -localhost"</code>+ 
 +``` 
 +VNCSERVERARGS[1]="-geometry 800x600 -nolisten tcp -localhost" 
 +``` 
 如果想阻止http包,可以使用如下配置 如果想阻止http包,可以使用如下配置
-<code>VNCSERVERARGS[1]="-geometry 800x600 -nolisten tcp -nohttpd -localhost"</code> 
  
-按照上述操作,在每次机器开机时,都会自动开启多个vncserver服务,直接使用vncviewer连接即可。+``` 
 +VNCSERVERARGS[1]="-geometry 800x600 -nolisten tcp -nohttpd -localhost" 
 +```
  
-===== - tigervnc on CentOS7 ===== 
  
 +按照上述操作,在每次机器开机时,都会自动开启多个vncserver服务,直接使用vncviewer连接即可。
 +
 +## - tigervnc on CentOS7
 https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-vnc-remote-access-for-the-gnome-desktop-on-centos-7 https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-vnc-remote-access-for-the-gnome-desktop-on-centos-7
  
 亲测tigervnc在centos7上使用没有问题。 亲测tigervnc在centos7上使用没有问题。
-==== - tigervnc在centos7的安装  ==== +### - tigervnc在centos7的安装
   - 卸载其它类弄的vnc,说白了,就是如果有装realvnc,就需要先把它给卸载掉。   - 卸载其它类弄的vnc,说白了,就是如果有装realvnc,就需要先把它给卸载掉。
-  - 安装tigervnc,    ''yum install -y tigervnc*''+  - 安装tigervnc,    `yum install -y tigervnc*` 
 + 
 +### - 配置
  
-==== - 配置 ==== +```bash
-<code bash>+
 cp /usr/lib/systemd/system/vncserver@.service  /usr/lib/systemd/system/vncserver@:1.service cp /usr/lib/systemd/system/vncserver@.service  /usr/lib/systemd/system/vncserver@:1.service
 # 修改vncserver@:1.service文件,把其中的<USER>替换成具体的linux某个用户名,比如zhangsan # 修改vncserver@:1.service文件,把其中的<USER>替换成具体的linux某个用户名,比如zhangsan
行 296: 行 330:
  
 #然后reboot机器,等机器启动好后,用vnc viewer连接,就应该会看到设置好的GUI界面,从而不能再手动地创建vncserver桌面。 #然后reboot机器,等机器启动好后,用vnc viewer连接,就应该会看到设置好的GUI界面,从而不能再手动地创建vncserver桌面。
-</code>+```
  
  
-==== - 问题debug ====+ 
 +### - 问题debug
 systemctl start vncserver@:4.service有概率启动不成功的问题,此处只是用:4端口举例,其它端口也会出现类似的情况。 systemctl start vncserver@:4.service有概率启动不成功的问题,此处只是用:4端口举例,其它端口也会出现类似的情况。
  
 If you kill your vncserver or unexpected dead, Please read /var/log/messages and you can find .X started files with errors like below. If you kill your vncserver or unexpected dead, Please read /var/log/messages and you can find .X started files with errors like below.
 At first, please verify Xvnc process not running. At first, please verify Xvnc process not running.
-<code>+ 
 +```
 Dec 15 14:11:11 www runuser: Warning: www.example.com:4 is taken because of /tmp/.X4-lock Dec 15 14:11:11 www runuser: Warning: www.example.com:4 is taken because of /tmp/.X4-lock
 ... ...
 Dec 15 14:12:52 www runuser: Warning: www.example.com:4 is taken because of /tmp/.X11-unix/X4 Dec 15 14:12:52 www runuser: Warning: www.example.com:4 is taken because of /tmp/.X11-unix/X4
-</code>+``` 
  
 then you remove then you remove
-<code>+ 
 +```
 # rm -f /tmp/.X4-lock # rm -f /tmp/.X4-lock
 # rm -f /tmp/.X11-unix/X4 # rm -f /tmp/.X11-unix/X4
-</code>+``` 
  
 and restart your vncserver. and restart your vncserver.
-<code>+ 
 +```
 # systemctl restart vncserver@:4.sevice # systemctl restart vncserver@:4.sevice
-</code>+``` 
  
  
行 333: 行 374:
  
  
-===== - 其它远程软件 =====+## - vnc viewer软件下载 
 +https://www.realvnc.com/en/connect/download/viewer/windows/ 
 + 
 + 
 + 
 +## - 其它远程软件
   * https://www.nomachine.com/nomachine-enterprise-features   * https://www.nomachine.com/nomachine-enterprise-features
 +  * https://www.nomachine.com/comparison-terminal-server-products
 +
 +https://download.csdn.net/download/u013244517/12793900
 +
 +https://download.csdn.net/download/hitzhu2000/12747760?utm_source=iteye_new
  
  
行 359: 行 410:
  
  
-{{:linux:pasted:20210622-174327.png}}+![:linux:pasted:20210622-174327.png](:linux:pasted:20210622-174327.png)
linux/vnc.1625576088.txt.gz · 最后更改: (外部编辑)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki