用户工具

站点工具


linux:vnc

差别

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

到此差别页面的链接

两侧同时换到之前的修订记录前一修订版
后一修订版
前一修订版
linux:vnc [2026/10/13 22:10] – 外部编辑 127.0.0.1linux:vnc [2026/10/15 21:29] (当前版本) – 外部编辑 127.0.0.1
行 20: 行 20:
  
 ### - VNC建立vncserver服务 ### - VNC建立vncserver服务
-一般情况下,是采用如下命令来建立vncserver服务:\\ +一般情况下,是采用如下命令来建立vncserver服务:\ 
-<code>vncserver -geometry 1900x980 :1</code>+ 
 +``` 
 +vncserver -geometry 1900x980 :1 
 +``` 
 :1是port号, 可以根据实际情况进行修改,如果有人已经占住该端口号,那么就需要更换一个端口号。不指定的话,系统会自动分配一个port号 :1是port号, 可以根据实际情况进行修改,如果有人已经占住该端口号,那么就需要更换一个端口号。不指定的话,系统会自动分配一个port号
  
行 31: 行 35:
 #### - 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
行 47: 行 52:
 COMMIT COMMIT
 [root@ayls-s3 init.d]#  /etc/init.d/iptables  restart [root@ayls-s3 init.d]#  /etc/init.d/iptables  restart
-</code>+``` 
  
  
行 57: 行 63:
 ### - 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这样方式建立的服务,商业版才有 |
  
  
行 68: 行 76:
  
 CentOS6配置: CentOS6配置:
-<code bash>+ 
 +```bash
 # 开启服务  # 开启服务 
 /etc/init.d/vncserver-x11-serviced   start /etc/init.d/vncserver-x11-serviced   start
行 76: 行 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
行 87: 行 98:
 # 查看状态 # 查看状态
 systemctl status vncserver-virtuald.service systemctl status vncserver-virtuald.service
-</code>+``` 
  
  
行 106: 行 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.
行 122: 行 134:
  
  
-^ Process         ^ Policy template file  ^ Contains parameters for...                                       ^ Notes                                     ^ + 
-| core            | Xvnc                  | Connectivity, security, locale, performance, logging, and more.  |                                           | +| Process | Policy template file | Contains parameters for... | Notes | 
-| User interface  | vncserverui-virtual   | Locale, file transfer, and chat.                                 |                                           | +| --- | --- | --- | --- | 
-| Daemon          | vncserver-virtuald    | Connectivity, security, logging.                                 |  Performance controlled per-user by Xvnc. |+| 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. |
  
  
行 134: 行 148:
  
 创建文件`/etc/vnc/config.custom`,文件内容如下: 创建文件`/etc/vnc/config.custom`,文件内容如下:
-<code>+ 
 +```
 -geometry 1366x768 -geometry 1366x768
  
 # 联想小新pad Pro 2021更适合 1280x768分辨率。 # 联想小新pad Pro 2021更适合 1280x768分辨率。
-</code>+``` 
  
  
行 147: 行 163:
  
 ### - 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
行 173: 行 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)
行 182: 行 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
行 189: 行 207:
 6XQQQ-WXL4Q-NN4KX-NUTC6-8ZK6A 6XQQQ-WXL4Q-NN4KX-NUTC6-8ZK6A
 PGUFQ-HTZBB-WNHU7-YHDQC-A7R6A PGUFQ-HTZBB-WNHU7-YHDQC-A7R6A
-</code>+``` 
  
  
行 198: 行 217:
  
 #### - 设置开机启动 #### - 设置开机启动
-<code>chkconfig vncserver on</code>+ 
 +``` 
 +chkconfig vncserver on 
 +``` 
  
 #### - 重启服务 #### - 重启服务
-<code>service vncserver restart</code>+ 
 +``` 
 +service vncserver restart 
 +``` 
  
 #### - 多用户 #### - 多用户
-编辑文件,vi /etc/sysconfig/vncservers \\ +编辑文件,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>+ 
 +``` 
 +VNCSERVERARGS[1]="-geometry 800x600 -nolisten tcp -nohttpd -localhost" 
 +``` 
  
 按照上述操作,在每次机器开机时,都会自动开启多个vncserver服务,直接使用vncviewer连接即可。 按照上述操作,在每次机器开机时,都会自动开启多个vncserver服务,直接使用vncviewer连接即可。
行 238: 行 281:
  
 ### - 配置 ### - 配置
-<code bash>+ 
 +```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
行 286: 行 330:
  
 #然后reboot机器,等机器启动好后,用vnc viewer连接,就应该会看到设置好的GUI界面,从而不能再手动地创建vncserver桌面。 #然后reboot机器,等机器启动好后,用vnc viewer连接,就应该会看到设置好的GUI界面,从而不能再手动地创建vncserver桌面。
-</code>+``` 
  
  
行 294: 行 339:
 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>+``` 
  
  
linux/vnc.1791900622.txt.gz · 最后更改: 由 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki