使用VNC 访问远程Linux图形桌面

1、确认自己linux系统是否安装VNC

[root@serv1 ~]# rpm -q vnc-server

vnc-server-4.1.2-14.el5_6.6

出现上面的信息说明已经安装了vnc服务。

2、启动vnc服务

[root@serv1 ~]# vncserver :1
You will require a password to access your desktops.
Password:
Verify:
xauth:  creating new authority file /root/.Xauthority
New 'serv1.ganjh.com:1 (root)' desktop is serv1.ganjh.com:1


Creating default startup script /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/serv1.ganjh.com:1.log

其中提示你输入密码,这个密码就是客户端vnc登陆linux的密码。

3、查看linux是否开放了5801,5901端口

[root@serv1 ~]# iptables -I INPUT -p tcp --dport 5901 -j ACCEPT
[root@serv1 ~]# iptables -I INPUT -p tcp --dport 5801 -j ACCEPT

4、使用VNC Viewer软件登陆测试,操作流程如下启动VNC Viewer软件 --> 

Server输入“172.25.6.249:1” --> 点击“OK” --> 

Password输入登陆密码 --> 点击“OK”登陆到X-Window图形桌面环境 --> 测试成功


5、上面的方式只是配置了字符界面,如果要看到gnome界面,那么还要修改Linux配置文件

vi /root/.vnc/xstartup 

把里面的内容删除,替换成下面的

#!/bin/sh

# Uncomment the following two lines for normal desktop:

unset SESSION_MANAGER

exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup

[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &

6、重新启动vnc server

[root@serv1 ~]# vncserver -kill :1
Killing Xvnc process ID 4046
[root@serv1 ~]# vncserver :1


New 'serv1.ganjh.com:1 (root)' desktop is serv1.ganjh.com:1


Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/serv1.ganjh.com:1.log

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值