服务器之家:专注于服务器技术及软件下载分享
分类导航

Linux|Centos|Ubuntu|系统进程|Fedora|注册表|Bios|Solaris|Windows7|Windows10|Windows11|windows server|

服务器之家 - 服务器系统 - Centos - CentOS通过VNC远程桌面管理配置教程分享

CentOS通过VNC远程桌面管理配置教程分享

2019-10-06 21:06CentOS教程网 Centos

这篇文章主要介绍如何在centos中安装vnc实现服务器的远程控制,需要的朋友可以参考下

一、查看是否安装VNC 

1、安装桌面 


yum groupinstall "Chinese Support" 

2、安装中文支持 

yum groupinstall "Desktop" 

打开配置文件的目录:  

1) cd /etc/sysconfig 

2) 编辑配置文件: vi i18n 

3) 用#号把第一行(LANG="en_US.UTF-8")注释掉,其实直接在这行改也是可以的,不过保险点的做法,还是先注释掉,等成功后再删除不迟。 

在第一行下添加一行新行,输入(LANG="zh_CN.UTF-8"),然后保存文件,重启系统,就能见到亲切的中文啦。 

3、关闭防火墙并改为开机不启动防护墙 

[root@centos ~]# service iptables stop 

[root@centos ~]# chkconfig iptables off 


4、查看是否已经安装VNC 

[root@centos ~]# rpm -qa |grep vnc 出现下面类似的说明已安装,否则进行下面的安装配置操作; 
tigervnc-server-1.0.90-0.17.20110314svn4359.el6.x86_64 

二、安装VNC 

[root@centos ~]# yum –y install tigervnc-server 
添加启动项 
[root@centos ~]# chkconfig vncserver on 

三、设置VNC 密码 

[root@centos ~]# vncserver 
Creating default startup script /root/.vnc/xstartup 
Starting applications specified in /root/.vnc/xstartup 
Log file is /root/.vnc/centos:1.log 
会在当前用户主目录下生成.vnc 目录和配置文件 
[root@centos ~]# vncpasswd 
Password: 
Verify: 
设置的密码会保存在/root/.vnc/passwd 

三、VNC 配置 

修改xstartup 文件把最后的twm & 删掉加上gnome-session & 

[root@centos ~]#vi /root/.vnc/xstartup 
xsetroot -solid grey 



xsetroot -solid grey 

xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" & 

twm & 

将twm &修改为gnome-session & 
如果直接启动会失败 
[root@centos ~]#service vncserver start 

Starting VNC server: no displays configured [FAILED] 


所以要修改/etc/sysconfig/vncservers 文件添加以下一条内容 
VNCSERVERS="2:root" 
# 桌面号:用户; 

# 监听的端口为:590* ,星号代表桌面号 


VNCSERVERARGS[2]="-geometry 800x600" 这样修改后,就算/etc/inittab 启动模式为3 也可以正常进入图形界面 

注:修改默认启动界面为修改本行的数字,3为文本界面,5位图形界面:id:3:initdefault: 


启动vncserver 
[root@centos ~]#service vncserver start 
正在启动VNC 服务器:2:root xauth: (stdin):1: bad display name "centos:2" in "add" command 

New 'centos:2 (root)' desktop is centos:2 

Starting applications specified in /root/.vnc/xstartup 
Log file is /root/.vnc/centos:2.log 

Ok,现在可以通过VNC Viewer来远程连接了。

延伸 · 阅读

精彩推荐