Mandriva

Administration & Server Software

1 Being 'root'

'root' is the most powerful account on a Linux system. Learn how to use it wisely and appropriately.

2 Backup

You should back up your personal files on a regular basis. Usually, each user saves his personal files in the user directory under the /home directory. All the global administrative configuration files are stored in /etc and can be written only by the root user.

Tools for backup are:

  • tar command
  • dd (device dump) command
  • partimage … save whole partitions of Ext2FS, ReiserFS, NTFS and FAT32 - This is very useful when installing the same software on many machines: just install one of them, create an image, and just restore the image on all other machines. Then after the first installation, each subsequent installation is done automatically and requires only a few minutes.

3 Emergency Recovery

How to cope with severe system errors.

4 Managing Processes

Almost everything going on in Linux is a process. Take a look at what the processes are and how to manage them.

5 Mounting

How to handle file systems in Linux.

6 Scheduling

How to tell your computer to do certain things at a certain time.

7 System Services

System services: what they are and how to control them.

8 Getting Organized

8.1 Config files

Do you ever have trouble remembering where the config files are for all those services you run?
Then get organized. Create a /root/config directory, sub-directories for each service you run, and symlinks for those configuration files:

For example, as root:

mkdir /root/config
cd /root/config
mkdir samba apache dns network cups sasl rsync

cd samba
ln -s /etc/samba/smb.conf
ln -s /etc/samba/smbusers
ln -s /etc/lmhosts

cd /root/config/apache
ln -s /etc/httpd/conf/httpd2.conf
ln -s /etc/httpd/conf/commonhttpd.conf
ln -s /etc/httpd/conf/vhosts/Vhosts.conf

cd /root/config/dns
ln -s /etc/hosts
ln -s /etc/resolv.conf
ln -s /var/named/named.ca
ln -s /etc/named.conf
ln -s /etc/networks
ln -s /var/named/localhost

cd /root/config/network
ln -s /etc/sysconfig/network-scripts/ifcfg-eth0
ln -s /etc/sysconfig/network-scripts/ifcfg-eth1
ln -s /etc/services

Now everything will be in one place the next time you configure a service. If you use an editor that creates backup files, with the '~~' suffix, you won't have them all over your filesystems.

9 Bash Aliases

Do you ever get tired of typing

tail /var/log/syslog
or
less /var/log/messages
?
Then get lazy1.1 Make yourself some aliases. Put these lines in /root/.bashrc.

alias tslog='/usr/bin/tail /var/log/syslog'
alias lslog='/usr/bin/less /var/log/syslog'
alias tmsg='/usr/bin/tail /var/log/messages'
alias lmsg='/usr/bin/less /var/log/messages'
alias tauth='/usr/bin/tail /var/log/auth.log'
alias lauth='/usr/bin/less /var/log/auth.log'
alias tmail='/usr/bin/tail /var/log/mail/info'
alias lmail='/usr/bin/less /var/log/mail/info'
alias tkern='/usr/bin/tail /var/log/kernel/info'
alias lkern='/usr/bin/less /var/log/kernel/info'
alias thacc='/usr/bin/tail /var/log/httpd/access_log'
alias lhacc='/usr/bin/less /var/log/httpd/access_log'
alias therr='/usr/bin/tail /var/log/httpd/error_log'
alias lherr='/usr/bin/less /var/log/httpd/error_log'
alias thsacc='/usr/bin/tail /var/log/httpd/ssl-access_log'
alias lhsacc='/usr/bin/less /var/log/httpd/ssl-access_log'
alias thserr='/usr/bin/tail /var/log/httpd/ssl-error_log'
alias lhserr='/usr/bin/less /var/log/httpd/ssl-error_log'
alias tsmb='/usr/bin/tail /var/log/samba/log.smbd'
alias lsmb='/usr/bin/less /var/log/samba/log.smbd'
alias tnmb='/usr/bin/tail /var/log/samba/log.nmbd'
alias lnmb='/usr/bin/less /var/log/samba/log.nmbd'


alias urpmi='nice -n 15 urpmi ––split-level 10 ––split-length 8'
alias rpm='nice -n 15 rpm'
alias make='nice -n 16 make'

These aliases will become new commands the next time you login. If you can't wait, type each one at the command prompt so they will also be available in your current login session. Learn these new commands, and system administration will be easier.

10 Xen 3.0 How To - Mandriva 2006 PowerPack

INSTALLING XEN ON MANDRIVA LINUX 2006

XEN is a system allowing you to run multiple virtual machines on one host machine. XEN if fairly stable. If you are running XEN on a laptop the ACPI code in the XEN kernel is not as robust as the main Linux kernel, so it's possible to encounter ACPI related issues.

XEN consists of a host system, and one or more guest systems. The guest systems reside on the host system.

Your guest systems will typically reside on a separate partition, with their own swap. You can create this install either by doing a CD/DVD install or cloning the host system using tar or rsync.

REQUIRED XEN PACKAGES There are 3 packages you need to install on either the host or guest system:

  • 1. xen (the package with the init scripts and command line utilities);
  • 2. kernel-xen0 (the hypervisor kernel for the system to provide services to the guest systems); and
  • 3. kernel-xenU (the guest system kernel).
The xenU kernel does not need to be installed on the host system. The xenU kernel will need to be installed on each guest system. If you opt to install only on the guest, you'll need to copy the kernel/initrd to the host system.

BOOTLOADER PREPARATION

XEN requires Grub, and at present it does not work with LILO as shipped in Mandriva. The xen0 and xenU do not create an initrd as you might be accustomed to with a normal kernel install.

To creat initrd, please go enter the commands

  • mkinitrd -v /boot/initrd-2.6.12-18mdkxen0.img 2.6.12-18mdkxen0
  • mkinitrd -v /boot/initrd-2.6.12-18mdkxen0.img 2.6.12-18mdkxenU
The commands above will give you the needed initrd in boot.

A sample of how the stanza within /boot/grub/menu.lst should look is:

  • title 2612-18Xen3
  • kernel (hd0,18)/boot/xen-3.0.gz dom0_mem=131072 console=vga
  • module /boot/vmlinuz-2.6.12-18mdkxen0 root=/dev/hda19 ro console=tty0 acpi=force
  • module /boot/initrd-2.6.12-18mdkxen0.img
You'll notice the two "module" lines to load the kernel and initrd. You'll also want to enable the xend and xendomains services:
  • chkconfig -- -- --add xend xendomains
XEN GUEST CONFIGURATION

For the client, you create a file in /etc/xen, describing the characteristics of the client system. I have created 2 guests, 2006_1 and 2006_2.

  • /etc/xen/2006_1:
  • kernel = "/boot/vmlinuz-2.6.12-18mdkxenU"
  • ramdisk = "/boot/initrd-2.6.12-18mdkxenU.img"
  • memory = 128
  • name = "2006_1"
  • nics = 1
  • dhcp = "dhcp"
  • disk = ['phy:hda14,hda1,w','phy:hda20,hda2,w']
  • root = "/dev/hda1 ro"
  • hostname = "2006_1"
  • /etc/xen/2006_2:
  • kernel = "/boot/vmlinuz-2.6.12-18mdkxenU"
  • ramdisk = "/boot/initrd-2.6.12-18mdkxenU.img"
  • memory = 128
  • name = "2006_2"
  • nics = 1
  • dhcp = "dhcp"
  • disk = ['phy:hda15,hda1,w','phy:hda21,hda2,w']
  • root = "/dev/hda1 ro"
  • hostname = "2006_2"
Most options are self-explanatory. Memory is the memory allocated to the guest, and nics/dhcp describe the network configuration. For purposes of this demonstration, dhcpd is configured on the host machine with a pool of IP addresses to be allocated to the guests.

The line of most interest is the "disk" line. This line describes a mapping between the physical partitions the guest is using and the virtual partition they will be using. The guest system will be installed on the first argument (hda14 for 2006_1 in this example). fstab should reflect the virtual partition name (hda1). hda20/hda21 are swap partitions allocated for the guests.

The complete partition setup for my XEN guests is:

  • /dev/hda14 6790 7140 2819407 83 Linux
  • /dev/hda15 7141 7491 2819407 83 Linux
  • /dev/hda20 7492 7538 377496 83 Linux
  • /dev/hda21 7539 7584 369463+ 83 Linux
You can mount the guest systems to make any changes from the host via a chroot:
  • # mount /dev/hda14 tmp
  • # chroot tmp
When you are finished, "exit" leaves the chroot and you can umount the partition:
  • # exit
  • # umount tmp
BOOTING THE XEN KERNEL

Boot proceeds as normal, select the xen0 from the grub menu and boot the host system.

Some system services may not work correctly with the xen0 kernel and you can disable those services. One sample error is cpufreq, which occurred during this configuration.

NOTE: If you have issues with ACPI and the xen0 kernel, you may have problems running X.

Once the system is booted, you can check the status of the xen service with:

  • # xm list
STARTING THE XEN GUESTS

To start XEN, enter the command:

  • # xm create 2006_1 -c
You see the XEN system startup and then something similar to a normal Mandriva boot. You should be able to login to the system as normal. You can start the 2006_2 system in a similar fashion from another tty or terminal. The command
  • "xm -- -- --help"
lists a number of options you can use to control the virtual machine.

To stop the virtual machine, enter # shutdown -h from the guest command line.

With both guests running the "xm list" output will reflect the new state.

VNC

You can install tightvnc-server on the guests and setup a user account to start if you'd like an X session available on the guest, or to assist with whatever services you might like on the guests to provide services such as multiple Apache servers.

11 Advanced Administration

KB - Welcome to Mandriva Club Knowledge Base > Administration & Server Software
Version 1.41 last modified by Arkub on 09/04/2007 at 12:25

Comments (1)

Flink | 21.07.2006 at 08:09 PM
I have moved ORACLE into Databases.

 


en id fr nl es

RSS

Creator: AdminWiki on 2004/03/22 09:44
(c) Mandriva 2007
18888888