ubuntu 启动图形界面命令_Windows 10 远程连接 Ubuntu 18.04 Server图形界面
目錄?
? ?0. 環境信息和說明
Ubuntu 18.04上安裝xrdp遠程ubuntu-desktop桌面服務
Ubuntu 18.04上安裝xrdp遠程Xfce桌面服務
Ubuntu 18.04上安裝vnc遠程Xfce桌面服務
0.環境信息和說明
-----------
Ubuntu版本
# cat /etc/os-releaseNAME="Ubuntu"VERSION="18.04.3 LTS (Bionic Beaver)"ID=ubuntuID_LIKE=debianPRETTY_NAME="Ubuntu 18.04.3 LTS"VERSION_ID="18.04"Windows版本
>winver1. Ubuntu 18.04上安裝xrdp遠程ubuntu-desktop桌面服務
---------
1.1 安裝桌面
# sudo apt update# sudo apt-get install ubuntu-desktop -y注:apt update更新可用包的列表,安裝ubuntu-desktop桌面,安裝大概15-30分鐘,具體由網絡情況決定。
安裝完成后,登錄console,切換到圖形界面
# systemctl set-default graphical.target # systemctl isolate graphical.targetubuntu-desktop圖形界面如下:
---------
1.2 安裝 Xrdp
輸入以下命令:
# sudo apt-get install xrdp -y通過xrdp可以ubuntu桌面
---------
1.3 安裝dconf-editor
需要取消掉請求加密的功能,否則缺少這一步是無法遠程上的,需要安裝dconf-editor工具進行配置,輸入以下命令:
# sudo apt-get install dconf-editor -y桌面修改:搜索 dconf-editor? ?org/gnome/desktop/remote-access/requre-encryption? 設置為OFF,默認ON
2.? Ubuntu 18.04上安裝xrdp遠程Xfce桌面服務
---------
2.1 安裝桌面環境
Ubuntu 存儲庫中有幾個桌面環境 (DE) 。安裝 Xfce,它是一個快速,穩定和輕量級的桌面環境,非常適合在遠程服務器上使用。
以具有 sudo 權限的用戶身份鍵入以下命令,以在服務器上安裝 Xfce :
# sudo apt update# sudo apt install xfce4 xfce4-goodies xorg dbus-x11 x11-xserver-utils -y---------
2.2 安裝 Xrdp
Xrdp 包在默認的 Ubuntu 存儲庫中可用。要安裝它,請運行:
# sudo apt install xrdp -y安裝過程完成后, Xrdp 服務將自動啟動。您可以通過鍵入以下內容來驗證 Xrdp 是否正在運行:
# sudo systemctl status xrdp---------
2.3 配置 Xrdp
Xrdp 配置文件位于 /etc/xrdp 目錄中。對于基本的 Xrdp 連接,只需要配置 Xrdp 即可使用 Xfce 。
修改配置文件 /etc/xrdp/xrdp.ini
# sudo vim /etc/xrdp/xrdp.iniexec startxfce4 ##在文件末尾添加保存文件并重新啟動 Xrdp 服務:
# sudo systemctl restart xrdp---------
2.4?登錄驗證
3. Ubuntu 18.04上安裝vnc遠程Xfce桌面服務
---------
3.1 安裝桌面環境
大多數服務器沒有安裝桌面環境,因此我們首先要安裝輕量級桌面環境。
安裝 Xfce 是快速、穩定和輕量級的桌面環境,非常適合在遠程服務器上使用。
# sudo apt update# sudo apt install xfce4 xfce4-goodies xorg dbus-x11 x11-xserver-utils -y---------
3.2 windows客戶端
Windows 10 安裝VNC-Viewer,vnc可以訪問ubuntu桌面
下載鏈接:
VNC-Viewer-6.18.907-Windows.exe
鏈接:https://pan.baidu.com/s/1tzwg1CAGeEMczBMlCbagAQ
提取碼:1v4a
---------
3.3 .安裝VNC服務器
Ubuntu 存儲庫中還有幾種不同的 VNC 服務器,如 TightVNC , TigerVNC 和 x11vnc 。每個 VNC 服務器在速度和安全性方面都有不同的優點和缺點。
安裝 TigerVNC ,它是高性能 VNC 服務器。
# sudo apt install tigervnc-standalone-server tigervnc-common -y現在安裝了 VNC 服務器,下一步是運行 vncserver 命令,該命令將創建初始配置并設置密碼。
運行以下命令時不要使用 sudo :
# sudo vncserverYou?will?require?a?password?to?access?your?desktops.Password:Verify:Would you like to enter a view-only password (y/n)? n/usr/bin/xauth:??file?/root/.Xauthority?does?not?existNew?'test-lu-u18-03:1?(root)'?desktop?at?:1?on?machine?test-lu-u18-03Starting applications specified in /etc/X11/Xvnc-sessionLog?file?is?/root/.vnc/test-lu-u18-03:1.logUse xtigervncviewer -SecurityTypes VncAuth -passwd /root/.vnc/passwd :1 to connect to the VNC server.注: ~/.vnc/passwd ?存放密碼? ?/home/appuser/.vnc/test-lu-u18-02:1.log 查看日志,重要的是要記住,當使用 VNC 服務器時, :X 是一個引用的顯示端口 5900+X 。
# sudo vncserver -kill :1 ##關閉vncserver---------
3.4 配置 VNC 服務器
已經在服務器上安裝了 Xfce 和 TigerVNC ,需要配置 TigerVNC 來使用 Xfce 。需要創建以下文件 ?/.vnc/xstartup
在非root用戶操作
#?vim?~/.vnc/xstartup#!/bin/shunset SESSION_MANAGERunset DBUS_SESSION_BUS_ADDRESSexec startxfce4保存并關閉文件。無論何時啟動或重啟 TigerVNC 服務器,都將自動執行上述命令。
~/.vnc/xstartup 文件還需要具有執行權限。運行以下命令以確保權限正確:
# sudo chmod u+x ~/.vnc/xstartup如果需要將附加選項傳遞給 VNC 服務器,則可以創建一個名為 config 的文件,并為每行添加一個選項:
#?vim?~/.vnc/configgeometry=1920x1084dpi=96---------
3.5 創建 Systemd 單元文件
創建服務
#?sudo?vim?/etc/systemd/system/vncserver@.service[Unit]Description=Remote desktop service (VNC)After=syslog.target network.target[Service]Type=simpleUser=appuserPAMName=loginPIDFile=/home/%u/.vnc/%H%i.pidExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill :%i > /dev/null 2>&1 || :'ExecStart=/usr/bin/vncserver :%i -geometry 1440x900 -alwaysshared -localhost no -fgExecStop=/usr/bin/vncserver -kill :%i[Install]WantedBy=multi-user.target啟動服務
# sudo systemctl daemon-reload# sudo systemctl enable vncserver@1.service# sudo systemctl start vncserver@1.service# sudo systemctl status vncserver@1.service---------
3.6?登錄驗證
總結
以上是生活随笔為你收集整理的ubuntu 启动图形界面命令_Windows 10 远程连接 Ubuntu 18.04 Server图形界面的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 张大哥笔记-有哪些可傻瓜式建站的开源网站
- 下一篇: mysql中基本的DDL语句(关注一下,