Ubuntu server

From Vertubleu

Jump to: navigation, search

Contents

General links

http://sebsauvage.net/logiciels/ubuntu_power.html

Desktop sharing

http://doc.ubuntu-fr.org/vnc

With vino:

sudo vino-preferences

With NX Server (current install): http://doc.ubuntu-fr.org/serveur_nomachine (ou http://www.commentcamarche.net/faq/6687-installer-nx-server)

VirtualBox headless

simple tutorial to get virtualbox running on a headless Linux server:

http://www.howtoforge.com/vboxheadless-running-virtual-machines-with-virtualbox-3.1-on-a-headless-ubuntu-9.10-server

After install, and to use a graphical interface, some 'guest addition' SW have to be installed on the guest (Virtual Machines). These additions are provided with the virtual box install as a disk image (.iso).

=> Mount this iso to the virtual machine:

Example to mount as a secondary DVD drive (can also be mounted in place of the install DVD):

VBoxManage storageattach "winXP" --storagectl "IDE Controller" --port 1 --device 1 --type dvddrive --medium /usr/share/virtualbox/VBoxGuestAdditions.iso

Then start the virtual machine and install the addition (procedure depends on the guest OS). See detailed instructions in VirtualBox manual - chapter 4).

Additions for Ubuntu 10.04 guest (VM)

If display of mouse does not work properly even afer installing the guest additions, try deleting the /etc/X11/xorg.conf file and restart.

If right Alt key (Alt Gr) does not work: define another key for 3rd level chars here: system/keyboard/layout/options/3rd level. I use the right control key for this purpose (right Alt-Gr works only inconsistently).

Download manager with queuing

The script from http://jasonwhutchinson.com/blog/download_queue_dq_v0_2 implements a simple download manager with queuing management, relying on wget. Here is an update for max speed limit support (to avoid saturating your home DL bandwidth) File:Dq.sh

Aria2c is a powerfull download tool, does not handle download queuing, but support various protocols (including bittorent): http://aria2.sourceforge.net/ ('aria2' package is available with Ubuntu)

Tips and tricks

on Asus Maximus formula, do declare only 1 HDD in the HDD list for boot order. If several disks are defined, Linux willnot boot (grub cannot even start or show something on the screen)

Raid (SW) on Linux

Why choosing a SW RAID? (more details on the Wikipedia page)

  • HW RAID is very expensive (and may no be so efficient)
  • pseudo HW RAID embedded in many mother boards is in reality a hidden SW RAID managed by low-level motherboard drivers. It is not flexible, and does not provide means to test and monitor the status of the RAID clusters.
  • SW RAID is now well supported by the Linux kernel and pretty easy to configure.


All infos on how to use mdadm are here: http://www.linuxfoundation.org/collaborate/workgroups/linux-raid/group

mdadm man page: http://man-wiki.net/index.php/8:mdadm

http://ubuntuforums.org/showthread.php?t=408461

Monitoring a raid array: http://www.linuxfoundation.org/collaborate/workgroups/linux-raid/detecting,_querying_and_testing

Main commands

check status:

cat /proc/mdstat

check a raid array state:

mdadm --detail /dev/md0

To restart the service at startup:

# Reload support for RAID1
sudo modeprobe raid1
# Reload a RAID cluster
sudo mdadm --assemble --scan --uid=a0c330dc:22d35709:f2558bf9:2209550c
# Then mount the drive if not already done through /etc/fstab

=> This script is inserted at: /etc/rc2.d/S80start-raid -> ../init.d/start-raid -> start-raid.sh

Monitoring (as a daemon):

mdadm --monitor -f --mail=my-email@address.com --delay=1800 /dev/md0

Raid 5 partitionning

According to http://www.linuxfoundation.org/collaborate/workgroups/linux-raid/raid_setup, for a Raid 5 array with a total of 3 disks:

- chunk size = 64kB (ok with relatively small file-systems)
- block size = 4kB
- stride = chunk / block = 64/4 = 16kB
- stripe width = stride * (n data disks in raid5) = 16kb * (3 - 1) = 32kB

=> so using following commands to create / format the RAID5 partition:

sudo mdadm --create /dev/md0 --level=5 --raid-devices=3 /dev/sdb1 /dev/sdc1 /dev/sde1 
sudo mkfs.ext4 -v -m .1 -b 4096 -E stride=16,stripe-width=32 /dev/md0

These parameters can be checked using:

sudo tune2fs -l /dev/md0

(or updated using tune2fs)

Then to automate the array assembling and mounting at boot, edit following files:

/etc/mdadm/mdadm.conf
/etc/fstab
/etc/samba/smb.conf

Email configuration

source: http://forum.ovh.com/showthread.php?t=42403

install:

apt-get install ssmtp mailx

Configuration du fichier /etc/ssmtp/ssmtp.conf:

UseTLS=YES
UseSTARTTLS=YES
mailhub=smtp.gmail.com:587
rewriteDomain=gmail.com
hostname=ksXXXXX.kimsufi.com
FromLineOverride=YES
AuthUser=expediteur@gmail.com
AuthPass=motdepassegmail


Envoi du mail (to send email):

mailx -s sujetdumail -a "from:expediteur@gmail.com" destinataire@domaine.com < textedumail.txt

Backup (copies) using rsync

Backup script using rsync for a rotating backup using hard-links: http://www.sanitarium.net/golug/rsync_backups_2010.html

rsync quick startup: http://www.linux.com/news/enterprise/storage/8200-back-up-like-an-expert-with-rsync

misc commands:

evaluate folders size:

du -shc <path>
ex: du -shc /mnt/share1/

evaluate folders size (1 level):

for f in *; do du -shc $f; done | grep -v total

== File system sharing==under linux (sshfs - fuse): http://www.debuntu.org/2006/04/27/39-mounting-a-fuse-filesystem-form-etcfstab http://mediakey.dk/~cc/how-to-mount-a-remote-filesystem-using-ssh-and-sshfs/

Double screen on Linux

Graphical card choice

http://www.generation-nt.com/reponses/achat-carte-graphique-et-double-ecran-entraide-1551521.html 7600 GS

Configuration

http://doc.ubuntu-fr.org/configurer_son_ecran http://doc.ubuntu-fr.org/configurer_son_ecran Debugging a display problem: http://forum.ubuntu-fr.org/viewtopic.php?pid=2259389#p2259389

Test http server

Use following commands to test if the http server is running or not: permits to separate a server issue to a more global network config issue:

> telnet 127.0.0.1 80
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.

> GET / HTTP/1.0

HTTP/1.1 200 OK
Date: Thu, 14 Jan 2010 12:38:07 GMT
Server: Apache/2.2.11 (Ubuntu)
Last-Modified: Thu, 14 Jan 2010 10:49:16 GMT
ETag: "336621-2d-47d1da36a0300"
Accept-Ranges: bytes
Content-Length: 45
Vary: Accept-Encoding
Connection: close
Content-Type: text/html 

<html><body>

It works!

</body></html>
Connection closed by foreign host.

(Ref article: http://www.ozzu.com/hosting-forum/internal-server-error-500-t22806.html)

Personal tools