【VNC】How To Install and Configure VNC Remote Access for the GNOME Desktop on CentOS 7

一、實驗環(huán)境

操作系統(tǒng):CentOS7.3 桌面版

用戶: 管理員root、普通用戶Michael

二、安裝 VNC server

# yum ?-y install epel-release

# ??yum ?-y?install tigervnc-server

三、配置?

VNC server

# cp /lib/systemd/system/vncserver@.service ? ?/etc/systemd/system/vncserver@:1.service

# cp /lib/systemd/system/vncserver@.service ? ?/etc/systemd/system/vncserver@:2.service

# vim ?/etc/systemd/system/vncserver@:1.service

#####################################################

[Unit]

Description=Remote desktop service (VNC)

After=syslog.target network.target

[Service]

Type=forking

# Clean any existing files in /tmp/.X11-unix environment

ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'

ExecStart=/usr/sbin/runuser -l?root ?-c "/usr/bin/vncserver %i"

PIDFile=/root/.vnc/%H%i.pid

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

[Install]

WantedBy=multi-user.target

######################################################

# vim ?/etc/systemd/system/vncserver@:2.service

#####################################################

[Unit]

Description=Remote desktop service (VNC)

After=syslog.target network.target

[Service]

Type=forking

# Clean any existing files in /tmp/.X11-unix environment

ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'

ExecStart=/usr/sbin/runuser -l?Michael?-c "/usr/bin/vncserver %i"

PIDFile=/home/Michael/.vnc/%H%i.pid

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

[Install]

WantedBy=multi-user.target

#####################################################

四、設(shè)置密碼

# vncserver

# su - Michael

$ vncserver

.

注:設(shè)置和修改密碼,需切換到相應(yīng)用戶,第一次設(shè)置密碼用 vncserver,以后如果需要修改密碼,用 vncpasswd

五、 啟動服務(wù)

# systemctl daemon-reload

# systemctl enable vncserver@:1.service

# systemctl enable vncserver@:2.service

# systemctl start ? vncserver@:1.service

# systemctl start ? vncserver@:2.service

# systemctl status ? ?vncserver@:1.service

# systemctl status ? ?vncserver@:2.service

六、設(shè)置防火墻

# systemctl start firewalld

# systemctl enable firewalld

# firewall-cmd --permanent --add-service vnc-server

# firewall-cmd --reload

七、安裝VNC客戶端

Windows上使用VNC Viewer連接遠程CentOS服務(wù)器

https://www.realvnc.com/en/connect/download/vnc/windows

八、參考

怎樣在 CentOS 7.0 上安裝和配置 VNC 服務(wù)器

https://linux.cn/article-5335-1.html

Download and Install VNC Viewer on Windows

https://www.realvnc.com/en/connect/download/viewer/windows


How to Install and Configure VNC Server in CentOS 7 / RHEL 7

https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/ch-tigervnc

https://www.itzgeek.com/how-tos/linux/centos-how-tos/configure-vnc-server-on-centos-7-rhel-7.html

How To Install and Configure VNC Remote Access for the GNOME Desktop on CentOS 7

https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-vnc-remote-access-for-the-gnome-desktop-on-centos-7

How To Set Up SSH Tunneling on a VPS

https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-tunneling-on-a-vps

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容