合规国际互联网加速 OSASE为企业客户提供高速稳定SD-WAN国际加速解决方案。 广告
VNC(Virtual Network Console)是在基于 UNIX 和 Linux 操作系统的免费的开源软件。 ## 服务器端配置 查询vnc-sever ``` yum provides vnc-server yum info tigervnc-server ``` 安装vnc-sever ``` yum install tigervnc-server -y ``` 创建用户 ``` useradd user01 passwd user01 ``` 切换用户,启用vnc ``` su - user01 vncserver :1 You will require a password to access your desktops. Password: Verify: Would you like to enter a view-only password (y/n)? n A view-only password is not used xauth: file /home/user01/.Xauthority does not exist New 'centos701:1 (user01)' desktop is centos701:1 Creating default startup script /home/user01/.vnc/xstartup Creating default config /home/user01/.vnc/config Starting applications specified in /home/user01/.vnc/xstartup Log file is /home/user01/.vnc/centos701:1.log exit ``` 查询socket statistics状态 ``` ss -antp | grep 5901 ``` 设置防火墙例外(TCP 5901 - TCP 5910) ``` firewall-cmd --permanent --add-port=5901-5910/tcp firewall-cmd --reload firewall-cmd --list-ports ``` 设置 / 重置vnc密码 ``` su - user01 vncpasswd ``` 查询vnc会话,结束vnc会话 ``` su - user01 vncserver -list vncserver -kill :1 ``` 开机自动启动服务 ``` cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service vi /etc/systemd/system/vncserver@:1.service # 替换<USER>为user01 systemctl daemon-reload systemctl enable vncserver@:1.service ``` 查询服务配置 /etc/systemd/system/vncserver@:1.service ``` cat /etc/systemd/system/vncserver@:1.service | grep -v "^#" [Unit] Description=Remote desktop service (VNC) After=syslog.target network.target [Service] Type=forking ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :' ExecStart=/usr/sbin/runuser -l user01 -c "/usr/bin/vncserver %i" PIDFile=/home/user01/.vnc/%H%i.pid ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :' [Install] WantedBy=multi-user.target ``` 报错1:Authentication is required to set the network proxy used for downloading packages 修改配置文件 vi /etc/xdg/autostart/gpk-update-icon.desktop,在底部添加 ``` X-GNOME-Autostart-enabled=false ``` on Redhat 7 ``` # redhat Authentication is required to set the network proxy used for downloading software # To Disable the message in Red Hat Enterprise Linux 7 yum install gnome-software sed -e '$aX-GNOME-Autostart-enabled=false' -e '/X-GNOME-Autostart-enabled/d' -i.bak /etc/xdg/autostart/gnome-software-service.desktop ``` 报错2:Could not connect to session bus: Failed to connect to socket /tmp/dbus-JS7ByyeJhx: Connect refused 如果安装了conda,尝试卸载conda dbus ``` conda uninstall dbus ``` ## 客户端配置 查询vncviewer ``` yum provides vncviewer yum info tigervnc ``` 安装vncviewer ``` yum install tigervnc -y ``` 使用vncviewer ``` vncviewer ```