[实践OK]最小化安装centos7.4配置桌面图形,Centos7.4 安装 vnc并vnc实现开机启动,CentOS7.4xfc桌面运行VNC Server连接时只显示浏览器无桌面时的成功解决方案。解決Windows 7 的VNC connection reset by peer 10054錯誤,MacBook vnc使用方法。

jackxiang 2014-6-28 22:40 | |
Centos7.7安装vncserver虚拟网络控制台:
https://www.linuxprobe.com/centos7-virtual-network-console.html
sudo systemctl enable vncserver@:2
Created symlink from /etc/systemd/system/multi-user.target.wants/vncserver@:2.service to /etc/systemd/system/vncserver@:2.service.

server already running on display :1
/bin/startxfce4: X server already running on display :1

重启服务时这里可能会提示 A VNC server is already running as :1 [FAILED]的错误,解决方法见下。
vncserver -kill :1
Killing Xvnc process ID 3654,VNCServer使用方法
[root@localhost ~]# vncserver :1    启动:1
[root@localhost ~]# vncserver :2    启动:2
[root@localhost ~]# ps -ef|grep -i xvnc   查看已启动的server
[root@localhost ~]# vncserver -kill :1    杀死:1


解決Windows 7 的VNC connection reset by peer 10054錯誤:
當Windows 7 更新到某個程度,原本可以正常運作的VNC連接就會突然出現VNC connection reset by peer 10054錯誤,然後就無法用VNC Viewer連上這台Windows 7 電腦。 無論是使用哪種VNC Server,如TightVNC或RealVNC都無法修正此問題。

查Google之後,發現只有Windows 7會有這種「相容性」問題,其他版本的Windows就不會,因此,一個簡單的解決辦法就是將VNC的Server執行程式改成相容模式執行。以RealVNC Server為例,首先找到VNC Server程式的位置(通常是C:\Program Files\RealVNC\VNC4),右鍵點選Server程式(winvnc4.exe)->內容->相容性->勾選以相容模式執行這個程式,選擇不是Windows 7的其他選項。最後,到電腦管理中的「服務」,重新啟動VNC Server就可以連接了。
来自:http://eportfolio.lib.ksu.edu.tw/~T093000298/blog?node=000000209
解决vncserver卡死,报错connection reset by peer (10054)
在连接慢速网络环境到vncserver服务器的时候,经常动不动就失去响应。过一会而vncview提示连接被远程断开,解决的办法有2个:
1. vnc view option菜单,选择inputs, 勾选Rate-limit mouse move events,这样可以节省带宽,提升一些响应速度
2. Coloure Level 选择256色,不要用full color,最新版本的VncViewer,这个叫Picture Quality 选:Low,Download Url:https://www.realvnc.com/download/file/viewer.files/VNC-Viewer-6.17.1113-Windows-32bit.exe

以上两条一起用,上面颜色没看到,勾选Rate-limit mouse move events是可以的。
3.把VPC的分辨率调低一点:#vncserver :1 -geometry 1024x768
vncserver :1 -geometry 800x600   ,以上三条后,在公司 访问就Ok了,不再出现错误了,感觉还是带宽不够。

1)stop vnc server from linux terminal:
~/stopvncserver.sh


new Test port always 5902,like this is ok:


2)start vnc server from linux terminal:
~/startvncserver.sh


真实实践:
一)实践没有问题的脚本:
cat /home/irdcops/shell/vncsvr/startvncsvr.sh
cat /home/ops/shell/vncsvr/startvncsvr.sh





二)vnc的端口情况(如何修改linux里的VNC的默认端口5901):


三)Iptable得放开这个端口,否则连接不上:

总论详细文章Url:http://www.tuicool.com/articles/zQrQNz


四)出现空白桌面,啥也没有,只看到浏览器(没安装浏览器也就啥也没有),没有xfe桌面的情况解决,实践OK:
cat /root/.vnc/xstartup


五)出现VNC:1本来不存在,缺提示存在的情况:
vncserver :1 -geometry 1024x768
A VNC server is already running as :1
并不是真的在运行,其原因是vncconfig进程在,于是干死重来:
ps -ef|grep vnc
root     26027     1  0 10:23 pts/4    00:00:00 vncconfig -iconic
kill -9 26027



六)重启的SHell:
/home/irdcops/shell/vncsvr/startvncsvr.sh
/home/ops/shell/vncsvr/startvncsvr.sh


七)定时Cron:
/home/irdcops/shell/vncsvr/startvncsvrcron.sh


问题依旧,vi +168 /usr/bin/vncserver:
162 # Find display number.
163 if ((@ARGV > 0) && ($ARGV[0] =~ /^:(\d+)$/)) {
164     $displayNumber = $1;
165     shift(@ARGV);
166     if (!&CheckDisplayNumber($displayNumber)) {
167         warn "A VNC server is already running as :$displayNumber\n";
168         $displayNumber = &GetDisplayNumber();                                
169     }
170 } elsif ((@ARGV > 0) && ($ARGV[0] !~ /^-/) && ($ARGV[0] !~ /^\+/)) {
171     &Usage();
172 } else {
173     $displayNumber = &GetDisplayNumber();
174 }

来自:https://github.com/TigerVNC/tigervnc/issues/531


六)VNCView端:
1.安装xwindow system
#yum groupinstall "X Window System"
2.安装GNOME
#yum groupinstall "Desktop"
3.安装中文支持
#yum groupinstall chinese-support
4.修改启动级别为5
#vi /etc/inittab
改default 5


七)加入systemctl:
# cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service
# vi /etc/systemd/system/vncserver@:1.service

systemctl daemon-reload
systemctl start vncserver@:1.service
systemctl enable vncserver@:1.service


八)tail -f /root/.vnc/levoo-bigdata_kafka-logstash_bj_rfls_10_10_0_100---解决失败!!!第二天解决成功@[实践OK]centos7 tigervnc 安装(非root用户的配置):https://jackxiang.com/post/10039/


\:1.log  /var/log/messages出现:XIO: fatal IO error 11 (Resource temporarily unavailable) on X server ":1"
centos 黑屏

查看日志 ~/.vnc/localhost.localdomain:0.log

/home/cake/.vnc/xstartup: line 27: xsetroot: command not found
/home/cake/.vnc/xstartup: line 28: xterm: command not found
/home/cake/.vnc/xstartup: line 29: twm: command not found
XIO: fatal IO error 11 (Resource temporarily unavailable) on X server “:0″^M
after 141 requests (140 known processed) with 0 events remaining.^M

因为xsetroot/xterm/twm没有安装导致的。
CentOS7还不一样,得这样:https://github.com/plembo/onemoretech/wiki/20140824-twm-on-centos-7
实践如下:http://ftp.stu.edu.tw/Linux/CentOS/6/os/x86_64/Packages/xorg-x11-twm-1.0.3-5.1.el6.x86_64.rpm
rpm -ihv xorg-x11-twm-1.0.3-5.1.el6.x86_64.rpm
warning: xorg-x11-twm-1.0.3-5.1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID c105b9de: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:xorg-x11-twm-1:1.0.3-5.1.el6     ################################# [100%]
yum install xsetroot -y
Package xorg-x11-server-utils-7.7-20.el7.x86_64 already installed and latest version

于是使用yum安装:

yum install xsetroot -y
yum install xterm -y
yum install twm -y
kill掉vncserver进程,然后重新启动。来自:http://blog.51cto.com/zhangguangjun/2047209
vncserver -kill :1
vncserver :1

yum remove xterm -y
yum remove twm -y
yum remove xsetroot -y

来自:http://javacxn.blog.163.com/blog/static/1832776420139269545905/
======================================================================
Centos 6.4 安装 vnc:
安装:vnc
sudo yum install tigervnc  tigervnc-server
安完后先设置密码:
vncpasswd

启动:
vncserver :1
查看:
vncserver -list
杀死进程 :
vncserver -kill :1

远程连接:
用vnc软件,之后输入地址,如:mycclove.oicp.net:5901
119.10.6.23:5901

第二个屏则是:
119.10.6.23:2
1152x864

注意一点:需要在iptables中添加一条规则
-A INPUT -m state --state NEW -m tcp -p tcp --dport 5901 -j ACCEPT


========================
补充:
在windows下连接vnc有一个vncviewer软件,我在ubuntu中有现成的软件, 在CentOS中安装tigervnc后就出现了vncviewer的命令,就可以连接到服务器的vnc了。

连接之后黑屏:
把 用户下面的.vnc/目录下的xstartup添加777权限

来自:http://blog.sina.com.cn/s/blog_6c9d65a10101dyt0.html


设置VNC服务随系统启动自动加载
第一种方法:使用“ntsysv”命令启动图形化服务配置程序,在vncserver服务前加上星号,点击确定,配置完成。
第二种方法:使用“chkconfig”在命令行模式下进行操作,命令使用如下(预知chkconfig详细使用方法请自助式man一下)
[root@testdb ~]# chkconfig vncserver on
[root@testdb ~]# chkconfig --list vncserver
vncserver       0:off   1:off   2:on    3:on    4:on    5:on    6:off

摘自:http://blog.csdn.net/alvin969/article/details/6170884

附加:http://www.linuxidc.com/Linux/2012-11/73471.htm
1、which  vncserver  得到VNC Server运行脚本所在位置。
RHEL5默认为:/usr/bin/vncserver
2、使用vi打开vncserver
vi /usr/bin/vncserver
3、查找到默认的分辨率:1024X768,然后进行修改。该行在注释结束的第一段参数部分。根据实际使用显示器的分辨率,修改该参数。
4、修改完vncserver后,重新执行vncserver时即以新的分辨率开始。
5、验证:ps -ef | grep vnc,可以看到所显示的分辨率参数为修改后的参数。


Mac自带VNC Client,MacBook vnc使用方法:
由于有需要远程VNC的需要,苦苦寻找一款Mac上比较好使的VNC Client,结果经人指点,发现原来MacOS自带了VNC Client,只是没有在Launchpad中显示罢了。使用command+space 调出Spotlight搜索键入screen Sharing.app即可。

来自:https://notes.wanghao.work/2016-11-24-Mac%E8%87%AA%E5%B8%A6VNC-Client.html

作者:jackxiang@向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除
地址:http://jackxiang.com/post/7303/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!


最后编辑: jackxiang 编辑于2022-3-26 12:24
评论列表
发表评论

昵称

网址

电邮

打开HTML 打开UBB 打开表情 隐藏 记住我 [登入] [注册]