安裝ubuntu-desktop
1.更新軟體庫
apt-get update
2.更新軟體
apt-get upgrade
3.安裝桌面
apt-get install ubuntu-desktop
解決root登入受限
華為雲登入進去是guest使用者,不能選擇登入使用者且不需要密碼就即可登入。

登入進去會如下警告資訊:
首先下載下傳putty(傳送門):
在putty上通過SSH登陸雲伺服器:
、
對以下目錄檔案進行修改:
注意:下載下傳及登陸putty的操作是必須的!因為遠端進入華為雲伺服器,隻能使用guest帳号,但是guest帳号是沒有權限修改這個檔案的。是以,需要在windows端,使用上面提到的putty工具,以root帳号(使用putty工具進入可以指定登入使用者),遠端登入進入,這樣才可以修改檔案。
vim /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf
# 修改前
[Seat:*]
user-session=ubuntu
# 修改後
[Seat:*]
user-session=ubuntu
greeter-show-manual-login=true
allow-guest=false
重新開機之後就可以用root使用者登入,但是登入後還是有警告,這個需要修改 /root/.profile 檔案:
vim /root/.profile
# 檔案 /root/.profile
# 檔案修改前
# ~/.profile: executed by Bourne-compatible login shells.
if [ "$BASH" ]; then
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
fi
mesg n || true
# 檔案修改後
# ~/.profile: executed by Bourne-compatible login shells.
if [ "$BASH" ]; then
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
fi
tty -s && mesg n || true
reboot 重新開機後即可。
安裝遠端通路軟體
每次都通過web進行登入很不友善,而且桌面的反應也比較慢。是以可以安裝Teamviwer/vnc4server來實作遠端登入。
方法一:Teamviwer安裝 傳送門 (推薦)
無需過多配置,一鍵安裝!
windows及linux版本都可安裝。
使用如下:
方法二:安裝vnc4server(稍麻煩,配置過多)
- 安裝vnc4server
apt-get install vnc4server -y
- 運作指令開啟VNC服務并設定連接配接密碼
vnc4server
- 運作指令确認服務是否啟動
ps –ef|grep vnc
- 修改xstartup檔案
如果不修改VNC Viewer會找不到啟動桌面的檔案。在修改之前做好備份!
cp ~/.vnc/xstartup ~/.vnc/xstartup.bak
殺掉原來的桌面程序:
vncserver –kill :1
修改vnc的啟動檔案 :
vi ~/.vnc/xstartup
修改内容根據自己安裝的圖形界面的不同而不一樣。
可以自行查閱相關内容,此處略去。
儲存退出後,再次進入vnc遠端連接配接:
vncserver :1
- 在你的電腦上安裝vncviwer,用來遠端連接配接
vncviwer 傳送門 伺服器位址這樣寫
公網IP:1