from small one page howto to huge articles all in one place

search text in:




Other .linuxhowtos.org sites: www.linuxhowtos.org
toolsntoys.linuxhowtos.org



Last additions:
How to make X listen on port 6000

How to make X listen on port 6000

words:

34

views:

82422

userrating:

average rating: 1.2 (52 votes) (1=very good 6=terrible)


May, 25th 2007:
April, 26th 2007:
Apr, 10th. 2007:
Druckversion . pdf icon
You are here: Installation Guides

Summary

This text describes the installation and configuration of a heavy duty internet server running a gentoo linux distribution. The server will have to run 24/7 with minimum downtime for maintenance and is connected to a 100MBit Internet backbone. I choose gentoo as distribution because of the really fast availability of new versions and security patches for all installed packages. Everything will be compiled for the special needs of this maschine with various security enhancement features which ship with the available glibc/gcc versions (like stack smashing protections).

Changelog

Previous versions used to split the swap space across the raid harddiscs and not to mirror it. In case of a hard disc failure your system might(will) crash. This is not intended... (Thanks to Nick Rosier to point this out).

Note

This howto is NOT suited for users who run their first linux (or gentoo) install. Previous linux knowledge is needed, not every detail will be explained here.

System descriptions

Hardware

The system is a dual Xeon 2.66 Ghz with 512KB cache size and enabled hyperthreading.

System storage will be 2 80 GB HDDs running in a raid 1 with network backup every night. The filesystem will be XFS on a software raid 1 (mirroring) system.

Memory: 1GB, build in network card, no sound used, onboard graphics.

The machine will have an UPS and external cooling and will be mounted in a 19" rack.

Software

The system will be a heavy duty webserver running at least the following services/daemons:

  • Apache 2 as webserver (with many virtual hosts)
  • openLDAP for authentication for smtp/imap/pop3 and other login services, but not for system login
  • postfix with sasl2 support as MTA (Mail Transfer Agent)
  • courier-imap for imap access
  • courier-pop3
  • mysql as database backend
  • php (hardened) for various web frontends
  • LeopardCMS (a highspeed content management system written in C) for websites
  • ldapphpadmin for administrating the ldap server
  • squirrelmail as webmail service
  • awstats for website statistics

Installation

The basic installation is explained in the wonderful gentoo installation handbook.

I will only describe the modification on each step.

I will use a stage 1 installation with the minimal boot CD.

Installation in quick style (refer to the handbook if you don't know how to do the individual step(s))

Booting:

  • Boot from the CD, load the right network drivers
  • Change root password to something we know.
  • Configure the network with the given ip address dns servers etc.
  • Start sshd (optional)

Partitioning the hdd(s)

I'm using fdisk to partition the hdds, use whatever you like best.

Attention: To be able to use the raid 1, both hdds must be partitioned exactly identical, so write down the setting when partitioning.

My HDD layout :

/dev/hda1 boot partition 10 MB,  partition type: fd (Linux raid autodetect)
/dev/hda2 swap partition 250 MB, partition type: 82 (Linux swap)
/dev/hda3 root partition remaining space, partition type: fd (Linux raid autodetect)
The same applies to the 2nd HDD.

Setting up the raid 1

edit/create the file /etc/raidtab and enter the following (adjust the devices if neccessary)

raiddev         /dev/md0
nr-raid-disks   2
persistent-superblock   1
device          /dev/hda1
raid-disk       0
device          /dev/hdc1
raid-disk       1

raiddev         /dev/md2
nr-raid-disks   2
persistent-superblock   1
device          /dev/hda3
raid-disk       0
device          /dev/hdc3
raid-disk       1

In case you want to mirror the swap:

raiddev         /dev/md1
nr-raid-disks   2
persistent-superblock   1
device          /dev/hda2
raid-disk       0
device          /dev/hdc2
raid-disk       1

Note: I do not use a raid for the swap, I will explain the swap setup a bit later.
Please also see the comment at the bottom of this page, why this may cause trouble on a harddisk failure.

start the raid by running

raidstart --all
enter "cat /proc/mdstat"

You should see something like this:

Personalities : [raid1]
md0 : active raid1 hda1[1] hdc1[1]
      XXX blocks [2/2] [UU]
md2 : active raid1 hda3[1] hdc3[1]
      YYY blocks [2/2] [UU]

Now, after your raid is up and running, don't think about touching /dev/hda or /dev/hdc directly again. Only use /dev/md0 or /dev/md2.

Applying a Filesystem to a Partition

create your filesystems like it is described in the handbook, only use /dev/md0 and /dev/md2 for the target devices.

Activate the Swap Partitions

Because we are using 2 identical hdds, we have 2 swap partitions that we enable both.

Later in the /etc/fstab config we can tune a bit to make our swap faster.

Mounting

Now we follow the handbook a bit for mounting and downloading the needed stage 1 tarball. Remember, use /dev/mdX as partitions.

Configuring the Compile Options

I prefer to to use the full make.conf.default for configuration, so I copy it over before editing.

cp /mnt/gentoo/etc/make.conf.default /mnt/gentoo/etc/make.conf
now we edit the file
nano -w /mnt/gentoo/etc/make.conf

CHOST is set to i686-pc-linux-gnu

I use the following CFLAGS:

CFLAGS="-march=pentium4 -O2 -pipe" be careful, if you enable the hardened toolchain, never use more than -O2 for compiling.

If you have an AMD cpu, or a pentium2/3 change the -march setting to your cpu.

I set the MAKEOPTS to -j5 (number of CPUs plus one) (2 x Xeon with HT enabled makes 4 virtual CPUs)

MAKEOPTS="-j5"

setting USE-Flags

I use the following line

USE="-X -gtk -gnome -alsa mysql apache2 ssl ssh openldap\
sasl2 pam pic pie hardened hardenedphp xml vhosts"
I don't want X, gtk, gnome or alsa. (This is a server)

But I want mysql, apache, a.s.o.

The flags pic, pie and hardened are used with the hardened toolchain provided by gentoo.

These make the executables less vulnerable to buffer overflow and other programming mistakes. As of the writing of this howto, the flags "pic, pie and hardened" cause some problems with some packages. Manual patching and fiddling may be needed.

UPDATE: I installed another server lately (Nov. 2005), no patching was needed any more.

Follow the installation manual including the Stage1 to Stage2 section.

It is always useful to download the packages first and after that, start the real bootstrapping process. There is nothing better than having a bootstrap failing after 60+ mins on the last package because the file was damaged on the ftp mirror.

Proceed from stage2 to stage3 the documented way.

This will take a while, in my case 71 packages will be installed.

Just keep yourself occupied with something, like writing a howto or something ;)

Now its time to configure the kernel as described in the manual

  • set the timezone
  • install a kernel. I used a hardened-sources kernel (version 2.6.7-r7)
  • check the symlink /usr/src/linnux
  • configure the kernel with make menuconfig
  • make sure to check SMP support in case of a multiple CPU machine.
  • If you use XFS and like to not loose parts of your filesystem data, disable preemptible kernel.
  • Think twice before enabling power management functions like software suspend.
  • You really don't want that your server goes into suspend mode during the night.
  • Warning: If you use MySQL, do not enable the PaX feature "Disallow ELF text relocations". Enabling this makes you unable to compile and run MySQL. *sniff*
  • compile the kernel (remember to use the -j5 flag like in the MAKEOPTS line).
  • install the kernel.

configuring /etc/fstab

enter the data as described in the manual, but use /dev/md0 and /dev/md2

for the swap line use the following 2 lines

/dev/hda2  none swap sw,pri=2 0 0
/dev/hdc2  none swap sw,pri=2 0 0
This way the kernel uses both hdds for swap with the same priority, this means some data will be swapped to one hdd, some to the other and both could be read/written at the same time. This gives a speed boost when you need swap (which should never happen on normal conditions...).
Or use
/dev/md2  none swap sw,pri=2 0 0
in case of a mirrored swap partion.

Enter the networking information as described in the handbook (ip, domainname, ...)

Continue with the installation manual until you got through the manual and

have the basic system running as you want.

While writing this howto, it was planned to have a part 2 to describe the installation of additional software like apache, postfix and others.

But since they are installed exactly as on a "normal" gentoo distribution, a part 2 is not really needed.

comments

Nick Rosier wrote in an email:
I just read this setup. IMHO there's a little flaw in the setup. Goal is to have as little downtime as possible. To gain maybe a bit more performance the author decided not to mirror swap. This is a bad idea. In case of a hard-disk failure part of your swapspace will be unavailable/corrupted meaning your system will possibly crash. I doubt that is what one wants.
Nick has a valid point.
In this setup I use ide harddisks. (yes, I know, SCSI would be better...)
If one of the hdds dies, its very likely that the system crashes any way. This is my experience with ide hdds.
If you use SCSI or SATA-drives, the situation might change. On those drives it might be better to use raid on the swap, too.
back



Support us on Content Nation

New Packages

- as rdf newsfeed
- as rss newsfeed
- as Atom newsfeed
2025-12-12
akonadi - 25.12.0
Ebuild name:

kde-apps/akonadi-25.12.0

Description

Storage service for PIM data and libraries for PIM apps

Added to portage

2025-12-12

akonadi-calendar - 25.12.0
Ebuild name:

kde-apps/akonadi-calendar-25.12.0

Description

Library for akonadi calendar integration

Added to portage

2025-12-12

akonadi-calendar-tools-common - 25.12.0
Ebuild name:

kde-apps/akonadi-calendar-tools-common-25.12.0

Description

Added to portage

2025-12-12

akonadi-contacts - 25.12.0
Ebuild name:

kde-apps/akonadi-contacts-25.12.0

Description

Library for akonadi contact integration

Added to portage

2025-12-12

akonadi-import-wizard - 25.12.0
Ebuild name:

kde-apps/akonadi-import-wizard-25.12.0

Description

Assistant to import PIM data from other applications into Ak

Added to portage

2025-12-12

akonadi-mime - 25.12.0
Ebuild name:

kde-apps/akonadi-mime-25.12.0

Description

Library for akonadi mime types

Added to portage

2025-12-12

akonadi-search - 25.12.0
Ebuild name:

kde-apps/akonadi-search-25.12.0

Description

Libraries and daemons to implement searching in Akonadi

Added to portage

2025-12-12

akonadiconsole - 25.12.0
Ebuild name:

kde-apps/akonadiconsole-25.12.0

Description

Application for debugging Akonadi Resources

Added to portage

2025-12-12

akregator - 25.12.0
Ebuild name:

kde-apps/akregator-25.12.0

Description

News feed aggregator

Added to portage

2025-12-12

analitza - 25.12.0
Ebuild name:

kde-apps/analitza-25.12.0

Description

KDE library for mathematical features

Added to portage

2025-12-12

ark - 25.12.0
Ebuild name:

kde-apps/ark-25.12.0

Description

File archiver by KDE

Added to portage

2025-12-12

artikulate - 25.12.0
Ebuild name:

kde-apps/artikulate-25.12.0

Description

Language learning application that helps improving pronunciation skills

Added to portage

2025-12-12

audiocd-kio - 25.12.0
Ebuild name:

kde-apps/audiocd-kio-25.12.0

Description

KIO worker for accessing audio CDs

Added to portage

2025-12-12

baloo-widgets - 25.12.0
Ebuild name:

kde-apps/baloo-widgets-25.12.0

Description

Widget library for baloo

Added to portage

2025-12-12

blinken - 25.12.0
Ebuild name:

kde-apps/blinken-25.12.0

Description

Memory enhancement game based on KDE Frameworks

Added to portage

2025-12-12

calligra - 25.12.0
Ebuild name:

app-office/calligra-25.12.0

Description

KDE Office Suite

Added to portage

2025-12-12

dolphin-plugins-makefileactions - 25.12.0
Ebuild name:

dev-build/dolphin-plugins-makefileactions-25.12.0

Description

Dolphin plugin for Makefile targets integration

Added to portage

2025-12-12

dolphin-plugins-mountiso - 25.12.0
Ebuild name:

app-cdr/dolphin-plugins-mountiso-25.12.0

Description

Dolphin plugin for ISO loopback device mounting

Added to portage

2025-12-12

francis - 25.12.0
Ebuild name:

app-misc/francis-25.12.0

Description

Productivity application using the well-known pomodoro technique

Added to portage

2025-12-12

gapi-ocaml - 0.4.7
Ebuild name:

dev-ml/gapi-ocaml-0.4.7

Description

A simple OCaml client for Google Services

Added to portage

2025-12-12

gprconfig_kb - 26.0.0
Ebuild name:

dev-ada/gprconfig_kb-26.0.0

Description

GPR configuration knowledge base

Added to portage

2025-12-12

isoimagewriter - 25.12.0
Ebuild name:

app-cdr/isoimagewriter-25.12.0

Description

Write hybrid ISO files onto a USB disk

Added to portage

2025-12-12

kdevelop - 25.12.0
Ebuild name:

dev-util/kdevelop-25.12.0

Description

Integrated Development Environment, supporting KF6/Qt, C/C++ and much mor

Added to portage

2025-12-12

kdevelop-php - 25.12.0
Ebuild name:

dev-util/kdevelop-php-25.12.0

Description

PHP plugin for KDevelop

Added to portage

2025-12-12

kdevelop-python - 25.12.0
Ebuild name:

dev-util/kdevelop-python-25.12.0

Description

Python plugin for KDevelop

Added to portage

2025-12-12

keysmith - 25.12.0
Ebuild name:

app-crypt/keysmith-25.12.0

Description

OTP client for Plasma Mobile and Desktop

Added to portage

2025-12-12

kio-admin - 25.12.0
Ebuild name:

app-admin/kio-admin-25.12.0

Description

Manage files as administrator using the admin KIO protocol

Added to portage

2025-12-12

kio-perldoc - 25.12.0
Ebuild name:

dev-util/kio-perldoc-25.12.0

Description

KIO worker interface to browse Perl documentation

Added to portage

2025-12-12

kontrast - 25.12.0
Ebuild name:

app-accessibility/kontrast-25.12.0

Description

Tool to check contrast for colors to verify they are correctly a

Added to portage

2025-12-12

kopeninghours - 25.12.0
Ebuild name:

dev-libs/kopeninghours-25.12.0

Description

Library for parsing and evaluating OSM opening hours expressions

Added to portage

2025-12-12

kosmindoormap - 25.12.0
Ebuild name:

dev-libs/kosmindoormap-25.12.0

Description

Data Model and Extraction System for Travel Reservation information

Added to portage

2025-12-12

kpublictransport - 25.12.0
Ebuild name:

dev-libs/kpublictransport-25.12.0

Description

Library for accessing public transport timetables and other infor

Added to portage

2025-12-12

kweathercore - 25.12.0
Ebuild name:

dev-libs/kweathercore-25.12.0

Description

Library for retrieval of weather information including forecasts and

Added to portage

2025-12-12

massif-visualizer - 25.12.0
Ebuild name:

dev-util/massif-visualizer-25.12.0

Description

Tool visualising massif data

Added to portage

2025-12-12

memoist3 - 1.0.0
Ebuild name:

dev-ruby/memoist3-1.0.0

Description

ActiveSupport with a few enhancements

Added to portage

2025-12-12

merkuro - 25.12.0
Ebuild name:

app-office/merkuro-25.12.0

Description

Calendar application using Akonadi

Added to portage

2025-12-12

nanobind - 2.10.2
Ebuild name:

dev-python/nanobind-2.10.2

Description

Tiny and efficient C++/Python bindings

Added to portage

2025-12-12

package-lint - 0.26
Ebuild name:

app-emacs/package-lint-0.26

Description

Linting library for Emacs Lisp package metadata

Added to portage

2025-12-12

pandoc-mode - 2.35
Ebuild name:

app-emacs/pandoc-mode-2.35

Description

GNU Emacs minor mode for interacting with Pandoc

Added to portage

2025-12-12

pandoc-mode - 2.90.2
Ebuild name:

app-emacs/pandoc-mode-2.90.2

Description

GNU Emacs minor mode for interacting with Pandoc

Added to portage

2025-12-12

paredit - 26-r1
Ebuild name:

app-emacs/paredit-26-r1

Description

Minor mode for performing structured editing of S-expressions

Added to portage

2025-12-12

pariemacs - 3.14-r1
Ebuild name:

app-emacs/pariemacs-3.14-r1

Description

sci-mathematics/pari emacs mode

Added to portage

2025-12-12

parsebib - 6.7
Ebuild name:

app-emacs/parsebib-6.7

Description

Emacs Lisp library for reading .bib files

Added to portage

2025-12-12

rust - 1.92.0_p1
Ebuild name:

dev-lang/rust-1.92.0_p1

Description

Systems programming language originally developed by Mozilla

Added to portage

2025-12-12

rust-bin - 1.92.0
Ebuild name:

dev-lang/rust-bin-1.92.0

Description

Added to portage

2025-12-12

rust-common - 1.92.0
Ebuild name:

dev-lang/rust-common-1.92.0

Description

Common files shared between multiple slots of Rust

Added to portage

2025-12-12

scipy - 1.17.0_rc1
Ebuild name:

dev-python/scipy-1.17.0_rc1

Description

Scientific algorithms library for Python

Added to portage

2025-12-12

scribus - 1.7.1_pre20251210
Ebuild name:

app-office/scribus-1.7.1_pre20251210

Description

Desktop publishing (DTP) and layout program

Added to portage

2025-12-12

skladnik - 25.12.0
Ebuild name:

games-puzzle/skladnik-25.12.0

Description

The Japanese warehouse keeper sokoban game

Added to portage

2025-12-12

solaar - 1.1.18
Ebuild name:

app-misc/solaar-1.1.18

Description

Linux Device Manager for Logitech Unifying Receivers and Paired Devices

Added to portage

2025-12-12

2025-12-11
alsa-lib - 1.2.15-r3
Ebuild name:

media-libs/alsa-lib-1.2.15-r3

Description

Advanced Linux Sound Architecture Library

Added to portage

2025-12-11

awscli - 1.43.13
Ebuild name:

app-admin/awscli-1.43.13

Description

Universal Command Line Environment for AWS

Added to portage

2025-12-11

bacula - 15.0.3-r2
Ebuild name:

app-backup/bacula-15.0.3-r2

Description

Featureful client/server network backup suite

Added to portage

2025-12-11

boto3 - 1.42.7
Ebuild name:

dev-python/boto3-1.42.7

Description

The AWS SDK for Python

Added to portage

2025-12-11

botocore - 1.42.7
Ebuild name:

dev-python/botocore-1.42.7

Description

Low-level, data-driven core of boto 3

Added to portage

2025-12-11

camlp5 - 8.03.01-r1
Ebuild name:

dev-ml/camlp5-8.03.01-r1

Description

A preprocessor-pretty-printer of ocaml

Added to portage

2025-12-11

camlp5 - 8.03.06-r1
Ebuild name:

dev-ml/camlp5-8.03.06-r1

Description

A preprocessor-pretty-printer of ocaml

Added to portage

2025-12-11

camlp5 - 8.04.00
Ebuild name:

dev-ml/camlp5-8.04.00

Description

A preprocessor-pretty-printer of ocaml

Added to portage

2025-12-11

certbot - 5.2.2
Ebuild name:

app-crypt/certbot-5.2.2

Description

Let's Encrypt client to automate deployment of X.509 certificates

Added to portage

2025-12-11

claude-code - 2.0.64
Ebuild name:

dev-util/claude-code-2.0.64

Description

Claude Code - an agentic coding tool by Anthropic

Added to portage

2025-12-11

console - 1.34.2
Ebuild name:

dev-ruby/console-1.34.2

Description

Beautiful logging for Ruby

Added to portage

2025-12-11

cucumber-core - 15.4.0
Ebuild name:

dev-util/cucumber-core-15.4.0

Description

Executable feature scenarios

Added to portage

2025-12-11

cucumber-gherkin - 30.1.3
Ebuild name:

dev-util/cucumber-gherkin-30.1.3

Description

Fast Gherkin lexer and parser

Added to portage

2025-12-11

deno-bin - 2.6.0
Ebuild name:

dev-lang/deno-bin-2.6.0

Description

Modern runtime for JavaScript and TypeScript

Added to portage

2025-12-11

diffpdf - 2.1.3-r4
Ebuild name:

app-text/diffpdf-2.1.3-r4

Description

Program that textually or visually compares two PDF files

Added to portage

2025-12-11

gnu-efi - 4.0.4
Ebuild name:

sys-boot/gnu-efi-4.0.4

Description

Library for build EFI Applications

Added to portage

2025-12-11

hcloud - 2.12.0
Ebuild name:

dev-python/hcloud-2.12.0

Description

Official Hetzner Cloud python library

Added to portage

2025-12-11

jenkins-bin - 2.528.3
Ebuild name:

dev-util/jenkins-bin-2.528.3

Description

The leading open source automation server

Added to portage

2025-12-11

jenkins-bin - 2.541
Ebuild name:

dev-util/jenkins-bin-2.541

Description

The leading open source automation server

Added to portage

2025-12-11

mathmod - 13.0-r1
Ebuild name:

sci-mathematics/mathmod-13.0-r1

Description

Plot parametric and implicit surfaces

Added to portage

2025-12-11

matplotlib - 3.10.8
Ebuild name:

dev-python/matplotlib-3.10.8

Description

Pure python plotting library with matlab like syntax

Added to portage

2025-12-11

mattermost-desktop-bin - 6.0.2
Ebuild name:

net-im/mattermost-desktop-bin-6.0.2

Description

Mattermost Desktop application

Added to portage

2025-12-11

mod_h2 - 2.0.37
Ebuild name:

www-apache/mod_h2-2.0.37

Description

HTTP/2 module for Apache

Added to portage

2025-12-11

openbabel - 3.1.1_p20241221-r4
Ebuild name:

sci-chemistry/openbabel-3.1.1_p20241221-r4

Description

Interconverts file formats used in molecular modeling

Added to portage

2025-12-11

parseclj - 1.1.1
Ebuild name:

app-emacs/parseclj-1.1.1

Description

Clojure Parser for Emacs Lisp

Added to portage

2025-12-11

parseedn - 1.2.1
Ebuild name:

app-emacs/parseedn-1.2.1

Description

EDN parser for Emacs Lisp

Added to portage

2025-12-11

perf - 6.18-r1
Ebuild name:

dev-util/perf-6.18-r1

Description

Userland tools for Linux Performance Counters

Added to portage

2025-12-11

pycares - 5.0.0
Ebuild name:

dev-python/pycares-5.0.0

Description

Python interface for c-ares

Added to portage

2025-12-11

qtdeclarative - 6.10.1-r1
Ebuild name:

dev-qt/qtdeclarative-6.10.1-r1

Description

Qt Declarative (Quick 2)

Added to portage

2025-12-11

reportlab - 4.4.6
Ebuild name:

dev-python/reportlab-4.4.6

Description

Tools for generating printable PDF documents from any data source

Added to portage

2025-12-11

scikit-learn - 1.8.0
Ebuild name:

dev-python/scikit-learn-1.8.0

Description

Machine learning library for Python

Added to portage

2025-12-11

selenium-webdriver - 4.39.0
Ebuild name:

dev-ruby/selenium-webdriver-4.39.0

Description

This gem provides Ruby bindings for WebDriver

Added to portage

2025-12-11

signal-desktop-bin - 7.82.0
Ebuild name:

net-im/signal-desktop-bin-7.82.0

Description

Allows you to send and receive messages of Signal Messenger on you

Added to portage

2025-12-11

smb4k - 4.0.5
Ebuild name:

net-misc/smb4k-4.0.5

Description

Advanced network neighborhood browser

Added to portage

2025-12-11

sonic-visualiser - 5.2.1
Ebuild name:

media-sound/sonic-visualiser-5.2.1

Description

Music audio files viewer and analyser

Added to portage

2025-12-11

thunderbird - 140.6.0
Ebuild name:

mail-client/thunderbird-140.6.0

Description

Thunderbird Mail Client

Added to portage

2025-12-11

thunderbird - 146.0
Ebuild name:

mail-client/thunderbird-146.0

Description

Thunderbird Mail Client

Added to portage

2025-12-11

thunderbird-bin - 140.6.0
Ebuild name:

mail-client/thunderbird-bin-140.6.0

Description

Thunderbird Mail Client

Added to portage

2025-12-11

thunderbird-bin - 146.0
Ebuild name:

mail-client/thunderbird-bin-146.0

Description

Thunderbird Mail Client

Added to portage

2025-12-11

types-psutil - 7.1.3.20251211
Ebuild name:

dev-python/types-psutil-7.1.3.20251211

Description

Typing stubs for psutil

Added to portage

2025-12-11

rdf newsfeed | rss newsfeed | Atom newsfeed
Copyright 2004-2025 Sascha Nitsch Unternehmensberatung GmbH
- Copyright and legal notices -
Time to create this page: 64.4 ms