安装软件包(有yum源安装的,不采用源码安装)

yum -y install vnc vnc-server

安装成功后,配置如下:

[root@localhost ~]# vncserver
#设置 VNC密码,输入:(在某用户下输入则登陆用户就是它,如果su imiss切换到imiss用户,输入vncserver则启动的是另一个桌面,同样要设置密码,以后在该账户下启动的vncserver登陆就需要在此用户下设置的密码了。)
You will require a password to access your desktops. Password:
Password must be at least characters - try again
Password:
Verify:
xauth: creating new authority file /root/.Xauthority New 'localhost.localdomain:1 (root)' desktop is localhost.localdomain: Creating default startup script /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/localhost.localdomain:.log [root@localhost ~]# vncpasswd
Password:
Password must be at least characters - try again
Password:
Verify:
[root@localhost ~]#

修改配置文件:

vim ~/.vnc/xstartup (最后两行)

#xterm -geometry 80x24++ -ls -title "$VNCDESKTOP Desktop" &
#twm &
gnome-session &

vim  /etc/sysconfig/vncservers  (最后两行)

# VNCSERVERS="2:myusername"
# VNCSERVERARGS[]="-geometry 800x600 -nolisten tcp -localhost"
VNCSERVERS="1:root"
VNCSERVERARGS[]="-geometry 800x600"

vi /etc/sysconfig/iptables (配置防火墙)

-A INPUT -m state --state NEW -m tcp -p tcp --dport  -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport -j ACCEPT
#VNC server 监听的端口从 5900 开始,display:1 的监听 5901,display:2 监听 5902,以此类推。CentOS 的防火墙缺省是不允许连接这些端口的,所以需要使用下面的步骤打开防火墙(需要 root 权限):
[root@localhost ~]# service iptables restart
iptables: Setting chains to policy ACCEPT: nat mangle filte[ OK ]
iptables: Flushing firewall rules: [ OK ]
iptables: Unloading modules: [ OK ]
iptables: Applying firewall rules: [ OK ]

启动服务

[root@localhost ~]# chkconfig vncserver on
[root@localhost ~]# service vncserver start
Starting VNC server: :root
New 'localhost.localdomain:2 (root)' desktop is localhost.localdomain: Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/localhost.localdomain:.log [ OK ]
[root@localhost ~]#

关闭vnc

vncserver -kill :
#注意kill后面要有一个空格

连接

centos 开启VNC的更多相关文章

  1. macOS 开启 VNC 远程桌面和 SSH 服务

    macOS 开启 VNC 远程桌面和 SSH 服务 准备用 macOS 来做为服务器,既然是服务器,那不可缺少的是远程管理,实际上 macOS 自带 VNC 远程桌面和 SSH 服务,只是默认没有开启 ...

  2. 05. 树莓派初始配置——开启VNC远程桌面

    开启VNC远程桌面 不插显示器就可以看到树莓派系统界面的方式. 1. 如果你下的系统镜像有包含一些基本软件(Raspberry Pi OS with desktop and recommended s ...

  3. CentOS 7.1安装GNOME,开启VNC Server

    版权声明:本文为博主原创文章,未经博主允许不得转载. A.准备: 1.安装GNOME Desktop yum groupinstall 'GNOME Desktop' 2.确认GNOME Deskto ...

  4. CentOS 7 开启VNC Service

    由於是透過 GUI 管理, 所以需要圖形桌面環境, 如果沒有安裝, 可以用以下指令安裝 GNOME: # yum groupinstall “GNOME Desktop” Centos 7安裝 VNC ...

  5. CentOS 5.11开启VNC Service

    1.     #yum install vncserver 2.     #vncpasswd       此密码将成为vnc的login password          password:    ...

  6. 基于CentOS搭建VNC远程桌面服务

    系统要求:CentOS 7.2 64 位操作系统 安装.启动 VNC VNC 远程桌面原理 名词解释: Xorg:在 Linux 用户中非常流行,已经成为图形用户程序的必备条件,所以大部分发行版都提供 ...

  7. centos安装VNC的方法

    https://help.aliyun.com/knowledge_detail/6698160.html(阿里云官方文档,但是官方文档有些地方是错的,我更正了下) ----------------- ...

  8. CentOS下VNC使用

    1. 介绍 本文主要介绍了VNC Server的配置和使用 2. 安装 CentOS中默认就有安装VNC,可以通过命令rpm查看 [Jerry@localhost ~]$ rpm -qa | grep ...

  9. CentOS 安装VNC Server

    环境 服务器:192.168.10.181 系统:CentOS 6.0 安装过程 1.切换至root用户 2.检测系统是否安装VNC [root@Nginx canyouNgx]# rpm -q vn ...

随机推荐

  1. python-数据类型补充及文件处理操作

    ___数据类型____ 一.列表的复制 浅复制和深复制 浅复制只复制一层,深复制完全克隆,慎用 1.实现浅复制的三种方式: name=['song','xiao','nan'] import copy ...

  2. lua upvalue

    转自http://blog.chinaunix.net/uid-52437-id-2108789.html Lua 中的函数是一阶类型值(first-class value),定义函数就象创建普通类型 ...

  3. Mysql慢查询操作梳理

    Mysql慢查询解释MySQL的慢查询日志是MySQL提供的一种日志记录,它用来记录在MySQL中响应时间超过阀值的语句,具体指运行时间超过long_query_time值的SQL,则会被记录到慢查询 ...

  4. 数据类型之记录(record)..With XXX do begin... end;

    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 type   Mai ...

  5. Struts2动态方法调用(DMI)

    当structs.xml解析到Action的时候,默认执行的是此action的execute()方法,但是实际开发中,我们的action中含有很多方法,比如说增删改查的方法,那么structs.xml ...

  6. 快速排名 让人疯狂的黑帽seo技术

    对于黑帽seo大家或许并不陌生,黑帽seo和白帽seo恰恰相反,是作弊手段.有白帽seo的时候,就有了黑帽seo一直到现在.但隔行如隔山这句话这句话一点都没错,再没接触黑帽seo技术之前我根本不知道黑 ...

  7. 【WPF】TextBox样式重写注意事项

    1.普通控件重写需要添加一行 <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="C ...

  8. CentOS上搭建Nginx + Mono 运行 asp.net

    安装步骤: 一.获取开源相关程序: 1.利用CentOS Linux系统自带的yum命令安装.升级所需的程序库: sudo -sLANG=Cyum -y install gcc gcc-c++ aut ...

  9. android 获取当前系统时间

    取得系统时间 1. long time=System.currentTimeMillis(); 2. final Calendar mCalendar=Calendar.getInstance(); ...

  10. 洛谷 1016 / codevs 1046 旅行家的预算

    https://www.luogu.org/problem/show?pid=1016 http://codevs.cn/problem/1046/ 题目描述 Description 一个旅行家想驾驶 ...