码迷,mamicode.com
首页 > 其他好文 > 详细

在Centos上安装VNC server

时间:2019-05-29 14:23:44      阅读:126      评论:0      收藏:0      [点我收藏+]

标签:emctl   lang   ini   tail   pass   status   tmp   configure   规则   

1.安装Gnome桌面

yum groupinstall "GNOME Desktop" "Graphical Administration Tools" -y
yum groupinstall "X Window System" "Desktop" -y

2.安装VNC Server

yum install tigervnc tigervnc-server -y

3.配置VNC

a.将/lib/systemd/system/vncserver@.service文件复制一份

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

b.将vncserver@:1.service文件中得<USER>修改为VNC Client连接的账号,这里修改为root了,PIDFile也需要修改下,文件内容如下:

[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target

[Service]
Type=forking
User=root

ExecStartPre=-/usr/bin/vncserver -kill %i
ExecStart=/usr/bin/vncserver %i
PIDFile=/root/.vnc/%H%i.pid
ExecStop=-/usr/bin/vncserver -kill %i

[Install]
WantedBy=multi-user.target

c.设置VNCServer密码 vncpasswd

d.启动并设置VNCServer为开机自启动

systemctl start vncserver@:1.service
systemctl enable vncserver@:1.service

如果启动报错:

Job for vncserver@:1.service failed because a configured resource limit was exceeded. See "systemctl status vncserver@:1.service" and "journalctl -xe" for details.

把/root/.vnc/xstartup里的vncserver -kill $DISPLAY注释掉

#!/bin/sh

unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
/etc/X11/xinit/xinitrc
#vncserver -kill $DISPLAY

 

或者systemctl daemon-reload

或者直接删除/tmp/.X11-unix/目录 rm /tmp/.X11-unix/ -rf

重启服务

vncserver -kill :1

vncserver :1
如果防火墙是enable的,必须保证如下规则

firewall-cmd --permanent --add-service="vnc-server" --zone="public"
firewall-cmd --reload

 







在Centos上安装VNC server

标签:emctl   lang   ini   tail   pass   status   tmp   configure   规则   

原文地址:https://www.cnblogs.com/ningcoding-life/p/10943417.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!