CentOS7安裝遠端桌面軟體VNC Server

2021-09-13 09:39:08 字數 2640 閱讀 3221

如果伺服器為centos7_minimal版本,則需要安裝desktop(伺服器系統為centos7_desktop則忽略)

yum groupinstall -y "gnome desktop"
關閉防火牆

systemctl stop firewalld

systemctl disable firewalld

[root@localhost ~]# firewall-cmd --state #檢視防火牆是否關閉

not running

1.安裝vnc server

yum install -y tigervnc-server tigervnc-server-module
2.複製vnc server的配置檔案

vncserver@:1.service、vncserver@:2.service為連線不同的遠端桌面,連線ip為ip:1、ip:2

(即為提供2個遠端連線方式,vnc server:ip:1、ip:2)

cp /lib/systemd/system/[email protected] /lib/systemd/system/vncserver@:1.service

cp /lib/systemd/system/[email protected] /lib/systemd/system/vncserver@:2.service

3.修改vncserver@:1.service、vncserver@:2.service配置檔案

[root@localhost ~]# vi /lib/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 -c "/usr/bin/vncserver %i"

#use root to login --guy_go

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

#use root to login --guy_go

#pidfile=/home//.vnc/%h%i.pid

pidfile=/root/.vnc/%h%i.pid

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

[install]

wantedby=multi-user.target

systemctl daemon-reload
5.設定vnc server密碼

[root@localhost ~]# vncpasswd

password:

verify:

passwords don't match - try again

password:

[root@localhost ~]# vncpasswd

password:

verify:

would you like to enter a view-only password (y/n)? n

a view-only password is not used

6.啟動vnc server

[root@localhost ~]# vncserver	#啟動第乙個遠端桌面

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

log file is /root/.vnc/localhost.localdomain:1.log

[root@localhost ~]# vncserver #啟動第二個遠端桌面

new 'localhost.localdomain:2 (root)' desktop is localhost.localdomain:2

log file is /root/.vnc/localhost.localdomain:2.log

[root@localhost ~]#

或使用以下命令啟動

systemctl start vncserver@:1.service

systemctl start vncserver@:2.service

7.關閉vncserver

pkill -9  vnc	或 systemctl stop vncserver@:1.service

Centos7 遠端桌面

一般我們安裝centos系統都會安裝桌面系統,如果沒有安裝桌面程式先執行以下命令安裝桌面系統 安裝gnome centos yum upgrade y的作用 如果安裝過程中有y n的選擇,一路選擇y執行 yum y groupinstall x window system yum y groupin...

CentOS 7 安裝xrdp 遠端桌面

首先你需要安裝gnome,這裡就不介紹了 安裝 1.準備環境 首先安裝 epel and nux desktoprepository rpms,注意版本更新 如果rpm包版本已經不存在,把鏈結的前面copy下來用瀏覽器開啟,查詢最新版本,然後更換 rpm uvh rpm uvh 2.開始安裝 xrd...

Centos7遠端桌面 vnc server設定

1 假定你的系統沒有安裝vnc的任何軟體,那麼,首先安裝vnc yum y install tigervnc server tigervnc 2 centos7之前的系統,如果安裝vnc一般都需要配置 cat etc sysconfig vncservers this file has been r...