CentOS6.5配置VNCServer实现图形化访问桌面

网友投稿 719 2023-03-14

本站部分文章、图片属于网络上可搜索到的公开信息,均用于学习和交流用途,不能代表睿象云的观点、立场或意见。我们接受网民的监督,如发现任何违法内容或侵犯了您的权益,请第一时间联系小编邮箱jiasou666@gmail.com 处理。

CentOS6.5配置VNCServer实现图形化访问桌面

VNC (Virtual Network Console)是虚拟网络控制台的缩写。它 是一款优秀的远程控制工具软件,由著名的 AT&T 的欧洲研究实验室开发的。VNC 是在基于 UNIX 和 Linux 操作系统的免费的开源软件,远程控制能力强大,高效实用,其性能可以和Windows 和 MAC 中的任何远程控制软件媲美。 在 Linux 中,VNC 包括以下四个命令:vncserver,vncviewer,vncpasswd,和 vncconnect。大多数情况下用户只需要其中的两个命令:vncserver 和 vncviewer。

[root@tiejiang ~]# yum groupinstall -y "X Window System"[root@tiejiang ~]# yum groupinstall -y "Desktop"[root@tiejiang ~]# yum groupinstall -y "Chinese Support"

[root@ ~]# yum groupinstall -y "X Window System"[root@ ~]# yum groupinstall -y "Desktop"[root@ ~]# yum groupinstall -y "Chinese Support"

二. 安装vncserver并配置(vnc是一款优秀的远程控制软件)

1、安装vncserver

[root@tiejiang ~]# yum install -y tigervnc-server

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

2、配置vncserver

(1)配置为开机自启动   [root@tiejiang ~]# chkconfig vncserver on   [root@tiejiang ~]# chkconfig --level 345 vncserver on(2)配置vnc密码   [root@tiejiang ~]# vncserver      You will require a password to access your desktops      Password:      Verify:   会提示输入密码,这个密码是远程登录时所需要输入的密码,输入密码,回车(3)配置为使用gnome桌面   [root@tiejiang ~]# vim /root/.vnc/xstartup      把最后的 twm &  删掉 加上  gnome-session &	#防止远程上去出现灰屏(4)配置vncserver启动后监听端口和环境参数   [root@tiejiang ~]# vim /etc/sysconfig/vncservers	#vnc配置文件,增加下面的信息      VNCSERVERS="1:root"	# 桌面号:用户 监听 590* 端口      VNCSERVERARGS[1]="-geometry 1200x800"(5)配置iptables防火墙   [root@tiejiang ~]# vim /etc/sysconfig/iptables      -A INPUT -m state --state NEW -m tcp -p tcp --dport 1 -j ACCEPT   [root@tiejiang ~]# service iptables restart	#重启一下iptables防火墙(6)重启vncserver服务   [root@tiejiang ~]# service vncserver restart   或者   [root@tiejiang ~]# /etc/init.d/vncserver restart(7)更改vnc的远程密码   [root@tiejiang ~]# vncpasswd

(1)配置为开机自启动 [root@ ~]# chkconfig vncserver on [root@ ~]# chkconfig --level 345 vncserver on(2)配置vnc密码 [root@ ~]# vncserver You will require a password to access your desktops Password: Verify: 会提示输入密码,这个密码是远程登录时所需要输入的密码,输入密码,回车(3)配置为使用gnome桌面 [root@ ~]# vim /root/.vnc/xstartup 把最后的 twm & 删掉 加上 gnome-session & #防止远程上去出现灰屏(4)配置vncserver启动后监听端口和环境参数 [root@ ~]# vim /etc/sysconfig/vncservers #vnc配置文件,增加下面的信息 VNCSERVERS="1:root" # 桌面号:用户 监听 590* 端口 VNCSERVERARGS[1]="-geometry 1200x800"(5)配置iptables防火墙 [root@ ~]# vim /etc/sysconfig/iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 1 -j ACCEPT [root@ ~]# service iptables restart #重启一下iptables防火墙(6)重启vncserver服务 [root@ ~]# service vncserver restart 或者 [root@ ~]# /etc/init.d/vncserver restart(7)更改vnc的远程密码 [root@ ~]# vncpasswd

三. 允许root访问图形界面和生成新的machine-id

[root@tiejiang ~]# sed -i 's/.*!= root.*/#&/' /etc/pam.d/gdm	#第一句的sed命令的意思是将匹配/.*!= root.*/的行的前面加个#[root@tiejiang ~]# dbus-uuidgen > /var/lib/dbus/machine-id	#第二句的意思是将由dbus-uuidgen生成的uuid输出至machine-id文件

[root@ ~]# sed -i 's/.*!= root.*/#&/' /etc/pam.d/gdm #第一句的sed命令的意思是将匹配/.*!= root.*/的行的前面加个#[root@ ~]# dbus-uuidgen > /var/lib/dbus/machine-id #第二句的意思是将由dbus-uuidgen生成的uuid输出至machine-id文件

四. 关闭selinux和NetworkManager服务

1、检查selinux服务并关闭(确认里面的SELINUX字段的值是disabled,如果不是则改为disabled)

[root@tiejiang ~]# vim /etc/selinux/config

[root@ ~]# vim /etc/selinux/config

2、关闭NetworkManager服务

[root@tiejiang ~]# chkconfig --del NetworkManager

[root@ ~]# chkconfig --del NetworkManager

五.到此,VNC服务端设置完成,用VNC客户端可以连接了

vnc服务器:你的ip:1即可通过vnc工具来登陆远程系统桌面

上一篇:部署 DevStack - 每天5分钟玩转 OpenStack(17)
下一篇:Linux高级运维工程师面试题收集--带答案(更新)
相关文章

 发表评论

暂时没有评论,来抢沙发吧~