繼續ubuntu+vritualbox+vnc+vritualbox命令行環境搭建

一,按照上篇的思路在linux服務器下開始搭建各類環境。php

1,先總結一下windows和linux遠程桌面鏈接,就是能夠看到圖形界面話。html

方法有幾種不過資料最多仍是vnc,若是你用的是xmanager+xshell本身試過坑不少並且資料較多,因此仍是vnc靠譜一些直接記錄過程和問題:linux

由於網上資料都不是很全,因此本身的環境時純淨版的ubuntu啥都沒有,而後開始。shell

個人安裝前提都是有網絡的狀況下沒下載dpkg等包,ubuntu

安裝桌面;windows

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"-->回車,安裝完成。session

安裝vnc4server:app

輸入"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同樣了,系統啥的時間問題慢慢安裝吧。。。

相關文章
相關標籤/搜索