centos 6.4 vnc 配置和故障排除
时间:2014-10-05 16:38 来源:linux.it.net.cn 作者:it
1.yum 安装vncserver跟centos 5 的软件包名不一样。
1
yum -y
install
tigervnc-server
2.修改vncservers文档 vim /etc/sysconfig/vncservers 修改如下
1
2
VNCSERVERS=
"1:root"
VNCSERVERARGS[2]=
"-geometry 1024x768"
3.vncserver配置 vncpasswd #输入root的密码 service vncserver start 注意如果遇到正在启动 VNC 服务器:1:root xauth: (stdin):1: bad display name "dzwww.yuqing2:1" in "add" command 说明dzwww.yuqing2 没有加入/etc/hosts 127.0.0.1 解析。 配置vnc 使用gnome桌面 vim /root/.vnc/xstartup 修改如下
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
export
LANG
export
SYSFONT
vncconfig -iconic &
unset
SESSION_MANAGER
unset
DBUS_SESSION_BUS_ADDRESS
OS=`
uname
-s`
if
[ $OS =
'Linux'
];
then
case
"$WINDOWMANAGER"
in
*gnome*)
if
[ -e
/etc/SuSE-release
];
then
PATH=$PATH:
/opt/gnome/bin
export
PATH
fi
;;
esac
fi
if
[ -x
/etc/X11/xinit/xinitrc
];
then
exec
/etc/X11/xinit/xinitrc
fi
if
[ -f
/etc/X11/xinit/xinitrc
];
then
exec
sh
/etc/X11/xinit/xinitrc
fi
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
1
2
3
4
5
xsetroot -solid grey
vncconfig -iconic &
#xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#twm &
gnome-session &
#set starting GNOME desktop
查看是否vnc端口已启动 netstat -atunp|grep -i :5901 tcp 0 0 0.0.0.0:5901 0.0.0.0:* LISTEN 29127/Xvnc 显示这样的话,就说明vnc服务正常了。 还是连不上的话,看看服务器是不是有iptable挡住了。
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
iptables -L
Chain INPUT (policy ACCEPT)
target prot opt
source
destination
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT icmp -- anywhere anywhere
ACCEPT all -- anywhere anywhere
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:
ssh
REJECT all -- anywhere anywhere reject-with icmp-host-prohibited
Chain FORWARD (policy ACCEPT)
target prot opt
source
destination
REJECT all -- anywhere anywhere reject-with icmp-host-prohibited
Chain OUTPUT (policy ACCEPT)
target prot opt
source
destination
如果服务器的iptables就是开启的,所以,就算vnc服务开启了,还是连不上。解决方法就是 chkconfig iptables off #禁止开启启动 service iptables stop #关掉iptables
(责任编辑:IT)
1.yum 安装vncserver跟centos 5 的软件包名不一样。
2.修改vncservers文档 vim /etc/sysconfig/vncservers 修改如下
3.vncserver配置 vncpasswd #输入root的密码 service vncserver start 注意如果遇到正在启动 VNC 服务器:1:root xauth: (stdin):1: bad display name "dzwww.yuqing2:1" in "add" command 说明dzwww.yuqing2 没有加入/etc/hosts 127.0.0.1 解析。 配置vnc 使用gnome桌面 vim /root/.vnc/xstartup 修改如下
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
查看是否vnc端口已启动 netstat -atunp|grep -i :5901 tcp 0 0 0.0.0.0:5901 0.0.0.0:* LISTEN 29127/Xvnc 显示这样的话,就说明vnc服务正常了。 还是连不上的话,看看服务器是不是有iptable挡住了。
如果服务器的iptables就是开启的,所以,就算vnc服务开启了,还是连不上。解决方法就是 chkconfig iptables off #禁止开启启动 service iptables stop #关掉iptables (责任编辑:IT) |