濮阳杆衣贸易有限公司

主頁(yè) > 知識(shí)庫(kù) > Ubuntu20.04 VNC 安裝與設(shè)置實(shí)現(xiàn)

Ubuntu20.04 VNC 安裝與設(shè)置實(shí)現(xiàn)

熱門(mén)標(biāo)簽:電話(huà)機(jī)器人服務(wù)差 蘭州語(yǔ)音電銷(xiāo)機(jī)器人軟件 宿州防封外呼系統(tǒng)廠(chǎng)家 高德地圖標(biāo)注在建線(xiàn)路 ai電銷(xiāo)機(jī)器人 如何開(kāi)發(fā) 電銷(xiāo)機(jī)器人對(duì)公司貢獻(xiàn) 智能外呼系統(tǒng)如何部署 山東400電話(huà)如何辦理 濟(jì)源電話(huà)外呼系統(tǒng)怎么樣

VNC是一個(gè)遠(yuǎn)程桌面協(xié)議。按照本文的說(shuō)明進(jìn)行操作可以實(shí)現(xiàn)用VNC對(duì)Ubuntu 20.04進(jìn)行遠(yuǎn)程控制。一般的VNC安裝方式在主機(jī)沒(méi)有插顯示器的時(shí)候是無(wú)法使用的。下面的操作可以在主機(jī)有顯示器和沒(méi)有顯示器時(shí)都能夠正常工作。

首先安裝x11vnc

sudo apt-get install x11vnc -y

設(shè)置vnc密碼

sudo x11vnc -storepasswd /etc/x11vnc.pass 

創(chuàng)建x11vnc自啟動(dòng)服務(wù)

創(chuàng)建 /etc/systemd/system/x11vnc.service,并寫(xiě)入以下內(nèi)容

[Unit]
Description=Start x11vnc at startup.
After=multi-user.target
[Service]
Type=simple
ExecStart=/usr/bin/x11vnc -auth /run/user/1000/gdm/Xauthority -forever -loop -noxdamage -repeat -rfbauth /etc/x11vnc.pass -rfbport 5900 -shared
[Install]
WantedBy=multi-user.target

啟動(dòng)x11vnc服務(wù)

sudo systemctl enable x11vnc
sudo service x11vnc start

此時(shí)如果遠(yuǎn)程的主機(jī)上接了顯示器,那么就可以在局域網(wǎng)通過(guò)VNC進(jìn)行訪(fǎng)問(wèn)了。

為了能夠保證遠(yuǎn)程主機(jī)無(wú)論是否有顯示器,我們都能通過(guò)VNC進(jìn)行遠(yuǎn)程訪(fǎng)問(wèn),我們還要做下面的修改

創(chuàng)建默認(rèn)的xorg.conf文件

sudo Xorg :1 -configure

此時(shí)程序會(huì)生成 /root/xorg.conf.new文件

我的默認(rèn)文件內(nèi)容如下

Section "ServerLayout"
 Identifier   "X.org Configured"
 Screen   0 "Screen0" 0 0
 InputDevice  "Mouse0" "CorePointer"
 InputDevice  "Keyboard0" "CoreKeyboard"
EndSection

Section "Files"
 ModulePath  "/usr/lib/xorg/modules"
 FontPath   "/usr/share/fonts/X11/misc"
 FontPath   "/usr/share/fonts/X11/cyrillic"
 FontPath   "/usr/share/fonts/X11/100dpi/:unscaled"
 FontPath   "/usr/share/fonts/X11/75dpi/:unscaled"
 FontPath   "/usr/share/fonts/X11/Type1"
 FontPath   "/usr/share/fonts/X11/100dpi"
 FontPath   "/usr/share/fonts/X11/75dpi"
 FontPath   "built-ins"
EndSection

Section "Module"
 Load "glx"
EndSection

Section "InputDevice"
 Identifier "Keyboard0"
 Driver   "kbd"
EndSection

Section "InputDevice"
 Identifier "Mouse0"
 Driver   "mouse"
 Option   "Protocol" "auto"
 Option   "Device" "/dev/input/mice"
 Option   "ZAxisMapping" "4 5 6 7"
EndSection

Section "Monitor"
 Identifier  "Monitor0"
 VendorName  "Monitor Vendor"
 ModelName  "Monitor Model"
EndSection

Section "Device"
    ### Available Driver options are:-
    ### Values: <i>: integer, <f>: float, <bool>: "True"/"False",
    ### <string>: "String", <freq>: "<f> Hz/kHz/MHz",
    ### <percent>: "<f>%"
    ### [arg]: arg optional
    #Option   "Accel"        # [<bool>]
    #Option   "AccelMethod"     # <str>
    #Option   "Backlight"      # <str>
    #Option   "CustomEDID"     # <str>
    #Option   "DRI"         # <str>
    #Option   "Present"       # [<bool>]
    #Option   "ColorKey"      # <i>
    #Option   "VideoKey"      # <i>
    #Option   "Tiling"       # [<bool>]
    #Option   "LinearFramebuffer"  # [<bool>]
    #Option   "HWRotation"     # [<bool>]
    #Option   "VSync"        # [<bool>]
    #Option   "PageFlip"      # [<bool>]
    #Option   "SwapbuffersWait"   # [<bool>]
    #Option   "TripleBuffer"    # [<bool>]
    #Option   "XvPreferOverlay"   # [<bool>]
    #Option   "HotPlug"       # [<bool>]
    #Option   "ReprobeOutputs"   # [<bool>]
    #Option   "XvMC"        # [<bool>]
    #Option   "ZaphodHeads"     # <str>
    #Option   "VirtualHeads"    # <i>
    #Option   "TearFree"      # [<bool>]
    #Option   "PerCrtcPixmaps"   # [<bool>]
    #Option   "FallbackDebug"    # [<bool>]
    #Option   "DebugFlushBatches"  # [<bool>]
    #Option   "DebugFlushCaches"  # [<bool>]
    #Option   "DebugWait"      # [<bool>]
    #Option   "BufferCache"     # [<bool>]
 Identifier "Card0"
 Driver   "intel"
 BusID    "PCI:0:2:0"
EndSection

Section "Screen"
 Identifier "Screen0"
 Device   "Card0"
 Monitor  "Monitor0"
 SubSection "Display"
 Viewport  0 0
 Depth   1
 EndSubSection
 SubSection "Display"
 Viewport  0 0
 Depth   4
 EndSubSection
 SubSection "Display"
 Viewport  0 0
 Depth   8
 EndSubSection
 SubSection "Display"
 Viewport  0 0
 Depth   15
 EndSubSection
 SubSection "Display"
 Viewport  0 0
 Depth   16
 EndSubSection
 SubSection "Display"
 Viewport  0 0
 Depth   24
 EndSubSection
EndSection

將此文件復(fù)制至 /usr/share/X11/xorg.conf.d/xorg.conf

這個(gè)文件保證在主機(jī)上插有顯示器的時(shí)候,系統(tǒng)界面能在顯示器上正常顯示。下面我們?cè)俳o系統(tǒng)添加一個(gè)虛擬顯示器,當(dāng)主機(jī)沒(méi)有顯示器的時(shí)候系統(tǒng)就使用這個(gè)虛擬顯示器。

安裝虛擬顯卡驅(qū)動(dòng)

sudo apt install xserver-xorg-video-dummy

在這個(gè)文件的最后添加下面的內(nèi)容

Section "Monitor"
 Identifier "Monitor1"
 HorizSync  1.0 - 2000.0
 VertRefresh 1.0 - 200.0
 # Add 16:9 modes, others are automatically detected.
 Modeline "1280x720" 74.48 1280 1336 1472 1664 720 721 724 746
 Modeline "1920x1080" 172.80 1920 2040 2248 2576 1080 1081 1084 1118
EndSection


Section "Device"
 Identifier "Card1"
 Driver "dummy"
 VideoRam 256000
EndSection

Section "Screen"
 DefaultDepth 24
 Identifier "Screen1"
 Device "Card1"
 Monitor "Monitor1"
 SubSection "Display"
  Depth 24
  Modes "1920x1080"
 EndSubSection
EndSection

這樣我們就創(chuàng)建了一個(gè)使用虛擬顯卡的虛擬顯示器。為了讓虛擬的顯示器和真實(shí)顯示器都能工作,我們需要把最上面的ServerLayout 進(jìn)行更改

Section "ServerLayout"
    Identifier   "X.org Configured"
    Screen   0 "Screen0" 0 0
 Screen   1 "Screen1" 0 0
EndSection

現(xiàn)在重新啟動(dòng)遠(yuǎn)程電腦,就可以在沒(méi)有顯示器的情況下遠(yuǎn)程了。

以上的方法還有一個(gè)問(wèn)題。就是在用戶(hù)沒(méi)有登錄的其情況下是沒(méi)辦法遠(yuǎn)程的。所以需要把用戶(hù)設(shè)置成自動(dòng)登錄。

到此這篇關(guān)于Ubuntu20.04 VNC 安裝與設(shè)置實(shí)現(xiàn)的文章就介紹到這了,更多相關(guān)Ubuntu20.04 VNC 安裝與設(shè)置內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

標(biāo)簽:畢節(jié) 云南 南寧 安陽(yáng) 晉中 佛山 巴中 衡水

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《Ubuntu20.04 VNC 安裝與設(shè)置實(shí)現(xiàn)》,本文關(guān)鍵詞  Ubuntu20.04,VNC,安裝,與,設(shè)置,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問(wèn)題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《Ubuntu20.04 VNC 安裝與設(shè)置實(shí)現(xiàn)》相關(guān)的同類(lèi)信息!
  • 本頁(yè)收集關(guān)于Ubuntu20.04 VNC 安裝與設(shè)置實(shí)現(xiàn)的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    武乡县| 东城区| 梁河县| 嘉峪关市| 沈阳市| 松原市| 黑水县| 莲花县| 甘孜| 武穴市| 固安县| 遂平县| 城固县| 海南省| 遵化市| 苍梧县| 五寨县| 铁力市| 嘉兴市| 新乡县| 盐亭县| 大渡口区| 固安县| 中宁县| 南郑县| 正定县| 旬阳县| 南丹县| 黑河市| 宣武区| 德钦县| 枞阳县| 客服| 郁南县| 齐齐哈尔市| 五常市| 甘谷县| 青浦区| 连江县| 嵊泗县| 明溪县|