Linux VMWare VNC远程桌面管理

一、linux vncserver环境配置:
1.vncserver和gnome安装软件包:

yum install tigervnc-server -y
yum groups install GNOME
yum groupinstall "GNOME Desktop"
yum groups install "Virtualization Hypervisor" "Virtualization Platform" "Virtualization Tools" "Virtualization Client" "Virtualization"

 

2. 启用配置文件:

cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service
systemctl enable /etc/systemd/system/vncserver@:1.service

 

3.daemon-reload:

systemctl daemon-reload

 

4.设置vnc password:

vncpasswd

 

5.启动vnc server:

vncserver 
或
systemctl start vncserve

 

6.查看端口状态:

netstat -lnt | grep 590*

 

7.防火墙端口放行:

iptables -I INPUT -p tcp --dport 5901 -j ACCEPT

 

8.查看报错信息:

grep vnc /var/log/messages 或 cat /root/.vnc/test-server:1.log

 

调试:
查看vnc启动脚本:

# cat /root/.vnc/xstartup 
#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
/etc/X11/xinit/xinitrc
gnome-session &

 

vnc服务重启:

ps -ef |grep vnc |grep -v grep|awk '{print $2}'|xargs -i kill -9 {}
rm -f /tmp/.X*-lock
rm -f /tmp/.X11-unix/*

 

二、vnc viewer客户端连接:
客户端PC下载连接程序 VNC-Viewer-6.1.1-Windows-64bit.exe 并运行:

 

点击file,新建connection:

VNC-server输入ip:port,点击OK。

 

三、vnc-viewer连接 vncserver报错解决:
1.vnc-viewer 连上空白:
1).安装gnome:yum groupinstall "GNOME Desktop" "Graphical Administration Tools"
2).安装时报错冲突:
  yum -y remove 冲突包 或 rpm -e 冲突包
3).先到/root/.vncserver/目录下,打开文件xstartup 。将里面的最后一行 twn & 改成gnome-session & (即可视化界面)
2.vnc黑屏解决:执行 chmod 777 /root/.vnc/xstartup

3.vnc连上桌面启动vmware报错:
  报错1: header files matching your running kernel were not found.
  报错2:kernel headers for version 3.10.0-327.el7.x86_64 were not found
  查看:

     #rpm -qa |grep kernel-headers
    kernel-headers-3.10.0-957.1.3.el7.x86_64
    #uname -r
    3.10.0-327.el7.x86_64 

 


解决:
1.之前已安装gcc,yum不指定版本进行自动拉取版本时系统默认安装最新版本kernel-headers,所以需要先卸载之前的kernel-headers:

# yum remove kernel-headers -y

2. 安装内核对应版本的 kernel-headers and kernel-devel:

# yum install kernel-headers-$(uname -r) kernel-devel-$( uname -r) -y

3. 安装gcc:

$ yum install gcc gcc-c++ make -y

 

posted @ 2018-12-14 18:21  Sunmer09  阅读(1380)  评论(0编辑  收藏  举报