CentOS 7 安装 VNC Server
- 【来源】: 原创【作者】:青稞【发布时间】:2015-08-06 【浏览】:205479
-
CentOS 7 安装 VNC Server
透过 VNC 是一套支持 Linux 及 Windows 的远程管理软件, 可以让用户用其他计算机, 用 VNC-Client 作图形接口 (GUI) 远程管理。以下会介绍在 RHEL 及 CentOS 7 (Fedora 应该也适用) 安装 VNC Server 的步骤。
由于是透过 GUI 管理, 所以需要图形桌面环境, 如果没有安装, 可以用以下指令安装 GNOME:
# yum groupinstall "GNOME Desktop"
安装 VNC Server:
# yum install tigervnc-server
安装好 VNC Server 后, 现在要设定 VNC 用户, 下面会以 phpini 作为例子:
# useradd phpini
CentOS 7 的 VNC Server 配置文件在 /lib/systemd/system/vncserver@.service (以前是 /etc/sysconfig/vncservers), 用这个配置文件为基础建立新的配置文件, 然后再编辑新建立的配置文件:
# cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service
# vi /etc/systemd/system/vncserver@:1.service
将里面的 改成上面设定的用户名称, 例如:
[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=/sbin/runuser -l-c "/usr/bin/vncserver %i"
#PIDFile=/home//.vnc/%H%i.pid
ExecStart=/sbin/runuser -l phpini -c "/usr/bin/vncserver %i"
PIDFile=/home/phpini/.vnc/%H%i.pid
ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
设定 Firewall 开启 VNC 连接对外开放:
# firewall-cmd -permanent -zone=public -add-service vnc-server
# firewall-cmd -reload
现在用 su 切换用户身份到 phpini, 并开启 VNC 服务:
$ su - phpini
$ vncpasswd
然后设定 VNC 密码, 这个密码不同系统密码, 是用作连接 VNC Server 的。
设定好后, 用 su 切换回 root 身份并设定开机自动执行 VNC Server:
$ su -
# systemctl daemon-reload
# systemctl start vncserver@:1.service
# systemctl enable vncserver@:1.service
Linux下安装相应桌面环境与vnc
: http://www.ykw123.com/VNC/new_content/10-190
VNC Linux 32位版: http://www.ykw123.com/download_info/94
VNC Linux 64位版: http://www.ykw123.com/download_info/93
本文地址:http://www.ykw123.com/netman/new_content/12-243.html,转载请注明。
下一篇:GoToMyCloud使用步骤
相关资讯

编辑推荐
更多>>



热门标签
您还可以这样联系我们
