CentOS 8.2下VNC安裝與配置

DJXHC發表於2020-11-10

CentOS 8.1下VNC安裝與配置

1.VNC安裝命令
[root@localhost /]# yum install -y tigervnc-server
2.編輯VNC配置
[root@localhost /]# cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service
注:拷貝一個新的配置檔案,以開啟1號視窗為例(想要同時開啟多個視窗,修改其中數字即可)

[root@localhost /]# vi /etc/systemd/system/vncserver@:1.service

[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target

[Service]
Type=simple

Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=/bin/sh -c ‘/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :’
ExecStart=/usr/bin/vncserver_wrapper %i #將文中的“”替換為你係統的使用者名稱root

ExecStop=/bin/sh -c ‘/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :’

[Install]
WantedBy=multi-user.target
3.更新配置檔案
[root@localhost /]# systemctl daemon-reload
4.設定root的vncserver密碼
[root@localhost /]# vncpasswd
Password: #新密碼:123456
Verify: #再次輸入:123456
Would you like to enter a view-only password (y/n)? n
A view-only password is not used
[root@localhost /]#
5.啟動服務並設為開機啟動
[root@localhost /]# systemctl start vncserver@:1.service
[root@localhost /]# systemctl enable vncserver@:1.service

相關文章