Administration

From Systerserver

Jump to: navigation, search

Contents

Debian repository

  • main
  • contrib
  • non-free
  • volatile

Ubuntu repository

  • main
  • universe
  • multiverse
  • restricted

Legacy GRUB

  • version 0.97
  • grub-install -v to find out which version is on the computer
  • grub configuration file /boot/grub/menu.lst

GRUB 2

  • version 1,96 or later
  • grub-install -v to find the version installed on the pc
  • config file(s) in /etc/defaultgrub

Hidden menu

One of the unique features of Grub2 is hiding/skipping the menu and showing it by holding "Shift" when needed. You can also adjust whether you want to see the timeout counter.
The new über method
Edit /etc/default/grub as you wish. Here's an example where the comments from the beginning of the two lines have been removed to enable the feature, the timeout has been set to five seconds and to be shown to the user:
GRUB_HIDDEN_TIMEOUT=5 GRUB_HIDDEN_TIMEOUT_QUIET=false
And run: grub-mkconfig -o /boot/grub/grub.cfg

GNOME

reboot in another RUNLEVEL

  • Init 3 = When you wish all services to be up EXCEPT the graphical user interface.
  • Init 5 = When you want all services to be up AND have the graphical user interface.
  • Services that go "up" in both levels are for example networking, shares, servers etc.
  • 0 = /etc/init.d/halt, 1 = /etc/init.d/single, 6 = /etc/init.d/reboot

SSH

  • port forwarding (ssh -L)
  • ssh -L8099:10.0.0.5:80 root@10.0.0.5
  • X forwarding (ssh -X), is slow
  • eg when you need to open a graphical application on a server eg a Dell raid tool which is only delivered in GUI form and not in CLI form
  • proxy forwarding - all traffic on remote server (ssh -D)
  • eg iPlayer in UK (together with FoxyProxy)
  • in FF you need to set network.proxy.socks_remote_dns;false to true
  • and set the proxy settings to localhost or 127.0.0.1 plus a port
  • http://sial.org/howto/openssh/publickey-auth/

  • create a key pair with ssh-keygen
  • ssh-copy-id root@computer
  • type root password of above computer
  • ssh root@computer
  • type passphrase of your key
  • now log out and log in again -> this time it should go without asking for a password/phrase
  • ssh-copy-id is the same as:
  • cat ~/.ssh/*.pub | ssh user@remote-system 'umask 077; cat >>.ssh/authorized_keys'

  • ssh-agent -> provides a secure way of storing the passphrase of the private key
  • in ubuntu it starts automatically at logon

  • ssh-add -> adds RSA or DSA identities to the authentication agent
  • ssh-add -l to list your identities
  • ssh-add -d to delete key from memory

SCREEN

which RAID to use?

  • raid 1 (2 disks), mirroring
  • raid 5 (at least 3 disks), mirroring and striping
  • raid 10, good for database servers?

RAID

  • you do not necessarily need to setup raid during the installation of a server
  • apt-get install mdadm (md = multiple disk adminisration app)
  • mdadm -v --create /dev/md0 --level=raid1 --raid-devices=2 /dev/sda1 /dev/sdb1
  • delete a disk in array: first umount the drive, then issue "mdadm -S /dev/md0"

raid, lvm, backups

  • raid is for availability, and/or increased throughput
  • raid should not be seen as a backup strategy, ie as data protection, since the main reasons for data being lost are:
  • accidental user deletion, intentional (cracking, theft) deletion, memory corruption, filesystem corruption, fire, and floods
  • overvoltage failures may very well cause common mode failures of multiple disks
  • undervoltage failures may cause memory failures which can cause corrupt data to be written to multiple disks
  • and they all get duplicated with raid
  • lvm is for on-the-fly resizing (data grows)
  • backups are for data protection, security, integrity

which partitioning schema to use

  • example 320GB (2 disks, in RAID 1)
  • swap - 2GB, primary
  • / - 10GB, primary
  • /boot - 200MB, primary
  • /home - 135GB, extended
  • /tmp - 1GB, extended
  • /usr - 6GB, extended
  • /var - 6GB, extended
  • /srv - 135GB, extended
  • (if the filesystem on / is compatible with GRUB, /boot doesn't need it's own partition)
  • leave some unformatted space for rescue purposes?

or use RAID plus LVM

  • partition 1: 0.5 GB /boot
  • partition 2: 2 GB /swap
  • partition 3: 10 GB Linux software RAID (will be /dev/md0) for /
  • partition 4: 224 GB Linux software RAID (will be /dev/md1) for the rest
  • partition 5: 2 GB /rescue
  • md1 is LVM formatted (md0 not, because XEN has issues booting from LVM formatted partitions)
  • dom0 is installed on md0
  • within the LVM volume group you can setup logical volumes, ie /home, /tmp, /usr, /var, /srv
  • http://www.youtube.com/watch?v=rMyfljiCz3A

diff

  • meld is the GUI version of diff
  • less-than (<) notation means "remove this line"
  • greater-than (>) sign means "add this line"
  • two useful flags are -b (ignore blanks) and -i (ignore case)

permissions

  • Owner, Group, and World corresponds to UGO (user, group, other), confusing!

virtual machines

  • containerisation (openvz, user mode linux, chroot jail) is good voor isolation
  • virtualisation (xen, kvm) is good for hosting various guest os's

check if restart is required

  • cat /var/run/reboot-required
  • or apt-get install debian-goodies
  • which includes the checkrestart script

resetting users home profile

  • delete all hidden (dot files)
  • at the next login all the dot files are regeneratted
  • rm -rf .[^.]*
  • aka rm -rf .[A-Z,a-z,0-9]* (is that correct?)
  • all of this so as not to remove ./ and ../
  • or find ~ -iname ".*" -maxdepth 1 -type f -delete
  • this only removes the hidden files and not the hidden directories
  • and the shell knows where ~ is?
  • type the whole path if worried about exotic shells.... find /path/to/dir/ -name ".*" -maxdepth 1 -delete