vnc 字体设置_安装和配置VNC

本文详细介绍了如何在CentOS上安装和配置VNC服务器,包括安装步骤、配置VNC服务器、设置密码、修改防火墙规则以及解决字体错误问题。此外,还提供了VNC服务的启动、停止和重启命令以及下载链接。
摘要由CSDN通过智能技术生成

1 安装vnc

# yum install -y  tigervnc-server tigervnc-server-module libXfont pixman xterm xorg-x11-twm安装vnc及字体库

# chkconfig  vncserver on      设置开机自动启动

2 VNC配置

修改 /etc/sysconfig/vncservers 文件,添加以下内容

# The VNCSERVERS variable is a list of display:user pairs.

#

# Uncomment the lines below to start a VNC server on display :2

# as my 'myusername' (adjust this to your own).  You will also

# need to set a VNC password; run 'man vncpasswd' to see how

# to do that.

#

# DO NOT RUN THIS SERVICE if your local area network is

# untrusted!  For a secure way of using VNC, see this URL:

# http://kbase.redhat.com/faq/docs/DOC-7028

# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.

# Use "-localhost" to prevent remote VNC clients connecting except when

# doing so through a secure tunnel.  See the "-via" option in the

# `man vncviewer' manual page.

# VNCSERVERS="2:myusername"

# VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -localhost"

VNCSERVERS="1:root"

VNCSERVERARGS[1]="-geometry 1024x768 -nolisten tcp -depth 24"

# -alwaysshared代表允许多用户同时登录 -depth代为色深,参数有8,16,24,32

#红色为新增内容

3 设置VNC密码

# vncpasswd

Password:

Verify:

连续两次输入同样的密码

设置的密码保存在  /root/.vnc/passwd

4 修改防火墙配置,修改/etc/sysconfig/iptables

# vi /etc/sysconfig/iptables    #编辑,添加以下代码,开启5901、5902端口

-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

:wq! 保存,退出

service iptables restart   # 重启

5 使用VNC连接CentOS主机

直接打开VNC,输入IP地址,冒号后面的1代表桌面号,这个要根据你的配置文件定义的桌面号

1782299552631980768.jpg

如果你是Root用户登陆,会有下面的警告提示

2198319568210329890.jpg

然后输入密码,就可登陆了

1400338009235588213.jpg

1081989810493885610.jpg

6 FAQ

6.1 VNC服务使用的端口号与桌面号的关系

VNC服务使用的端口号与桌面号相关,VNC使用TCP端口从5900开始,对应关系如下

桌面号为“1”  —- 端口号为5901

桌面号为“2”  —- 端口号为5902

桌面号为“3”  —- 端口号为5903

基于Java的VNC客户程序Web服务TCP端口从5800开始,也是与桌面号相关,对应关系如下

桌面号为“1”  —- 端口号为5801

桌面号为“2”  —- 端口号为5802

桌面号为“3”  —- 端口号为5803

6.2 error1: VNC Fatal server error: could not open default font ‘fixed’

Thu Jul 18 00:00:36 2013

vncext:      VNC extension running!

vncext:      Listening for VNC connections on all interface(s), port 5901

vncext:      created VNC server for screen 0

[dix] Could not init font path element /usr/share/X11/fonts/misc, removing from list!

[dix] Could not init font path element /usr/share/X11/fonts/100dpi, removing from list!

[dix] Could not init font path element /usr/share/X11/fonts/Type1, removing from list!

[dix] Could not init font path element /usr/share/fonts/default/Type1, removing from list!

[dix] Could not init font path element built-ins, removing from list!

Fatal server error:

could not open default font 'fixed'

解决办法:yum -y install fontforge

yum update libXfont

6.3  http://www.realvnc.com/download/binary/1293/    VNC下载地址

6.4 VNC的启动/停止/重启

# service vncserver start/stop/restart

关闭具体的vncserver命令:vncserver -kill:1       vncserver -kill:2

6.5  vncserver 不能重启

# service vncserver restart

Shutting down VNC server:                                  [  OK  ]

Starting VNC server: 1:root

Warning: hfracts01:1 is taken because of /tmp/.X1-lock

Remove this file if there is no X server hfracts01:1

A VNC server is already running as :1

解决办法:

# rm -rf /tmp/.X1-lock

# rm -rf /tmp/.X11-unix/

1403434233979406715.jpg

如果要杀掉 vncserver 进程,可执行 vncserver :1 kill ,1表示 display 的 ID 号

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值