    <chapter>
      <title>System administration</title>
      <section id="rpm">
	<title>RPM package management</title>
	<section>
	  <title>Using RPM</title>
   <para>
    PLD is a RPM based Linux distribution. RPM is a system of
    maintaining software resources of your computer. This system 
    provides a command <command>rpm</command> which you can use to
    perform basic operations (install, upgrade, remove) on your set of
    packages. Every package is a collection of files which provides 
    some functionality. For instance program which your humble author 
    use to write this text is called <command>vim.ispell</command>.
    It is located in file <filename>/usr/bin/vim.ispell</filename>.
    I can check that my <command>vim.ispell</command> comes from 
    package <filename>vim-ispell-6.1.063-1</filename> using the command:
    <programlisting>
dobrek:~> rpm -qf /usr/bin/vim.ispell
vim-ispell-6.1.063-1
    </programlisting></para>
    <para>This package could by installed by downloading file 
    <filename>vim-ispell-6.1.063-1.i686.rpm</filename> from PLD ftp site
    or one of the mirrors and invoking command <command>rpm  -i
    vim-ispell-6.1.063-1.i686.rpm</command>. </para>
    <para>
    RPM can by also used for removing packages using command 
    <command>rpm -e vim-ispell </command>. 
    </para>
    <para>
    Sometimes already installed packages require upgrade. It can
    happen
    that new version has a expected new feature or the old one has a
    nasty security bug. If you want to upgrade package type 
    <command>rpm -U &lt;package name&gt; </command>
    <note>
    <para>
    Upgrading package which conatins your kernel is usually very bad
    idea. Upgrade consist of removing the old package and installing the
    new one. With kernel it is usually safe to install the new one test
    and than id everything works fine remove the old one.
    </para>
    </note>
    <note>
    <para>
    After upgrade some packages you will note that there are some new
    files. It usually happens in the case of configuration files located
    in <filename>/etc</filename>. For instance if you upgrade your <application>lpd</application>
    daemon you will note that the file <filename>/etc/printcap</filename> hasn't been 
    overwritten but the new file is created
    <filename>/etc/printcap.rpmnew</filename>. It is almoust always
    worth to look into this type of files to check out what are the
    differences between old and new version. 
    </para>
    </note>

    </para>

    
    
	  <para>configuring rpm (limit languages, etc)</para>
	</section>
	<section>
	  <title>Managing packages with <application>apt</application></title>
	  <para>
	    Apt is powerful package installer/updater originally
	    written for Debian and its .deb package system, adapted for
	    RPM based systems by Connectiva people. Apt can be used to install
	    packages from various sources (filesystem, cdrom, nfs, http).
	    Here the net method is described (ftp or http).
	  </para>
	  <para>
	    To use apt first make sure you have
	    <application>apt</application> rpm package installed. Then
	    you usually need to edit
	    <filename>/etc/apt/sources.list</filename> (there are some
	    examples in this file, in most cases it is enough to
	    uncomment one of them). Example entry for i586 system:
	    <programlisting>rpm ftp://ftp.pld-linux.org/apt PLD-1.0/i586 base supported</programlisting>
	    You might also check some setup
	    values in <filename>/etc/apt/apt.conf</filename>
	    See 
	    <citerefentry>
	      <refentrytitle>sources.list</refentrytitle>
	      <manvolnum>5</manvolnum>
	    </citerefentry>
	    and
	    <citerefentry>
	      <refentrytitle>apt.conf</refentrytitle>
	      <manvolnum>5</manvolnum>
	    </citerefentry>
	    for details.
	  </para>
	  <para>
	    Apt is driven by <command>apt-get</command> command. First
	    time you run apt, issue <command>apt-get update</command>
	    (this command will only download list of packages from
	    server).  Then you can install/upgrade particular packages
	    (and all packages they depend on) with 
	    <command>apt-get install package1 package2 ...</command> 
	    or upgrade whole system with
	    <command>apt-get upgrade</command>. 
	    See
	    <citerefentry>
	      <refentrytitle>apt-get</refentrytitle>
	      <manvolnum>8</manvolnum>
	    </citerefentry>.
	  </para>
	  <note>
	    <para>
	      Apt is very strict about dependencies.
	      If you had ever issued --force and --nodeps options to rpm program,
	      then you may get a lot of messages about broken dependencies
	      when you run apt first time. That means your rpm database is messy.
	      In that case it is wise to run 
	      <command>apt-get check</command> to see more details and then
	      fix your database by hand, installing, removing or updating
	      packages that cause problems. Once done, that cleaning is not
	    necessary anymore as long as you use apt.
	    </para>
	  </note>
	</section>
	<section>
	  <title>Managing packages with <application>poldek</application></title>
	  <para>
	    Poldek is batch-mode rpm package installer/updater written
	    by Pawel Gajda as a part of PLD installer.
	    It is software in beta stage.
	  </para>
	  <para>
	    To use poldek you need <application>poldek</application> rpm package.
	    Poldek can be used in full batch mode - every option can be passed 
	    in command line - or it can use config file,
	    either <filename>/etc/poldek.conf</filename> (system wide config), 
	    or <filename>~/.poldekrc</filename> (user config). Poldek can be run by 
	    ordinary user, installation of packages in that case can be done with 
	    <command>sudo</command> (can be set in user config). 
  	    Running poldek from root does not require <command>sudo</command>.
	  </para>
	  <para>
	    Program supports various sources of packages: filesystem, ftp, http, rsync.
	    Simple config for source requires only one line, like that:
	    <programlisting>
source = ftp://ftp.pld-linux.org/PLD-1.0/i686/PLD/RPMS/
	    </programlisting>
	    See example configs in poldek doc directory.
	  </para>
	  <para>
	    You may install/upgrade selected packages with 
	    <command>poldek -i package1 package2 ...</command>
	    or upgrade whole system with <command>poldek --upgrade-dist</command>.
	    Run with no arguments <command>poldek</command> enters it's nice interactive mode
	    (with TAB name completion and command history available). Try it. It's really cool!
	  </para>
	  <para>
	    If you use poldek with remote source (e.g. ftp), it may be sometimes necessary to 
	    issue command <command>poldek --update</command>
	    to reload poldek index files from server.
	  </para>
	  <para>
	    See extensive man page for details:
	    <citerefentry>
	      <refentrytitle>poldek</refentrytitle>
	      <manvolnum>8</manvolnum>
	    </citerefentry>.
	</para>
	<caution>
	  <para>
	    If you use lilo, and do <emphasis>not</emphasis> use rc-boot,
	    it is advisable to add <programlisting>hold = kernel</programlisting> 
	    to poldek config, otherwise it may happen during massive upgrade 
	    that kernel is also upgraded. If you didn't notice that it had happened,
	    lilo wouldn't be aware of new kernel installed!
	  </para>
	  <para>
	    If you use rc-boot, bootloader should be automatically upgraded.
	  </para>
	</caution>
	</section>
	<section>
	  <title>Managing packages with <application>wuch</application></title>
	  <para>
	    Wuch is an interactive package manager written by Pawel Kolodziej.
	    It has also some batch mode. The software is in beta stage.
	  </para>
	  <para>
	    To run wuch you need <application>wuch</application> package.
	    Wuch stores its configuration in <filename>/etc/wuch.conf</filename>.
	    Example wuch.conf:
	    <programlisting>
root_dir=/
source=Primary PLD ftp server,ftp,ftp.pld-linux.org,/PLD-1.0/i586/PLD/,RPMS,inst</programlisting>
	    For more details see comments in initial wuch.conf.
	  </para>
	  <para>	  
	    Unfortunately, program is not very well documented (you may 
	    find some docs in program sources), nevertheless
	    it has very simple and intuitive interface.
	    Simply type <command>wuch</command> and enjoy.
	  </para>
	</section>
      </section>
      <section id="user-management">
	<title>Managing users</title>
	<para>
	PLD provides both standard <command>useradd</command> command (from shadow package),
	as well as interactive script <command>adduser</command> (from package adduser).
        </para>
      </section>
      <section id="logs">
	<title>Viewing logfiles</title>
	<para></para>
      </section>
      <section id="backups">
	<title>Backup</title>
	<para></para>
      </section>
    <section id="rescue">
      <title>Rescue procedure</title>
      <para>
	Occasionally, it may happen that system do not boot up correctly.
	Depending on the failure, some rescue steps might be necessary:
      </para>	
      <variablelist>
	<varlistentry>
	  <term>
	    Using rescue mini-system.
	  </term>
	  <listitem>
	    <para>
	      Rescue mini-system usually comes on bootable diskettes or CD.
	      As regards rescue diskettes, you can find plenty of them on the
	      net, try to search e.g. on freshmeat.net.
	      <!-- what about our own bootdisk creator, bootdisk.spec works? -->
	      Good rescue CD can be found here: 
	      <ulink url="http://ftp.pld-linux.org/software/Rescue-CD/">
		http://ftp.pld-linux.org/software/Rescue-CD/</ulink>
	    </para>
	  </listitem>
	</varlistentry>
	<varlistentry>
	  <term>Starting in another runlevel</term>
	  <listitem>
	    <para>
	      If the bootloader prompt is enabled, it is possible to give
	      extra parameters to kernel. E.g. on LILO prompt, additionally to
	      image name you can add runlevel parameter like that:
	      <programlisting>
		LILO: pld runlevel=2
	      </programlisting>
	      Runlevel 1 can be specified with <literal>runlevel=1</literal> but also 
	      with <literal>single</literal>.
	    </para>
	    <para>
	      Single mode is especially provided for system maintenance and
	      emergency situation. But it can happen sometimes that even single does 
	      not work correctly. One can try to run system
	      completely without <command>init</command>, e.g.:
	    </para>
	    <programlisting>LILO: pld init=/bin/bash</programlisting>
	    <para>
	      Above line causes that kernel attempts to run 
	      <command>bash</command> as a first user process instead of 
	      <command>init</command> that is invoked in normal case.
	      System (if was able to run at all) boots in very "raw"
	      state e.g. to be able to write on disk, one must
	      remount the device into read-write mode first:
	      <command>mount / -o rw,remount</command>
	    </para>
	  </listitem>
	</varlistentry>
	<varlistentry>
	  <term>Repairing filesystem</term>
	  <listitem>
	    <para>
	      When some serious error has been detected on root filesystem,
	      init scripts invoke "emergency shell" and expect administrator
	      to fix the problems manually.
	      Usual reaction is using fsck program on root disk to check/repair disk data.
	    </para>
	    <para>
	      After problem has been fixed, shell should be closed (with <command>exit</command>)
	      or Ctrl-D), so the init scripts can continue boot-up procedure.
	    </para>
	  </listitem>
	</varlistentry>
      </variablelist>

    </section>
    <section id="bootloaders">
      <title>Bootloaders</title>
      <section>
	<title>General issues</title>
	<para>initrd etc, geninitrd etc</para>
      </section>
      <section>
	<title>Easy way: rc-boot</title>
	<para>
	  PLD comes with simple utility called <emphasis>rc-boot</emphasis>. 
	  This package
	  provides an uniform interface to install and update bootloader.
	  With rc-boot this task can be done with simple running 
	  <command>rc-boot</command> command;
	  what bootloader should rc-boot use, and what are bootloader options,
	  this is specified in uniform way
	  in rc-boot config files instead of particular bootloader's config files.
	  Basic rc-boot behavior is controlled by file 
	  <filename>/etc/sysconfig/rc-boot/config</filename>.
	  To know what linux kernels or other systems should be available
	  at boot time, rc-boot needs also <quote>image description</quote>
	  files residing in 
	  directory <filename>/etc/sysconfig/rc-boot/config/</filename>.
	  Newly installed system should contain at least one these file,
	  that is, the file describing default system kernel,
	  but in general it is possible to have more of them.
	  Image description files can be written by the user, but the main idea of
	  rc-boot was that they come with particular packages that need to be 
	  handled by bootloader. These packages are primarily kernel packages,
	  but can be also other packages like memtest86 etc.
	</para>
	<para>
	  It is used for easy kernel upgrades:
	  as was just mentioned, each kernel rpm package comes with 
	  <quote>boot image description</quote> file.
	  During kernel package installation, rc-boot is automatically invoked to ensure that
	  newly installed kernel will be seen by bootloader at next boot-up.
	</para>
	<note>
	  <para>
	    rc-boot support works only if rc-boot is installed (thats obvious),
	    but it must also be enabled. This is done in it's main config file.
	    For details refer to 
	    <citerefentry>
	      <refentrytitle>rc-boot</refentrytitle>
	      <manvolnum>8</manvolnum>
	    </citerefentry>.
	  </para>
	</note>
      </section>
    </section>
  </chapter>


<!-- Keep this comment at the end of the file
Local variables:
mode: xml
sgml-omittag:nil
sgml-shorttag:nil
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:2
sgml-indent-data:t
sgml-default-dtd-file:"../dbxbook4.1.2.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
sgml-declaration:nil
sgml-validate-command:"rxp -sxV %s %s"
sgml-parent-document:("PLD-Guide.xml" "book" "section")
End:
-->
