您現在的位置是:首頁 > 籃球

centos8 安裝VNC配置遠端連線

  • 由 馬踏天空 發表于 籃球
  • 2023-01-23
簡介service)安裝VNCServer[root@centos8 ~]# dnf install -y tigervnc-server tigervnc-server-module複製配置檔案[root@centos8 ~]# cp li

centos怎麼啟動遠端

系統資訊

[root@centos8 ~]# cat /etc/redhat-release

CentOS Linux release 8。1。1911 (Core)

[root@centos8 ~]#

注意要安裝桌面環境,如果沒有安裝桌面環境,登進去是黑屏。

處理:

1。安裝桌面環境(yum groupinstall “Server with GUI”)

2。重啟VNCServer(systemctl restart vncserver@:1。service)

安裝VNCServer

[root@centos8 ~]# dnf install -y tigervnc-server tigervnc-server-module

複製配置檔案

[root@centos8 ~]# cp /lib/systemd/system/vncserver@。service /etc/systemd/system/vncserver@:1。service

編輯 vim /etc/tigervnc/vncserver。users 新增使用者

[root@centos8 ~]# vim /etc/tigervnc/vncserver。users# TigerVNC User assignment## This file assigns users to specific VNC display numbers。# The syntax is =。 E。g。:## :2=andrew# :3=lisa:1=root

開啟服務

[root@centos8 ~]# systemctl daemon-reload[root@centos8 ~]# systemctl start vncserver@:1。service

如果是給非root建立的話需要切換到該使用者下產生vncpasswd

[root@centos8 ~]# su user[user@centos8 ~]$ vncpasswdPassword:Verify:Would you like to enter a view-only password (y/n)? nA view-only password is not used[user@centos8 ~]$ exitexit

測試是否VNCServer是否開起來

[root@centos8 ~]# nc -zv localhost 5901Ncat: Version 7。70 ( https://nmap。org/ncat )Ncat: Connected to ::1:5901。Ncat: 0 bytes sent, 0 bytes received in 0。01 seconds。

關閉防火牆或開啟埠許可權

關閉防火牆

[root@centos8 ~]# systemctl status firewalld● firewalld。service - firewalld - dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld。service; enabled; vendor preset: enabled) Active: active (running) since Sun 2020-06-21 22:40:18 CST; 14min ago Docs: man:firewalld(1) Main PID: 890 (firewalld) Tasks: 2 (limit: 11460) Memory: 29。7M CGroup: /system。slice/firewalld。service └─890 /usr/libexec/platform-python -s /usr/sbin/firewalld ——nofork ——nopidJun 21 22:40:16 centos8 systemd[1]: Starting firewalld - dynamic firewall daemonJun 21 22:40:18 centos8 systemd[1]: Started firewalld - dynamic firewall daemon。[root@centos8 ~]# systemctl stop firewalld

開啟埠許可權

–permanent永久生效,沒有此引數重啟後失效

[root@centos8 ~]# firewall-cmd ——zone=public ——add-port=5901/tcp ——permanentsuccess[root@centos8 ~]# firewall-cmd ——reloadsuccess

centos8 安裝VNC配置遠端連線

Top