一、适用说明和注意事项
UOS服务器系统ISO镜像中包含VNC,可以在安装系统时选择安装,若未安装则可按照本文方法进行安装和配置。该方法适用于UOS服务器系统a/e版,安装UOS系统时选择带图形化界面的模式,且以root用户执行以下步骤中的命令。
二、安装步骤
2.1 关闭本机防火墙
systemctl stop firewalld ; systemctl disable firewalld systemctl stop ebtables ; systemctl disable ebtables systemctl stop iptables ; systemctl disable iptables systemctl stop ip6tables ; systemctl disable ip6tables systemctl stop nftables ; systemctl disable nftables systemctl mask firewalld systemctl mask ebtables systemctl mask iptables systemctl mask ip6tables systemctl mask nftables
2.2 安装VNC
yum install x11vnc
2.3 修改配置文件
cp /lib/systemd/system/x11vnc.service /lib/systemd/system/x11vnc.service.bak
vim /lib/systemd/system/x11vnc.service (将x11vnc.service文件修改为如下内容)
[Unit] Description=Start x11vnc at startup. After=multi-user.target
[Service] Type=simple ExecStart=/usr/bin/x11vnc -auth /var/run/lightdm/root/:0 -forever -loop -noxdamage -repeat -rfbauth /etc/x11vnc.pwd -rfbport 5900 -shared ExecStop=/bin/kill ${MAINPID} RemainAfterExit=yes
[Install] WantedBy=multi-user.target
2.4 配置vnc密码
x11vnc -storepasswd mv ~/.vnc/passwd /etc/x11vnc.pwd
2.5 启动服务
systemctl daemon-reload systemctl enable x11vnc systemctl restart x11vnc
安装完成后在启动器可以看到X11VNC Server图标,注意vnc的默认端口是5900,网络防火墙需要提前放行该端口。
三、远程访问
本例远程访问客户端使用TigerVNC,UOS桌面系统可以通过应用商店安装,如下所示。
打开VNC查看器,输入要远程连接的服务器ip地址后,点击【连接】按钮后输入步骤2.4中配置的vnc密码点击【确定】即可远程访问服务器。
评论前必须登录!
注册