VNC连接远程Ubuntu设置
2015-06-29 17:15
495 查看
一.windows 远程软件VNCViewer
这个不多说: 下载地址:http://www.realvnc.com/download/viewer/二.安装 vnc-server
apt-get install vnc-server
提示:
Reading package lists... Done Building dependency tree Reading state information... Done Package vnc-server is a virtual package provided by: vnc4server 4.1.1+xorg4.3.0-37ubuntu4 tightvncserver 1.3.9-6.2ubuntu2 You should explicitly select one to install.
然后我们选择任意一个安装
apt-get install vnc4server
再次安装失败, 提示:
404 Not Found [IP: 112.124.140.210 80] Failed to fetch http://cn.archive.ubuntu.com/ubuntu/pool/main/libx/libx11/libx11-xcb1_1.4.99.1-0ubuntu2.2_amd64.deb 404 Not Found [IP: 112.124.140.210 80] Failed to fetch http://cn.archive.ubuntu.com/ubuntu/pool/main/libx/libxfixes/libxfixes3_5.0-4ubuntu4.2_amd64.deb 404 Not Found [IP: 112.124.140.210 80] Failed to fetch http://cn.archive.ubuntu.com/ubuntu/pool/main/libx/libxi/libxi6_1.7.1.901-1ubuntu1~precise1_amd64.deb 404 Not Found [IP: 112.124.140.210 80] Failed to fetch http://cn.archive.ubuntu.com/ubuntu/pool/main/libx/libxv/libxv1_1.0.6-2ubuntu0.1_amd64.deb 404 Not Found [IP: 112.124.140.210 80] Failed to fetch http://cn.archive.ubuntu.com/ubuntu/pool/main/x/x11-utils/x11-utils_7.6+4ubuntu0.1_amd64.deb 404 Not Found [IP: 112.124.140.210 80] E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
提示让apt-get update , update后
apt-get install vnc4server
就ok了。
三. 修改VNC Password
vncpasswd
Password: ******
Verify:*****
四.启动VNC server
vncserver
提示:
xauth: file /root/.Xauthority does not exist New 'AYbZ:1 (root)' desktop is AYbZ:1 Creating default startup script /root/.vnc/xstartup Starting applications specified in /root/.vnc/xstartup Log file is /root/.vnc/AYbZ:1.log
五.连接vnc
客户端连接vnc 使用端口为:1 每启动一次vncserver 相应的:端口就会变化一次在这里,我们看到的是一个Linux命令行窗口
六.修改显示界面
我们打开/root/.vnc/xstartupvim /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 & x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" & x-window-manager &
我们需要将最后一行“x-window-manager &”改为我们自己的Ubuntu图形界面服务, Ubuntu有gnome、KDE、Unity等桌面环境。
如果是gnome桌面,改成gnome-session &;
如果是KDE桌面,改成startkde &;
如果是Unity桌面,首先去 /usr/share/gnome-session/sessions/下看桌面session的名称,如果是ubuntu-2d,则将最后一行改为:
export STARTUP="/usr/bin/gnome-session --session=ubuntu-2d"
$STARTUP
------------------------
在这里,一大波问题来袭
修改最后一行为:gnome-session &重启vnc:
vncserver -kill :1
vncserver
vnc还显示命令行窗口
好,我们知道,有可能是没有安装桌面环境。方法安装:
第一步:安装x-windows的基础
apt-get install x-window-system-core
第二步:安装登录管理器
apt-get install gdm
第三步:安装桌面
apt-get install ubuntu-desktop
重启vnc:
vncserver -kill :1
vncserver
依旧显示命令行窗口
这次已经gnome桌面环境,依旧这样是为什么呢?记得在启动vncservier时生成个日志.log文件。
查看日志文件
cat root/.vnc/AYbZ\:1.log
显示如下错误:
error opening security policy file /etc/X11/xserver/SecurityPolicy Could not init font path element /usr/X11R6/lib/X11/fonts/Type1/, removing from list! Could not init font path element /usr/X11R6/lib/X11/fonts/Speedo/, removing from list! Could not init font path element /usr/X11R6/lib/X11/fonts/misc/, removing from list! Could not init font path element /usr/X11R6/lib/X11/fonts/75dpi/, removing from list! Could not init font path element /usr/X11R6/lib/X11/fonts/100dpi/, removing from list! Could not init font path element /usr/share/fonts/X11/75dpi/, removing from list! Could not init font path element /usr/share/fonts/X11/100dpi/, removing from list!
我们安装字体便是
apt-get install xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic
安装完成时候,重启vncserver,再次查看log日志文件
Could not init font path element /usr/X11R6/lib/X11/fonts/Type1/, removing from list! Could not init font path element /usr/X11R6/lib/X11/fonts/Speedo/, removing from list! Could not init font path element /usr/X11R6/lib/X11/fonts/misc/, removing from list! Could not init font path element /usr/X11R6/lib/X11/fonts/75dpi/, removing from list! Could not init font path element /usr/X11R6/lib/X11/fonts/100dpi/, removing from list!
在/usr/share/fonts/X11目录下有字体文件了,但/usr/X11R6/lib 目录还是不存在字体
我们可以让X11R6里面软链接到share/fonts字体目录中
mkdir -r /usr/X11R6/lib # 没有X11R6/lib 目录
cd /usr/X11R6/lib/
ln -s /usr/share/fonts/X11 X11
再次重启vncserver
OK!
相关文章推荐
- 修改PHP 加载loaded configuration file 目录
- 解决Yii2 启用_csrf验证后POST数据仍提示“您提交的数据无法验证”
- Nginx 反代理其他搜索引擎
- 广东省航道局实现电子化档案管理
- js 字符串转换成数字的三种方法
- [NOI2002]银河英雄传说(并查集)
- 一个简单的http请求
- html5的本地存储localStorage和sessionStorage
- linux 使用 ionice 限制 Xen 虚拟机磁盘 IO
- Pyqt 获取打包二进制文件中的资源
- Python 迭代器 & __iter__方法
- virtaulbox视图模式常用切换
- Python 中xrange和range区别
- Python yield 使用浅析
- net start mysql 发生系统错误2
- SQL Server 联表字段合并查询
- C语言的作用域规则
- Pyqt adb 获取Android手机屏幕
- 集合的模拟实现(函数模板)
- Unity3D研究院之打开Activity与调用JAVA代码传递参数(十八)