⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 161-164.html

📁 linux-unix130.linux.and.unix.ebooks130 linux and unix ebookslinuxLearning Linux - Collection of 12 E
💻 HTML
字号:
<HTML>

<HEAD>

<TITLE>Linux Configuration and Installation:Installing and Configuring XFree86</TITLE>

<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT>
<!--
function displayWindow(url, width, height) {
        var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>

 -->




<!--ISBN=1558285660//-->

<!--TITLE=Linux Configuration and Installation//-->

<!--AUTHOR=Patrick Volkerding//-->

<!--AUTHOR=Kevin Reichard//-->

<!--AUTHOR=Eric Foster//-->

<!--PUBLISHER=IDG Books Worldwide, Inc.//-->

<!--IMPRINT=M & T Books//-->

<!--CHAPTER=3//-->

<!--PAGES=161-164//-->

<!--UNASSIGNED1//-->

<!--UNASSIGNED2//-->



<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="157-161.html">Previous</A></TD>

<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>

<TD><A HREF="164-168.html">Next</A></TD>

</TR>

</TABLE>

</CENTER>

<P><BR></P>

<H3><A NAME="Heading32"></A><FONT COLOR="#000077">Starting X Automatically on Login</FONT></H3>

<P>If you don&#146;t set up <B>xdm</B>, you&#146;ll need to type in <B>startx</B> after you login to get X and all these applications in your <B>.xinitrc</B> file started. If you don&#146;t like to enter <B>startx</B> every time you login, and you&#146;re sure that you want to run X every time you login, you can put the <B>startx</B> command in your <B>.login</B> or <B>.profile</B> file (depending on the shell you use, <B>csh</B> or <B>ksh</B>). If you do, be sure that you&#146;re running from the console only. Otherwise, the <B>.login</B> or <B>.profile</B> file will error out if they get run from elsewhere (such as when you login over a serial line or from another virtual terminal).</P>

<P>The way to check for this is to check the result of the <B>tty</B> program. The <B>tty</B> program returns the current device file used for your terminal. When run from an <B>xterm</B> shell window, <B>tty</B> will print out something like <B>/dev/ttyp1</B> (for the first pseudo-terminal device). But, when run from the console (from the first virtual terminal), <B>tty</B> will print out <B>/dev/tty1</B>. When run from the second virtual terminal, <B>tty</B> prints out <B>/dev/tty2</B> so we can check for <B>/dev/tty1</B>.</P>

<P>To do this, we can enter <B>tty</B> at the console (before starting X):</P>

<!-- CODE SNIP //-->

<PRE>

     $ tty

     /dev/tty1

</PRE>

<!-- END CODE SNIP //-->

<BLOCKQUOTE>

<P><FONT SIZE="-1"><HR><B>NOTE:&nbsp;&nbsp;</B>Use the value <B>tty</B> returns for <I>you</I>, not necessarily the value <I>we</I> received.<HR></FONT>

</BLOCKQUOTE>

<P>Armed with this information, you can edit your <B>.login</B> file (presuming you use the C shell, <B>csh</B>, as your shell) to add the following lines:</P>

<!-- CODE SNIP //-->

<PRE>

  if ( `tty` == '/dev/tty1' ) then

     startx

  endif

</PRE>

<!-- END CODE SNIP //-->

<P>This will start up X when you login at the console. You can also set up your account to log you out when you quit X. Most of the time, we begin X at login and quit X when we want to logout. If this fits your pattern, you can change the <B>.login</B> file to contain the following:</P>

<!-- CODE SNIP //-->

<PRE>

  if ( `tty` == '/dev/tty1' ) then

     startx

     logout

  endif

</PRE>

<!-- END CODE SNIP //-->

<H3><A NAME="Heading33"></A><FONT COLOR="#000077">The X Font Server</FONT></H3>

<P>The X font server is a special program that can scale fonts. This ability dramatically increases the already-prolific set of X fonts available on your system (use the <B>xlsfonts</B> command to list these fonts). To get the font server up and running, you must:</P>

<DL>

<DD><B>&#149;</B>&nbsp;&nbsp;Configure the font server and tell it where to get fonts.

<DD><B>&#149;</B>&nbsp;&nbsp;Configure the font server to start up before X does.

<DD><B>&#149;</B>&nbsp;&nbsp;Configure the X server to communicate with the font server.

</DL>

<P>To configure the font server, we need to tell it where to find the scalable fonts. Luckily, Linux comes with a workable preconfigured file, <B>/usr/X11R6/ lib/X11/fs/config</B>.</P>

<P>To start the font server, use the <B>xfs</B> (short for <I>X font server</I>) command. Enter the following command as root:</P>

<!-- CODE SNIP //-->

<PRE>

  # xfs -port 7000 &#38;

</PRE>

<!-- END CODE SNIP //-->

<P>This uses the default configuration file, <B>/usr/X11R6/lib/X11/fs/config</B>, and runs on TCP/IP port 7000 (an arbitrary port to which the X font server defaults).</P>

<P>Once started, we can verify that the font server is running by using the <B>fsinfo</B> command:</P>

<!-- CODE SNIP //-->

<PRE>

     gilbert:/$ fsinfo -server hostname:port

</PRE>

<!-- END CODE SNIP //-->

<P>You need to fill in the hostname and port number. For example, with a hostname of <I>eric</I> and the default port number of <I>7000</I>, the command would be:</P>

<!-- CODE SNIP //-->

<PRE>

     gilbert:/$ fsinfo -server eric:7000

</PRE>

<!-- END CODE SNIP //-->

<P>You should see output like the following:

</P>

<!-- CODE //-->

<PRE>

     name of server: eric:7000

     version number: 2

     vendor string:  X Consortium

     vendor release number:  6000

     maximum request size:   16384 longwords (65536 bytes)

     number of catalogues:   1

             all

     Number of alternate servers: 0

     number of extensions:   0

</PRE>

<!-- END CODE //-->

<P>Once you verify that the font server is running, you can set up XFree86 to communicate with the font server. This is necessary so that X applications can take advantage of the font server&#146;s fonts.

</P>

<P>To get the X server ready to accept the font server, you need to adjust its font path, or <B>fp</B>. Enter the following commands:</P>

<!-- CODE SNIP //-->

<PRE>

     gilbert:/$ xset &#43;fp tcp/eric:7000

     gilbert:/$ xset fp rehash

</PRE>

<!-- END CODE SNIP //-->

<P>In your case, you need to replace <I>eric</I> with your system&#146;s hostname. The first command tells the X server to use a TCP/IP port as a sort of font directory; the <I>tcp/hostname:port</I> syntax is the standard way to do this. The second command tells the X server to query again for all the available fonts.</P>

<P>If you&#146;re running <B>xdm</B> (see &#147;Starting X at Boot-Up&#148; earlier), you should stop that, verify that things work manually, and then set up <B>xdm</B> again. Problems with the font server may cause X to quit. If X quits, this may prevent an X-based login, leaving you in an unhappy situation.</P><P><BR></P>

<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="157-161.html">Previous</A></TD>

<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>

<TD><A HREF="164-168.html">Next</A></TD>

</TR>

</TABLE>

</CENTER>





</td>
</tr>
</table>

<!-- begin footer information -->





</body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -