Linux下VNC的安裝,配置,連接


安裝配置VNC

1.服務器端配置YUM

mount -o loop /data/software/CentOS-7.6-x86_64-DVD-1810.iso /mnt
cd /etc/yum.repos.d
vi local.repo
------------------------------
[base]
name=centos 7.6
baseurl=file:///mnt
gpgcheck=0
enable=1
------------------------------

2.安裝圖形化

安裝Linux時選擇了最小化安裝,因此需要安裝圖形化支持

# 查看是否安裝有圖形化界面
rpm -qa|grep gnome
# 安裝圖形化界面
yum groupinstall "X Window System" "Chinese Support" "GNOME Desktop"

X Window SystemGNOME Desktop的關系可以參考:關系

3.安裝VNC Server

yum install -y tigervnc tigervnc-server

4.配置VNC Server

vncserver --help
# 最簡單的配置
vncserver :1
----------------------------------------------------------
[root@localhost system]# vncserver :1

You will require a password to access your desktops.

Password:
Verify:
Would you like to enter a view-only password (y/n)? n
A view-only password is not used

New 'localhost.localdomain:1 (root)' desktop is localhost.localdomain:1

Creating default startup script /root/.vnc/xstartup
Creating default config /root/.vnc/config
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/localhost.localdomain:1.log
----------------------------------------------------------------
  • VNCSERVER允許同時啟動多個VNCSERVER,每一個不同的VNCSERVER使用display#來區分,不同的用戶可以使用不同的display#,同一個用戶,也可以啟動多個display#。

  • 可以到config文件中修改配置,主要配置有分辨率geometry

    以下演示創建oracle用戶的VNCSERVER

    useradd oracle
    passwd oracle
    su - oracle
    vncserver :2
    # 在使用Vnc Viewer連接的時候,輸入display#后直接連入oracle賬戶
    

5.VNC Server管理

5.1.設置開機自啟動

systemctl enable vncserver@:1.service

5.2.關閉VNC Server

vncserver -kill :1

5.3.修改配置

vncserver -kill :1
vi $HOME/.vnc/config
------------------------
## Supported server options to pass to vncserver upon invocation can be listed
## in this file. See the following manpages for more: vncserver(1) Xvnc(1).
## Several common ones are shown below. Uncomment and modify to your liking.
##
# securitytypes=vncauth,tlsvnc
# desktop=sandbox
geometry=1440x900
# depth
# localhost
# alwaysshared
------------------------
vncserver :1

6.使用VNC Viewer連接VNC Server

6.1.下載安裝

Vnc Viewer下載

6.2.連接

輸入IP和Display#即可

6.3.全屏展示

如果VNCServer的分辨率設置合適的話,可以全屏展示

鼠標懸浮到VNC Viewer的中間,點擊全屏選項即可


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM