Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1045005
  • 博文数量: 74
  • 博客积分: 10000
  • 博客等级: 上将
  • 技术积分: 2950
  • 用 户 组: 普通用户
  • 注册时间: 2007-05-15 00:17
文章分类

全部博文(74)

文章存档

2009年(1)

2008年(73)

我的朋友

分类: 服务器与存储

2008-06-28 01:20:31

以下这个错误和display没有关系,注意!

# startx

X server: Error in /etc/X11/X0screens (line 614)
          Device name invalid or missing after keyword "Screen".
X server: Will try default "/dev/crt"
Failure to open default device file `/dev/crt`.
Please either specify the proper device filename in
your /etc/X11/X0screens file or fix `/dev/crt`.  This filename is either
non-existent or is not a character special file.

Fatal server error:


giving up.
xinit:  Connection refused (errno 239):  unable to connect to X server
xinit:  No such process (errno 3):  Server error.

 

参考....

How to export your X Display


It is possible to use your computer at home or in the labs to login to the CS machines and use cool graphical tools like xclock. The system that makes this possible is the X Windows System (X), it is the basis for all GUI application on the CS machines. One of the design ideas behind X is the idea of remote displays, in much the same way a standard telnet login works. From another computer you connect to your sever over a network login and do all kinds of neat command line things remotely. X is the method that allows you to login to the server and use neat graphical things remotely.

This document describes the basics to using this remote display function of X. It assumes that you have access to a fast network (10Base-T, or maybe ISDN speeds) and you have access to a machine that runs X applications, our CS machines do this. The software needed on your own computer is called an X server, it allows the connections from the X clients to display application on your screen. There are several X server software packages available freely for several operating systems. For Linux or other Intel architecture UNIXes is common, for Windows there is , and for Macs there is MI/X. You should follow the documentation that came with your X server for installation.

Next lets get some basics of how this all really works. On your computer your are running an X server that among other things watches a port for incoming connections. Also the X server sets up a view window where all the X application. windows will be displayed, this is called a root window. It is possible to have more than one root window. The X application you want to run on a remote computer has been compiled with libraries that allow it to communicate with the X server and tell it what to display in the root window. These applications are called X clients. When an X client is run it looks for an X server port to connect to and start issuing commands to display information. When an X server gets a connection on its port there is a small amount of security that the client has to be checked on. Usually this check is to see if the clients host is on a list of allowed client hosts. Once the check and connection is established the X server reads commands from the X client and starts building a window in the root window for the client. The servers job is not only to display graphics it also sends mouse clicks and key presses to the connected clients, in this way you have all the functionality you need to make a working GUI.

In the following paragraphs I will give several examples of how to use X using UNIX based X servers such as Xfree86. For other OSes refer to the user manual of your X server to find how to do similar things. First lets load an X server under Linux and see some of the details inside (further details of how to get this far are at ):

$ startx

This starts the server and by default starts a single xterm. An xterm is just a simple X client to display text in, usually a login shell. Assuming you are running bash you can look at your environment variables (EV) by typing "set". Environment variables store useful information for programs defaults or system state. If you look at your EV you will see a variable called "DISPLAY" this variable stores the address for X clients to connect to. These addresses are in the form:

hostname:displaynumber.screennumber

A typical example would be:

snake.cs.uidaho.edu:0.0

I said earlier that it is possible to have more than one X server running at a time. In this case the displayname would be something like

snake.cs.uidaho.edu:1.0

or

snake.cs.uidaho.edu:0.1

depending on how its done.

When the X clients start the look at the DISPLAY EV to see where to connect to by default. One way to do remote displaying would be to set this EV to a remote X server.

$ export DISPLAY=mymachine.mynet.uidaho.edu:0.0

Then you can run your cool X application and its display will be on mymachine.mynet.uidaho.edu.

$ xclock

Another way to do remote display is by a command line option that all X applications have: "-display [displayname]". To run your cool X application:

$ xclock -display mymachine.mynet.uidaho.edu:0.0

This does the exact same as before.

The previous demonstrations rely on whether your X server is allowing connections from remote hosts. The following command allows connections from all hosts (run on machine that the X server is running on (mymachine.mynet.uidaho.edu)):

$ xhost +

To allow connections from single hosts at a time:

$ xhost +myremote.myothernet.uidaho.edu

is a neat remote login tool that in addition to having secure encrypted transmissions auto forwards your X DISPLAY EV if your are running it under an X Server. ssh allows a easy, no hassle, way to do all of the stuff we have discussed so far. The ssh documentation has more detailed information on how to get this working.

Tips for other non-UNIX users

Because most other operating system don't have X Server as one of their basic packages using X can be quite a bit different than under UNIX. Usually all the non-UNIX X Servers do is create a root window and start watching ports. They usually don't start a Xterm to allow you to do everything you need by that. Often there are dialog boxes or menus that set the access lists and show the DISPLAY name so that you can use a external telnet program to connect to your client machine and set the variables by hand there. Your X Server software should give an example of how you might export your display using their tools.

Some Links on the topic:

阅读(3058) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~