Centos5 install vnc

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

很详细的install steps:

http://wiki.centos.org/HowTos/VNC-Server#head-76401321dae4d80916a7fd7e710272a9b85c9485

 

--------------------------------------------------------------------------------------------------------------------------------------

VNC is used to display an X windows session running on another computer. Unlike a remote X connection, the xserver is running on the remote computer, not on your local workstation. Your workstation ( Linux or Windows ) is only displaying a copy of the display ( real or virtual ) that is running on the remote machine.

There are several ways to configure the vnc server. This HOWTO shows you how to configure VNC using the 'vncserver' service as supplied by CentOS.

1. Installing the required packages

The server package is called 'vnc-server'. Run the command rpm -q vnc-server.

The result will be either package vnc-server is not installed or something like vnc-server-4.0-11.el4.

If the server is not installed, install it with the command: yum install vnc-server.

The client program is 'vnc'. You can use the command yum install vnc to install the client if rpm -q vnc shows that it is not already installed.

Make sure to install a window manager in order to get a normal GUI desktop. You can use the command yum groupinstall "GNOME Desktop Environment" to install the Gnome Desktop and requirements, for example. Other popular desktop environments are "KDE" and "XFCE-4.4". XFCE is more light-weight than Gnome or KDE and available from the "extras" repository.

<!> If you are running CentOS 5, yum groupinstall "GNOME Desktop Environment" may complain about a missing libgaim.so.0. This is a known bug. Please see CentOS-5 FAQ for details.

<!> If you are running CentOS 6, the server is tigervnc-server not vnc-server.

2. Configuring un-encrypted VNC

We will be setting up VNC for 3 users. These will be 'larry', 'moe', and 'curly'.

You will perform the following steps to configure your VNC server:

  1. Create your VNC users.
  2. Set your users' VNC passwords.
  3. Edit the server configuration.
  4. Create and customize xstartup scripts.
  5. Start the VNC service.
  6. Test each VNC user.
  7. Setup the VNC service to start on reboot.
  8. Additional optional enhancements

2.1. Create your VNC users

As root:

$ su -# useradd larry# useradd moe# useradd curly# passwd larry# passwd moe# passwd curly

2.2. Set your users' VNC passwords

Login to each user, and run vncpasswd. This will create a .vnc directory.

[~]$ cd .vnc[.vnc]$ lspasswd

2.3. Edit the server configuration

Edit /etc/sysconfig/vncservers, and add the following to the end of the file.

VNCSERVERS="1:larry 2:moe 3:curly"VNCSERVERARGS[1]="-geometry 640x480"VNCSERVERARGS[2]="-geometry 640x480"VNCSERVERARGS[3]="-geometry 800x600"

Larry will have a 640 by 480 screen, as will Moe. Curly will have an 800 by 600 screen.

2.4. Create xstartup scripts ( Skip this step for CentOS 6 )

We will create the xstartup scripts by starting and stopping the vncserver as root.

# /sbin/service vncserver start# /sbin/service vncserver stop

Login to each user and edit the xstartup script. To use Larry as an example, first login as larry

[~]$ cd .vnc[.vnc] lsmymachine.localnet:1.log  passwd  xstartup

Edit xstartup. The original should look like:

#!/bin/sh# Uncomment the following two lines for normal desktop:# unset SESSION_MANAGER# exec /etc/X11/xinit/xinitrc[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresourcesxsetroot -solid greyvncconfig -iconic &xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &twm &

Add the line indicated below to assure that an xterm is always present, and uncomment the two lines as directed if you wish to run the user's normal desktop window manager in the VNC. Note that in the likely reduced resolution and color depth of a VNC window the full desktop will be rather cramped and a look bit odd. If you do not uncomment the two lines you will get a gray speckled background to the VNC window.

#!/bin/sh# Add the following line to ensure you always have an xterm available.( while true ; do xterm ; done ) &# Uncomment the following two lines for normal desktop:unset SESSION_MANAGERexec /etc/X11/xinit/xinitrc[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresourcesxsetroot -solid greyvncconfig -iconic &xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &twm &

2.5. Start the VNC server

Start the vncserver as root.

# /sbin/service vncserver start

2.6. Test each VNC user

2.6.1. Testing with a java enabled browser

Let us assume that mymachine has an IP address of 192.168.0.10. The URL to connect to each of the users will be:

Larry is http://192.168.0.10:5801Moe   is http://192.168.0.10:5802Curly is http://192.168.0.10:5803

Connect to http://192.168.0.10:5801. A java applet window will pop-up showing a connection to your machine at port 1. Click the [ok] button. Enter larry's VNC password, and a 640x480 window should open using the default window manager selected for larry . The above ports  5801, 5802 and 5803  must be open in the firewall {iptables) for the source IP addresses or subnets of a given client.

2.6.2. Testing with a vnc client

For Larry: vncviewer 192.168.0.10:1For   Moe: vncviewer 192.168.0.10:2For Curly: vncviewer 192.168.0.10:3

To test larry using vncviewer, vncviewer 192.168.0.10:1. Enter Larry's VNC password, and a 640x480 window should open using Larry's default window manager. The vncviewer client will connect to port 590X where X is an offset of 1,2,3 for Larry, Moe, and Curly respectively, so these ports must be open in the firewall for the IP addresses or subnets of the clients.

2.6.3. Starting vncserver at boot

To start vncserver at boot, enter the command /sbin/chkconfig vncserver on.

For basic VNC configuration the procedure is now complete. The following sections are optional refinements to enhance security and functionality.

3. VNC encrypted through an ssh tunnel

You will be connecting through an ssh tunnel. You will need to be able to ssh to a user on the machine. For this example, the user on the vncserver machine is Larry.

  1. Edit /etc/sysconfig/vncservers, and add the option -localhost.
    VNCSERVERS="1:larry 2:moe 3:curly"VNCSERVERARGS[1]="-geometry 640x480 -localhost"VNCSERVERARGS[2]="-geometry 640x480 -localhost"VNCSERVERARGS[1]="-geometry 800x600 -localhost"
  2. /sbin/service vncserver restart

  3. Go to another machine with vncserver and test the VNC.
    1. vncviewer -via larry@192.168.0.10 localhost:1

    2. vncviewer -via moe@192.168.0.10 localhost:2

    3. vncviewer -via curly@192.168.0.10 localhost:3

By default, many vncviewers will disable compression options for what it thinks is a "local" connection. Make sure to check with the vncviewer man page to enable/force compression. If not, performance may be very poor!

4. Recovery from a logout ( Not implemented for CentOS 6 )

If you logout of your desktop manager, it is gone!

  • We added a line to xstartup to give us an xterm where we can restart our window manager.
    • For gnome, enter gnome-session.

    • For kde, enter startkde.

5. Remote login with vnc-ltsp-config

To allow remote login access via a vnc-client to the Centos system, the RPM packages named vnc-ltsp-config and xinetd can be installed. When a vnc-client connects to one of the configured ports, the user will be given a login screen. The sessions will *not* be persistent. When a user logs out, the session is gone.

The rpm package vnc-ltsp-config is easily installed via the EPEL repository noted in Available Repositories

Note: There are no major dependencies for the package so the vnc-ltsp-config*.rpm could easily be downloaded and installed without the need for enabling the EPEL repository.

Install, as root via:

# yum install xinetd vnc-ltsp-config# /sbin/chkconfig xinetd on# /sbin/chkconfig vncts on# /sbin/service xinetd restart

Next, as root edit the file "/etc/gdm/custom.conf".

  • To the next blank line below the "[security]" section add "DisallowTCP=false"
  • To the next blank line below the "[xdmcp]" section add "Enable=true"
  • Make sure you are in a position to either run "gdm-restart" for default Gnome installs or just reboot the CentOS box.

This will add the ability to get the following default vnc-client based session connections:

resolution

color-depth

port

1024x768

16

5900/tcp

800x600

16

5901/tcp

640x480

16

5902/tcp

1024x768

8

5903/tcp

800x600

8

5904/tcp

640x480

8

5905/tcp

A major advantage of using the vnc-ltsp-config setup is the reduction of system resource utilization compared to the standard "per-user setup". No user processes will be started or memory consumed until a user actually logs into the system. Also, no pre-thought for user setup is needed (eg skip all of the manual individual user setup for vnc-server). The downside to the vnc-ltsp-config setup is that *any* user with the ability to login will likely have the ability to log into the system via a vnc-client with full gui unless steps are taken to limit that type of access. Also, there is no session persistance! Once the vnc-client closes, the vnc-ltsp-config session will terminate (by default) and all running processes will be killed.

This option can be combined with ssh tunnelling using a slightly modified version of the "vncviewer -via" command noted above:

vncviewer -via remoteUser@remoteHost localhost:vncSinglePortNumber

For the default vnc-ltsp-config install, the "vncSinglePortNumber" is the last digit only of the port number. Port 5900 (1024x768 16bit) would just be "0", for example.

Note: you will need to be aware of possible interaction issues if you enable either selinux or iptables. If you are not running a display manager (runlevel 3 for example), you will need to start one or you will only get a black screen when you connect.

6. VNC-Server for an already logged in GUI console session - 2 options

Often you will need remote access to an already logged in GUI session on a "real" console. Or you will need to help another user remotely with an GUI or visual issue. You will need either "vnc-server" or "x11vnc". The vnc-server option will be a module added to X11 for "allways on" vnc support, while x11vnc will allow for adhoc vnc support.

vnc-server install will require no third party repos or source building.

x11vnc is a way to view remotely and interact with real X displays (i.e. a display corresponding to a physical monitor, keyboard, and mouse) with any VNC viewer. In this way it plays the role for Unix/X11 that WinVNC plays for Windows.

6.1. x11vnc adhoc option

Karl Runge has generously provide a exceptional amount of information at http://www.karlrunge.com/x11vnc/ for x11vnc. There is info on securing the connection and also an "Enhanced TightVNC Viewer (ssvnc)". To make it easy, follow these steps:

1. Download the latest rpm install from http://dag.wieers.com/rpm/packages/x11vnc/ to the host you want the vnc-client to connect to:

wget http://dag.wieers.com/rpm/packages/x11vnc/x11vnc-0.9.3-1.el5.rf.i386.rpm

2. Install, as root, via the yum or rpm programs on the host you want the vnc-client to connect to:

yum install x11vnc-0.9.3-1.el5.rf.i386.rpm

3. Start the x11vnc process on the host you want the vnc-client to connect to. Please take a long look at the possible options from the x11vnc website. A very simple/insecure example for a trusted network setup (local network or VPN) is to have the user with the GUI console issue the command:

[user@helpme_host ~$] x11vnc -nopw -display :0.0

Then connect (without password) via a vnc-client to the IP/hostname and port noted by the x11vnc command. By default, x11vnc will allow connections from all interfaces. Host based firewall settings may need to be modified.

You can combine this with ssh tunneling:

ssh -C -t -L 5900:localhost:5900 [remote ip] 'x11vnc -usepw -localhost -display :0'

Note that the -C flag is for compression, so may not be required

6.2. vnc-server X11 "always on" option

1. On the the system you want to run vnc-server, install vnc-server as noted above.

2. Edit /etc/X11/xorg.conf, as root, and add/create a 'Module' Section and add 'Load "vnc"':

Section "Module"  Load "vnc"EndSection

3. For standard vnc authentication, edit /etc/X11/xorg.conf, as root, and add to the 'Screen' Section:

Option "SecurityTypes" "VncAuth"  Option "UserPasswdVerifier" "VncAuth"  Option "PasswordFile" "/root/.vnc/passwd"

4. As root, run 'vncpasswd" to create the password noted above.

5. Restart X11 (<Ctrl>+<Alt>+<BS> will work if on the console already)

6. You should be able to connect with a vncviewer client as normal.

7. To trouble shoot, check for errors in the /var/log/Xorg.0.log or verify that iptables or selinux is not interfering with remote connections. Additional information is at http://www.realvnc.com/products/free/4.1/x0.html

转载于:https://my.oschina.net/willSoft/blog/39272

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/296136.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

搜索引擎(lucene)

专辑&#xff1a;Lucene (全文检索工具)从入门到精通简介:Lucene是apache软件基金会4 jakarta项目组的一个子项目&#xff0c;是一个开放源代码的全文检索引擎工具包&#xff0c;即它不是一个完整的全文检索引擎&#xff0c;而是一个全文检索引擎的架构&#xff0c;提供了完整的…

自动摘要php,修改DEDECMS文章自动摘要长度或者取掉文章摘要

首先&#xff0c;应该在系统→系统基本参数→其它选项“自动摘要长度” 中可以设置&#xff0c;但最高只能实现250&#xff0c;根本没用&#xff0c;所以现在总结一下几种方法方法一&#xff1a;第一步进数据库 找到表 dede_archives 下的字段 description 点更改,修改长度 或 …

解决PKIX:unable to find valid certification path to requested target 的问题

问题的根本是&#xff1a; 缺少安全证书时出现的异常。 解决问题方法&#xff1a; 将你要访问的webservice/url....的安全认证证书导入到客户端即可。 以下是获取安全证书的一种方法&#xff0c;通过以下程序获取安全证书&#xff1a; /** Copyright 2006 Sun Microsystems, In…

北大学霸隐居20年,王青松花光350万后,如今怎么样了?

全世界只有3.14 % 的人关注了爆炸吧知识传说我国&#xff0c;本科生遍地走&#xff0c;研究生多如狗。但一估算&#xff0c;从1977年高考恢复以来&#xff0c;国内现在的本科率竟然还不到5%。这样一想&#xff0c;30多年前的本科生数量肯定更少&#xff0c;也更珍贵。如果是北大…

如何在 Dapper.NET 中使用事务?

咨询区 Amit&#xff1a;我的项目中使用 dapper.net 做数据库连接框架&#xff0c;有一个需求需要在多个表上执行多次插入操作&#xff0c;我想把它 事务化&#xff0c;但我看 dapper 并没有提供类似的方式。请问我该如何使用 dapper 来做这项工作呢&#xff1f;回答区 Newteq …

文件给制实施规定的实例(GB8567-88)

尽管在文件编制中存在着很多灵活性&#xff0c;然而&#xff0c;文件的编制确实是非常必要的&#xff0c;其意义如前所述。为了控制这种灵活性&#xff0c;保证文件编制能达到应该达到的目的&#xff0c;对于具体的软件开发任务&#xff0c;应编制的文件的种类、详细程度应取决…

python 内存数据库下载,Python 文件存储和数据库

Python 中数据存储的方式和其他语言没什么区别&#xff0c;主要分为两个方面&#xff1a;文件存储和数据库存储。文件存储文件存储的方法也分为很多种&#xff0c;主要包括&#xff1a;Python 内置方法NumPy 模块方法os 模块方法csv 模块方法Python 内置方法在不需要借助任何外…

c#10中的namespace

A、namespace是c#用来管理类型隔离的关键字&#xff0c;在不同的namespace下可以相同名称的类型&#xff0c;并且namespace是可以嵌套的。Demo01.csnamespace NameSpaceDemo {internal class Demo01Class{ }namespace NSDemo01{internal class Demo01Class{}}namespace NSDemo…

岛国小姐姐来例假时,男朋友背着她偷偷查手机......

1 大猪蹄子们都好好学学▼2 人形扫地机&#xff1f;&#xff1f;&#xff1f;▼3 妈&#xff0c;看下你儿子大学四年积攒的宝藏▼4 你以为养老院很无聊&#xff1f;▼5 这个事是全世界统一的吗&#xff1f;▼6 爸爸&#xff1a;今天做个温柔的人吧▼7 那些隐藏在民间的车…

mysql-普通查询(General Query)慢查询(Slow Query)相关日志配置

2019独角兽企业重金招聘Python工程师标准>>> 配置 配置方法一: 服务启动时 # vi /etc/my.cnf ... log-outputTABLE,FILE general-log1 slow-query-log1# systemctl restart mysqldlog-output默认是FILE,还有个值是NONE,就不输出日志了.我这里演示的是表和日志文件都…

eclipse myeclipse 快捷键

MyEclipse 快捷键1(CTRL) ------------------------------------- Ctrl1 快速修复 CtrlD: 删除当前行 CtrlQ 定位到最后编辑的地方 CtrlL 定位在某行 CtrlO 快速显示 OutLine CtrlT 快速显示当前类的继承结构 CtrlW 关闭当前Editer CtrlK 快速定位到下一个 CtrlE…

委托与事件

首先多谢网上的大牛们无私地分享自己的经验&#xff0c;让我这样的小鸟能站在巨人的肩膀上不断前进&#xff01; 参考网址&#xff1a;http://www.knowsky.com/395937.html&#xff08;参考1&#xff09; http://hi.baidu.com/zhangguilin/blog/item/9d34dc17a088ff0ac83d6d08.…

适配器简介

STL 适配器分为 函数对象适配器、迭代器适配器 和 容器适配器 3种&#xff0c;分别完成对应的类型转换。 举例子容易&#xff0c;比如电源插座&#xff0c;3个头的插头插不进两个头的插座&#xff0c;就需要一个适配器。 1、函数适配器&#xff1a; 在stl程序里&#xff0c;有的…

他让全世界凶手睡不着觉,现实版福尔摩斯,退休了4次又被拽回来工作,无敌实在是太寂寞了~...

全世界只有3.14 % 的人关注了爆炸吧知识今天要说一位最近在中国圈粉无数萌萌哒老爷爷他是《挑战不可能》里的李博士也是世界上最牛逼的刑侦鉴识专家DrHenryLee李昌钰人称现实版福尔摩斯他是全球身价最高的鉴识专家之一据说工作酬劳是10000美元/时如果哪个案子他都破不了那这个c…

集成Dapr的 Azure 容器应用

微软在 Ignite 2021 大会上发布了预览版的Azure Container Apps&#xff0c;这是一个完全托管的无服务器容器运行时&#xff0c;用于大规模构建和运行现代应用程序。从2021 年 11 月 2 日起&#xff0c;Azure 容器应用程序可在公共预览中使用。虽在服务到达 GA 之前&#xff0c…

jsp iframe嵌入php,jsp嵌套iframe从iframe中表单提交并传值到外层_html/css_WEB-ITnose

今天因需求迭代 更改元来代码 遇到了这么个问题就是想在 iframe中提交后进行整个页面的跳转 并把iframe中的值传到外层jsp大概就是这个样子外层 a.jsp内层 b.jsp于是想当然的开始码代码打算用js进行赋值 在b.jsp中 写个js$(#d).val();虽然能获取到隐藏域的值 但 外层的值并没有…

浅谈SQL注入风险 - 一个Login拿下Server(转)

前两天&#xff0c;带着学生们学习了简单的ASP.NET MVC&#xff0c;通过ADO.NET方式连接数据库&#xff0c;实现增删改查。 可能有一部分学生提前预习过&#xff0c;在我写登录SQL的时候&#xff0c;他们鄙视我说&#xff1a;“老师你这SQL有注入&#xff0c;随便都能登录了。不…

java笔试面试经典问题

java面试笔试题大汇总 JAVA相关基础知识 1、面向对象的特征有哪些方面 1.抽象&#xff1a; 抽象就是忽略一个主题中与当前目标无关的那些方面&#xff0c;以便更充分地注意与当前目标有关的方面。抽象并不打算了解全部问题&#xff0c;而只是选择其中的一部分&#xff0…

设计模式建议学习顺序

学习顺序设计模式常用程度适用层次引入时机结构复杂度变化实现体现的原则1Factory Method很常用代码级编码时简单子类的实例化对象的创建工作延迟到子类开闭原则2Singleton很常用代码级、应用级设计时、编码时简单唯一实例封装对象产生的个数 3Facade很常用应用级、构架级设计时…

MSFT Outlook VBA处理新邮件的方法

俺们有两个邮箱&#xff0c;1个外部的邮箱1&#xff08;outlook&#xff09;&#xff0c;1个内部邮箱0&#xff08;lotus notes&#xff09;。想要outlook邮箱收到新邮件之后判断一下subject的内容&#xff0c;如果是"kkk:"开头&#xff0c;则将"kkk:"后面…