多機器(一):docker封裝ubuntu並使用VNC view打開

1 各個部件裝配

1.1 拉取ubuntu16鏡像

#運行交互式的容器(若沒有,則會自行拉取ubuntu:16.04)
docker run -i -t ubuntu:16.04 /bin/bash

#解決一些系統小問題
apt update

若報錯
E: Malformed entry 1 in list file /etc/apt/sources.list.d/ros-latest.list (Component)
E: The list of sources could not be read.
則執行
rm /etc/apt/sources.list.d/ros-latest.list 

安裝lsb_release
sudo apt-get install lsb-core -y

1.2 安裝ROS

參考鏈接:(不像裏面安裝的ros完整版,我這裏安裝的ros-kinetic-ros-base,避免過大,用到了再添加)

Ubuntu16.04安裝ROS Kinetic詳細過程

裝ros慢怎麼辦,只需要少執行一步就可以了

1.3 安裝 VNC

https://www.realvnc.com/en/connect/download/viewer/

下載linux版本VNC view 並安裝本地

按照下面執行,注意儘量按照這來

Ubuntu16.04 用VNC鏈接 GNOME 桌面

儘量不要使用sudo命令,因爲

根據 https://blog.csdn.net/wuchenlhy/article/details/79865437#commentBox 下面回答提到

所有vncserver的操作中去掉sudo。否則有一定概率會改變用戶文件夾下的.Xauthority所有者權限爲root:root,這樣重啓電腦後以普通用戶身份將無法正常登入任何桌面。

https://blog.csdn.net/u014389734/article/details/79513517

Ubuntu16.04 用VNC鏈接 GNOME 桌面

1.4 VNC view連接

登錄需要 遠程服務 ip 和端口進程

確定ip地址

ifconfig
找到不是lo的那一個,我的是 eyh0 ; 然後 inet 後面的就是ip

確定端口

vncserver :2 後面的那個2就是端口進程

在這裏插入圖片描述
點擊確定就開始登錄了,這個時候會需要登錄密碼,這個密碼就是上面安裝vncserver時候第一次執行下面命令彈出的自行設置的

vncserver

2 安裝過程

2.1 個人完整安裝過程(可能會有遺漏)

//安裝 sudo
apt-get update
apt-get install sudo

//設置密碼  13939
sudo passwd root

--------------------------------------------------------
//安裝服務端    不要使用 sudo
apt-get install openssh-server

//安裝客戶端
apt-get install openssh-client
service ssh status


//開啓ssh服務
service ssh start


遠程訪問    ssh  服務器用戶名@ip  
eg:
ssh [email protected]

下面開始確定root和ip地址

ifconfig 
找到不是lo的那一個,我的是 eyh0 ;  然後 inet 後面的就是ip  ;我這裏對 遠程ubuntu命名使用者爲 root


若輸入密碼後,報錯 Permission denied, please try again.
在服務器端執行:
vi /etc/ssh/sshd_config
找到對應配置,將裏面配置改成如下
PermitRootLogin yes


--------------------------------------------------------
apt update
# 對需要升級的軟件進行升級
apt upgrade -y

安裝桌面環境(介紹安裝並使用 unity 桌面)

#完整安裝(不推薦):
apt install ubuntu-desktop gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal -y

# 僅安裝核心組件(推薦): 不安裝例如 office、瀏覽器、等等的額外組件
apt-get install --no-install-recommends ubuntu-desktop gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal -y

# 安裝VNC服務
apt-get install vnc4server -y
# 啓動vnc服務需要設置密碼(密碼後面要用到,要記住哦)
vncserver


--------------------------------------------增加服務器進程(就是多一個VNC窗口)
添加(端口是2)
vncserver :2
滅掉
vncserver -kill: 2


# 修改VNC配置文件
#修改 ~/.vnc/xstartup,在 x-window-manager & 的後面新增下面這 4 行:
gnome-panel &
gnome-settings-daemon &
metacity &
nautilus &

完整配置文件如下:

完整配置文件如下:

#!/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 &

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

2.2 過程中出現的問題彙總

2.2.1 VNC view 無法打開終端問題

服務器(一):VNC view 無法打開終端問題

2.2.2 如果死活沒辦法解決灰屏,開始下面

服務器(二):VNC view 死活沒辦法解決灰屏

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章