`
流落星辰
  • 浏览: 12080 次
  • 性别: Icon_minigender_1
社区版块
存档分类
最新评论

centos7使用vnc连接配置

阅读更多
[size=x-large]centos7配置vnc
1.安装tigervncserver,yum install tigervnc-server tigervnc-server-module
2.拷贝配置文件cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service

3.进入到配置文件目录cd /etc/systemd/system

4.修改配置文件vim vncserver@:1.service
[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target
[Service]
Type=forking
# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill :1 > /dev/null 2>&1 || :'
ExecStart=/sbin/runuser -l root -c "/usr/bin/vncserver :1 -geometry 1280x720 -depth 24"
PIDFile=/root/.vnc/%H%i.pid
ExecStop=/bin/sh -c '/usr/bin/vncserver -kill :1 > /dev/null 2>&1 || :'
[Install]
WantedBy=multi-us 


5.  启用配置文件 systemctl enable vncserver@:1.service

6. 设置登陆密码:vncpasswd

7. 启动vncserver:systemctl start vncserver@:1.service

8 . 启动状态查看:systemctl status vncserver@:1.serviceer.target
9.在iptables中加入对应的端口5901(注意,如果有其他用户,那么也需要将端口加上。vnc的端口默认是5900 + n)

[root@localhost system]# cat /etc/sysconfig/iptables
# sample configuration for iptables service
# you can edit this manually or use system-config-firewall
# please do not ask us to add additional ports/services to this default configuration
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
[color=red]-A INPUT -p tcp -m state --state NEW -m tcp --dport 5901 -j ACCEPT[/color]-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT

:wq! #保存退出

systemctl restart iptables.service #最后重启防火墙使配置生效

注意1、如果你不配置和启用防火墙,此时用VNC Viewer连接的话,会报:"connect:Connection timed out(10060)"错误。
2、本文是以root用户为例,如果其他用户也需要登录,那么,还需要将文件复制为
1
cp /lib/systemd/system/vncserver@.service /lib/systemd/system/vncserver@:2.service
同时,将文件内的%i改为2,并建立对应用户的vncpasswd。
3、
vncserver 启动失败的一种情况
#vncserver

Warning: localhost.localdomain:1 is taken because of /tmp/.X11-unix/X1
Remove this file if there is no X server localhost.localdomain:1

Warning: localhost.localdomain:2 is taken because of /tmp/.X11-unix/X2
Remove this file if there is no X server localhost.localdomain:2

New 'localhost.localdomain:3 (root)' desktop is localhost.localdomain:3

Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/localhost.localdomain:3.log

解决办法:

删除 / tmp/.X11-unix/的内容[/size]
分享到:
评论

相关推荐

    centos7系统VNC多用户配置.txt

    解决添加非root用户,VNC不能正常启动。本人实测操作文档,我采用centos7.2

    Windows下使用VNC连接CentOS7远程桌面

    在Windows操作系统下使用VNC连接CentOS7操作系统的远程桌面的配置步骤

    Centos 安装配置VNC,及使用方法和常见问题解决办法

    1.引言 大家都知道可以通过Xmanger的各种...2.管理者配置VNC 这部分命令需要使用sudo用户或者root用户。 2.1 安装VNC 首先安装vnc-server服务,完成后可见“Complete!” sudo yum install tigervnc tigervnc-server 2

    Centos6.2的VNC配置与连接

    现在Linux的使用面越来越广,很多服务器系统及应用都在向Linux的层面转移。目前我们来通过安装Centos来学习Linux的自定义及可扩展性,内容很多。 我们现在开始从安装开始,将ISO文件放入虚拟机里,看到如下界面: ...

    VNC 配置 Centos7

    VNC 配置 Centos7,此文档详细叙述了, CentOS配置VNC server的方法,以实现远程连接桌面

    VNC连接器(不需要输入密码)

    此VNC连接器,连接时不需要输入密码.很不错

    centOS通过VNC远程桌面管理配置教程

    centOS通过VNC远程桌面管理配置详细教程

    linux下realVNC安装使用

    centos6.2下安装realVNC,配置,在windows下通过vncviewer连接使用。 有需要的可以下载。

    CentOS 7安装TigerVNC Server

    CentOS7 配置 VNC 远程连接可视化界面 服务器端配置 操作步骤详细 关键注意点说明

    Centos中VNC远程桌面程序的安装与使用教程

    本文实例讲述了Centos中VNC远程桌面程序的安装与使用方法。分享给大家供大家参考,具体如下: 这里以centos 6.5为例 安装GNOME桌面环境 yum groupinstall X Window System Desktop CentOS安装Xfce桌面环境,可选 ...

    Centos6系统搭建tigervnc-server实现多用户访问.doc

    Centos 6系统搭建tigervnc-server实现多用户访问 1.CentOS 安装tigervncserver [root@vnc ~]# rpm -qa |grep tigervnc 2.配置vncservers,假设你有两个用户想要远程登录,用户名分别是user1,user2 [root@vnc ~]# ...

    VNC远程图形化桌面连接(含教程)

    VNC远程桌面连接,绝对好用。含配置安装教程,离线版和联网版本,支持CentoS远程桌面,支持Linux多用户桌面配置 CentOS远程图形化桌面维护工具

    liunx 安装KVM(win7)文档.docx

    vnc_password = "a123456" #vnc连接密码,后后面安装会用到 remote_display_port_min = 5900 #vnc最小端口 remote_display_port_max = 65535 #vnc最大端口 3、确认一下是否 kvm 安装成功: /etc/init.d/libvirtd ...

    CentOS7安装GUI界面及远程连接的实现

    用基于浏览器(webdriver)的...这条命令将安装GNOME桌面的必要软件包,执行完后配置X系统使用GNOME: echo exec gnome-session >> ~/.xinitrc 安装KDE或者MATE桌面环境的两个命令稍微不一样: # kde yum -y groups

    Linux/Windows远程桌面

    WINDOWS远程连接LINUX配置(LINUX VNC Server配置):  1.查看本机是否有安装vnc(centOS5默认有安装vnc)  rpm -q vnc vnc-server  如果显示结果为:  package vnc is not installed  vnc-server-4.1.2-...

    KasmVNC:现代VNC服务器和客户端,基于Web且安全

    KasmVNC在整个Kasm CDI基础结构中使用,但是,您可以将KasmVNC用于单个服务器。 KasmVNC与TigerVNC具有不同的目标: 基于Web的-KasmVNC旨在提供可访问Web的远程桌面。 它带有内置的Web服务器和Websocket服务器。...

    Windows和Linux实现远程桌面连接

    对于远程桌面连接Linux,大家可能会第一时间想到使用VNC,,远程桌面Windows,大家第一时间会想到使用Windows自带的远程桌面。那么有没有办法,使得在Linux中可以远程Windows,在Windows中远程桌面Linux?今天就跟...

Global site tag (gtag.js) - Google Analytics