继续ubuntu+vritualbox+vnc+vritualbox命令行环境搭建

一,按照上篇的思路在linux服务器下开始搭建各种环境。

1,先总结一下windows和linux远程桌面连接,就是可以看到图形界面话。

方法有几种不过资料最多还是vnc,如果你用的是xmanager+xshell自己试过坑很多而且资料较多,所以还是vnc靠谱一些直接记录过程和问题:

因为网上资料都不是很全,所以自己的环境时纯净版的ubuntu啥都没有,然后开始。

我的安装前提都是有网络的情况下没下载dpkg等包,

安装桌面;

sudo apt-get install xubuntu-desktop
sudo apt-get install kubuntu-desktop
sudo apt-get install ubuntu-desktop

安装xrdp:

使用快捷键"Ctrl+Alt+T"打开一个终端窗口或者ssh连接,输入"sudo apt-get install xrdp"-->回车-->输入root用户的密码-->回车-->输入"y"-->回车,安装完成。

安装vnc4server:

输入"sudo apt-get install vnc4server"-->回车-->输入root用户的密码-->回车-->输入"y"-->回车,安装完成。

安装xfce4

输入"sudo apt-get install xubuntu-desktop"-->回车-->输入root用户的密码-->回车-->输入"y"-->回车 -->输入"echo "xfce4-session" >~/.xsession"-->回车-->输入"sudo service xrdp restart"-->回车,安装完成。

至此主要的基本完事。sudo apt-get install gnome-panel这个如果有可不用安装支持图形界面登陆。

然后可以试试了,cmd->mstsc:输入服务器ip,登陆默认xvnc就可,然后输入用户名和密码。登陆左上角后会个log不用点ok如果有错log会提示,如果没有自动进入页面。

当然可以下载vnc view很小登陆很方便用法和远程桌面一样。

注释一下需要注意:

sudo /etc/init.d/xrdp restart    服务地址,安装后最后重启一下。

vncserver服务的话vncserver  第一次会提示修改passwd修改一下就好了

修改xstartup文件

#!/bin/shexport XKL_XMODMAP_DISABLE=1  unset SESSION_MANAGER  
unset DBUS_SESSION_BUS_ADDRESS  

gnome-panel &  
gnome-settings-daemon &  
metacity &  
nautilus &  
gnome-terminal &

重启进程,vncserver -kill :1 &vncserver :1

问题调试方法:
查看日志  tail -f **:1.log

遇到的错误

http://blog.csdn.net/liu251/article/details/6118350 

上面链接问题重启服务不进不去了,供参考。

LOG:

connecting to sesman ip 127.0.0.1 port 3350
sesman connect ok
sending login info to sesman
login successful for display 14
started connecting
connecting to 127.0.0.1 5914
error - problem connecting

xrdp-sesman.log下错误为:

[INFO ] starting Xvnc session...
[ERROR] X server for display 10 startup timeout[INFO ] starting xrdp-sessvc - xpid=2924 - wmpid=2923
[ERROR] X server for display 10 startup timeout
[ERROR] another Xserver is already active on display 10
[DEBUG] aborting connection...
如果你的log也有类似 X server for display 10 startup timeoutanother Xserver is already active on display 10

问题根源在于tightvnc,出现问题的版本跟X字体有冲突,导致连接Xserver出错

解决方法:

apt-get purge tightvnc xrdp
apt-get install tightvncserver xrdp

最后:

启动xrdp服务,sudo /etc/init.d/xrdp restart,此时会启用相应端口,配置方面默认即可。

通过命令:netstat  -tnl

查看 3350 3389 5910 这三个端口处于LISTEN,一般就没问题了。

dpkg -L +软件包的名字,可以知道这个软件包包含了哪些文件.

xrdp 访问 ubuntu 只看到背景,看不到菜单栏的解决办法  方法:安装gnome-panel
sudo apt-get install gnome-panel

备注:

/usr/share/applications     共享桌面的路径里面可以设置让ubuntu可以让远程。

自己遇到的问题链接成功能进入但看不到桌面。上面的哪个方法没有解决。

Thanks MidnightJava. The solution is to edit the xstartup file as you stated. I want to clarify another point. There are individual xstartup files for every user. For root, the file is located:
/root/.vnc/xstartup

for other users, the file is in
/home/$USERNAME/.vnc/xstartup

In my case I was editing the user's xstartup file and getting a blank screen in vnc when logged in as root. It is the file

Code:

/root/.vnc/xstartup

that needs to be edited.

And to be precise, you just need to uncomment the two lines in that file :

Code:

unset SESSION_MANAGER
exec /etc/X11/xinint/xinitrc

and the line

Code:

x-window-manager &

After uncommenting, run the vncserver as root

http://ubuntuforums.org/showthread.php?t=1903220

上面链接解决的。供参考。

VirtualBox 的命令行用法

   1.

      创建一个新的虚拟机,虚拟机的名称通过 --name 选项指定:

      VBoxManage createvm --name "Ubuntu 9.10" --register
   2.

      创建该虚拟机所用的虚拟硬盘,用 --filename 指定虚拟硬盘的名称,--size 选项指定虚拟硬盘的大小,本例为 5 GB:

      VBoxManage createhd --filename "Ubuntu910.vdi" --size 5000 --remember
   3.

      修改虚拟机的选项设置:

      VBoxManage modifyvm "Ubuntu 9.10" --memory "512MB" --hda "Ubuntu910.vdi" --dvd /home/linuxtoy/karmic-desktop-i386.iso --acpi on --accelerate3d on --boot1 dvd --nic1 nat

其中,

    * --memory 指定内存的大小
    * --hda 指定所用的虚拟硬盘
    * --dvd 指定所用的 ISO 映像
    * --acpi on 启用 ACPI
    * --accelerate3d on 启用 3D 加速
    * --boot1 引导次序
    * --nic1 网络设置

其实可以完全终端操作自己废了一圈事,只是为了搭建完不是自己在用别人用会感到别扭。这样一套环境基本完事了。剩下就和windows一样了,系统啥的时间问题慢慢安装吧。。。

 

你可能感兴趣的:(继续ubuntu+vritualbox+vnc+vritualbox命令行环境搭建)