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

📄 157-161.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=157-161//-->

<!--UNASSIGNED1//-->

<!--UNASSIGNED2//-->



<CENTER>

<TABLE BORDER>

<TR>

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

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

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

</TR>

</TABLE>

</CENTER>

<P><BR></P>

<H4 ALIGN="LEFT"><A NAME="Heading30"></A><FONT COLOR="#000077">UNIX Run-Levels</FONT></H4>

<P><B>Xdm</B> is usually set to trigger what is called a <I>run-level</I>. With a few exceptions, run-levels in UNIX is an arbitrary concept that mostly follows ancient UNIX traditions. The run-level <I>S</I> implies a single-user stand-alone system.</P>

<P>In Linux, run-level 1 and higher are multiuser. This means that more than one user is allowed to login. On many systems, run-level 3 starts networking. This is also the default Linux run-level. Linux has special run-levels for power-fail (which shuts the system down) and the Vulcan death-grip (<B>Ctrl-Alt-Backspace</B>).</P>

<P>You can get some ideas about run-levels by looking in the <B>/etc/inittab</B> file. In <B>/etc/inittab</B>, one of the first entries will be something like the following:</P>

<!-- CODE SNIP //-->

<PRE>

  # Default runlevel.

  id:3:initdefault:

</PRE>

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

<BLOCKQUOTE>

<P><FONT SIZE="-1"><HR><B>NOTE:&nbsp;&nbsp;</B>In Slackware 2.3 (and the first edition of this book), the Linux default run-level was 5. The default X run-level was 6. It has changed to 3 and 4, respectively. Now, run-level 6 will reboot the system, a great surprise if you want it to run X.<HR></FONT>

</BLOCKQUOTE>

<P>This states that the default system run-level is 3. When Linux boots up, it will boot into run-level 3. Later in the <B>/etc/inittab</B> file, you&#146;ll find something like:</P>

<!-- CODE SNIP //-->

<PRE>

  x1:4:wait:/etc/rc.d/rc.4

</PRE>

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

<P>This states that on entry to run-level 4, <B>/etc/rc.d/rc.4</B> should be run. This file, then, starts up the X Display Manager, which presents an X login screen.</P>

<P>On our system, <B>/etc/rc.d/rc.4</B> starts the following program:</P>

<!-- CODE SNIP //-->

<PRE>

  # Tell the viewers what's going to happen...

  echo "Starting up the X Window System V.11 R.6..."



  # Call the "xdm" program.

  exec /usr/X11R6/bin/xdm -nodaemon

</PRE>

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

<P>This is what starts up <B>xdm</B>. To get <B>xdm</B> up and running, all you should really have to do is edit the <B>/etc/inittab</B> as <B>root</B> and change the following line:</P>

<!-- CODE SNIP //-->

<PRE>

     id:3:initdefault:

</PRE>

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

<P>to

</P>

<!-- CODE SNIP //-->

<PRE>

     id:4:initdefault:

</PRE>

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

<P>That&#146;s it. Everything else comes preconfigured. You may want to change the configuration, but you have a good start.

</P>

<P>After making these changes, when you next boot Linux, you&#146;ll boot into run-level 4 rather than run-level 3. The process of going into run-level 4 will start <B>xdm</B>, because of what&#146;s in the <B>/etc/rc.d/rc.4</B> file.</P>

<P>Before doing this, though, make a copy of <B>/etc/inittab</B>. You also should test <B>xdm</B> before setting the system to boot into it, because you always want to be able to boot Linux. (Making a mistake in <B>/etc/inittab</B> can result in a Linux that won&#146;t boot.) To test <B>xdm</B>, you can type in the following command as root, to change to run-level 4 now:</P>

<!-- CODE SNIP //-->

<PRE>

     # init 4

</PRE>

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

<P>This will jump you to run-level 4. Be patient; this command takes a while.

</P>

<P>Be sure that X is not running when you do this. You should be logged in as root at the console.</P>

<P>If you set up your <B>.login</B> or <B>.profile</B> file to automatically call <B>startx</B> when you login (see &#147;Starting X Automatically on Login&#148; later), you must disable this first. These two methods for starting X conflict. Quit X and then comment out those lines you added to the <B>.login</B> or <B>.profile</B> file, for example:</P>

<!-- CODE SNIP //-->

<PRE>

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

     #    Commented out.

     #    startx

     endif

</PRE>

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

<P>After a while, you should see a graphical login screen. It is best to test <B>xdm</B> using init 4 first, to see if everything is set up correctly. Try to login and see what happens. If it works, you&#146;re in business and you can confidently modify the <B>/etc/inittab</B> file.</P>

<P>The <B>xdm</B> configuration files are in <B>/usr/lib/X11/xdm</B>. If you want to change the background color for the login screen, look in <B>Xsetup_0</B> in that directory. You probably won&#146;t have to edit much <B>in /usr/lib/X11/xdm</B>, especially for a stand-alone Linux system without X terminals on the network. (If your needs are more demanding, you&#146;ll need to look into a book on X, such as <I>The UNIX System Administrator&#146;s Guide to X</I>; see Appendix A for more on this.)</P>

<H4 ALIGN="LEFT"><A NAME="Heading31"></A><FONT COLOR="#000077">User Accounts Under Xdm</FONT></H4>

<P>While you probably won&#146;t have to edit any of the <B>xdm</B> system files in <B>/usr/lib/X11/xdm</B>, it&#146;s likely you&#146;ll have to edit files in your home directory. By default, <B>xdm</B> runs a file named <B>.xsession</B> from your home directory, instead of the <B>.xinitrc</B> that is run by <B>startx</B> (and <B>xinit</B>).</P>

<P>To create the <B>.xsession</B> file, you can start by copying your <B>.xinitrc</B> file to <B>.xsession</B> in your home directory. (Remember to put in the leading period on the filename in your home directory.) Then modify this file like you changed the <B>.xinitrc</B> file.</P>

<P>Here&#146;s a copy of our <B>.xsession</B> file:</P>

<!-- CODE //-->

<PRE>

  #!/bin/sh

  userresources=$HOME/.Xresources

  usermodmap=$HOME/.Xmodmap

  sysresources=/usr/X11R6/lib/X11/xinit/.Xresources

  sysmodmap=/usr/X11R6/lib/X11/xinit/.Xmodmap



  # merge in defaults and keymaps



  if [ -f $sysresources ]; then

     xrdb -merge $sysresources

  fi



  if [ -f $sysmodmap ]; then

     xmodmap $sysmodmap

  fi



  if [ -f $userresources ]; then

     xrdb -merge $userresources

  fi



  if [ -f $usermodmap ]; then

     xmodmap $usermodmap

  fi



  # start some nice programs

  xsetroot -solid SteelBlue



  xterm -geom 80x32&#43;264&#43;0 -ls &#38;

  xterm -geom 80x32&#43;0&#43;250 -ls &#38;

  oclock -geom -7-7 &#38;

  exec fvwm

</PRE>

<!-- END CODE //-->

<P>If you don&#146;t want to start up X at boot time, you may want to start X every time you login.

</P><P><BR></P>

<CENTER>

<TABLE BORDER>

<TR>

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

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

<TD><A HREF="161-164.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 + -