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:

85944

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
2026-06-15
86Box - 6.0
Ebuild name:

app-emulation/86Box-6.0

Description

Emulator of x86-based machines based on PCem

Added to portage

2026-06-15

IP-Country-DB_File - 4.0.0
Ebuild name:

dev-perl/IP-Country-DB_File-4.0.0

Description

Build an IP address to country code database

Added to portage

2026-06-15

LuaBitOp - 1.0.3
Ebuild name:

dev-lua/LuaBitOp-1.0.3

Description

Bit Operations Library for the Lua Programming Language

Added to portage

2026-06-15

alacenc - 0.4.2
Ebuild name:

media-sound/alacenc-0.4.2

Description

Encodes audio into the Apple Lossless Audio Codec (ALAC) format

Added to portage

2026-06-15

bedrock-server - 1.26.23.1
Ebuild name:

games-server/bedrock-server-1.26.23.1

Description

The official bedrock (non-java) based server for the sandbox

Added to portage

2026-06-15

claude-code - 2.1.177
Ebuild name:

dev-util/claude-code-2.1.177

Description

Claude Code - an agentic coding tool by Anthropic

Added to portage

2026-06-15

dist-kernel - 6.12.93-r1
Ebuild name:

virtual/dist-kernel-6.12.93-r1

Description

Virtual to depend on any Distribution Kernel

Added to portage

2026-06-15

dist-kernel - 6.18.35-r1
Ebuild name:

virtual/dist-kernel-6.18.35-r1

Description

Virtual to depend on any Distribution Kernel

Added to portage

2026-06-15

dist-kernel - 7.0.12-r1
Ebuild name:

virtual/dist-kernel-7.0.12-r1

Description

Virtual to depend on any Distribution Kernel

Added to portage

2026-06-15

faudio - 26.06
Ebuild name:

app-emulation/faudio-26.06

Description

Accuracy-focused XAudio reimplementation for open platforms

Added to portage

2026-06-15

ffmpeg-chromium - 151
Ebuild name:

media-video/ffmpeg-chromium-151

Description

FFmpeg built specifically for codec support in Chromium-based brows

Added to portage

2026-06-15

gcc - 16.1.1_p20260613
Ebuild name:

sys-devel/gcc-16.1.1_p20260613

Description

The GNU Compiler Collection

Added to portage

2026-06-15

gentoo-kernel-bin - 6.12.93-r1
Ebuild name:

sys-kernel/gentoo-kernel-bin-6.12.93-r1

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2026-06-15

gentoo-kernel-bin - 6.18.35-r1
Ebuild name:

sys-kernel/gentoo-kernel-bin-6.18.35-r1

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2026-06-15

gentoo-kernel-bin - 7.0.12-r1
Ebuild name:

sys-kernel/gentoo-kernel-bin-7.0.12-r1

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2026-06-15

hydrus - 637
Ebuild name:

media-gfx/hydrus-637

Description

A booru-like media organizer for the desktop

Added to portage

2026-06-15

intel-compute-runtime - 26.22.38646.4
Ebuild name:

dev-libs/intel-compute-runtime-26.22.38646.4

Description

Intel Graphics Compute Runtime for oneAPI Level Zero a

Added to portage

2026-06-15

intel-graphics-compiler - 2.37.1
Ebuild name:

dev-util/intel-graphics-compiler-2.37.1

Description

LLVM-based OpenCL compiler for OpenCL targetting Intel Gen

Added to portage

2026-06-15

intel-graphics-system-controller - 1.3.0
Ebuild name:

dev-util/intel-graphics-system-controller-1.3.0

Description

Intel graphics system controller firmware update li

Added to portage

2026-06-15

intel-metrics-discovery - 1.16.188
Ebuild name:

dev-libs/intel-metrics-discovery-1.16.188

Description

A user mode library that provides access to GPU performan

Added to portage

2026-06-15

intel-metrics-library - 1.0.231
Ebuild name:

dev-libs/intel-metrics-library-1.0.231

Description

User mode driver helper library that provides access to GPU

Added to portage

2026-06-15

ipmicfg - 1.37.0.250723
Ebuild name:

sys-apps/ipmicfg-1.37.0.250723

Description

An in-band utility for configuring Supermicro IPMI devices

Added to portage

2026-06-15

ipmiview - 2.24.0.251224
Ebuild name:

net-misc/ipmiview-2.24.0.251224

Description

A GUI application that allows to manage multiple target systems thr

Added to portage

2026-06-15

knot - 3.5.5
Ebuild name:

net-dns/knot-3.5.5

Description

High-performance authoritative-only DNS server

Added to portage

2026-06-15

level-zero - 1.30.0
Ebuild name:

dev-libs/level-zero-1.30.0

Description

oneAPI Level Zero headers, loader and validation layer

Added to portage

2026-06-15

luadbi - 0.7.5
Ebuild name:

dev-lua/luadbi-0.7.5

Description

A database interface library for Lua

Added to portage

2026-06-15

luajson - 1.3.5
Ebuild name:

dev-lua/luajson-1.3.5

Description

JSON Parser/Constructor for Lua

Added to portage

2026-06-15

metee - 6.2.4
Ebuild name:

dev-libs/metee-6.2.4

Description

Cross-platform access library for Intel CSME HECI interface

Added to portage

2026-06-15

mysqltuner - 2.8.44
Ebuild name:

dev-db/mysqltuner-2.8.44

Description

Makes recommendations for increased performance and stability for MySQL

Added to portage

2026-06-15

networkmanager-strongswan - 1.6.5
Ebuild name:

net-vpn/networkmanager-strongswan-1.6.5

Description

NetworkManager StrongSwan plugin

Added to portage

2026-06-15

opencl-clang - 16.0.12
Ebuild name:

dev-libs/opencl-clang-16.0.12

Description

OpenCL-oriented thin wrapper library around clang

Added to portage

2026-06-15

opencl-clang - 17.0.7
Ebuild name:

dev-libs/opencl-clang-17.0.7

Description

OpenCL-oriented thin wrapper library around clang

Added to portage

2026-06-15

opencl-clang - 18.1.6
Ebuild name:

dev-libs/opencl-clang-18.1.6

Description

OpenCL-oriented thin wrapper library around clang

Added to portage

2026-06-15

opencl-clang - 19.1.4
Ebuild name:

dev-libs/opencl-clang-19.1.4

Description

OpenCL-oriented thin wrapper library around clang

Added to portage

2026-06-15

opencl-clang - 20.1.4
Ebuild name:

dev-libs/opencl-clang-20.1.4

Description

OpenCL-oriented thin wrapper library around clang

Added to portage

2026-06-15

opencl-clang - 21.1.4
Ebuild name:

dev-libs/opencl-clang-21.1.4

Description

OpenCL-oriented thin wrapper library around clang

Added to portage

2026-06-15

opencl-clang - 22.1.1
Ebuild name:

dev-libs/opencl-clang-22.1.1

Description

OpenCL-oriented thin wrapper library around clang

Added to portage

2026-06-15

openrct2 - 0.5.2
Ebuild name:

games-simulation/openrct2-0.5.2

Description

An open source re-implementation of Chris Sawyer's RollerCoaster Ty

Added to portage

2026-06-15

prosody - 13.0.6
Ebuild name:

net-im/prosody-13.0.6

Description

Prosody is a modern XMPP communication server

Added to portage

2026-06-15

redis-knot - 3.5.5
Ebuild name:

net-dns/redis-knot-3.5.5

Description

Redis module for Knot DNS

Added to portage

2026-06-15

rrdtool - 1.10.3
Ebuild name:

net-analyzer/rrdtool-1.10.3

Description

A data logging and graphing system for time series data

Added to portage

2026-06-15

smcipmitool - 2.30.0.250915
Ebuild name:

sys-apps/smcipmitool-2.30.0.250915

Description

An out-of-band utility for interfacing with SuperBlade and IPMI

Added to portage

2026-06-15

sphinx-panels - 0.6.0-r2
Ebuild name:

dev-python/sphinx-panels-0.6.0-r2

Description

A sphinx extension for creating panels in a grid layout

Added to portage

2026-06-15

stress-ng - 0.21.03
Ebuild name:

app-benchmarks/stress-ng-0.21.03

Description

Stress test for a computer system with various selectable ways

Added to portage

2026-06-15

superdiag - 1.11.0.20251106
Ebuild name:

sys-apps/superdiag-1.11.0.20251106

Description

Provides the capability to determine the health of Supermicro se

Added to portage

2026-06-15

tas - 1.11.0.260514
Ebuild name:

sys-apps/tas-1.11.0.260514

Description

Supermicro Thin-Agent Service for monitoring through the BMC/IPMI

Added to portage

2026-06-15

tlp - 1.10.1
Ebuild name:

sys-power/tlp-1.10.1

Description

Optimize laptop battery life

Added to portage

2026-06-15

tlp - 1.9.1-r1
Ebuild name:

sys-power/tlp-1.9.1-r1

Description

Optimize laptop battery life

Added to portage

2026-06-15

unifi - 10.4.57
Ebuild name:

net-wireless/unifi-10.4.57

Description

A Management Controller for Ubiquiti Networks UniFi APs

Added to portage

2026-06-15

vanilla-sources - 7.1.0
Ebuild name:

sys-kernel/vanilla-sources-7.1.0

Description

Full sources for the Linux kernel

Added to portage

2026-06-15

2026-06-14
ansilove - 4.2.2
Ebuild name:

media-gfx/ansilove-4.2.2

Description

ANSI and ASCII art to PNG converter (using libansilove)

Added to portage

2026-06-14

asymptote - 3.12
Ebuild name:

media-gfx/asymptote-3.12

Description

A vector graphics language that provides a framework for technical drawing

Added to portage

2026-06-14

cava - 1.0.0
Ebuild name:

media-sound/cava-1.0.0

Description

Console-based Audio Visualizer for Alsa

Added to portage

2026-06-14

cproto - 4.8
Ebuild name:

dev-util/cproto-4.8

Description

Generate C function prototypes from C source code

Added to portage

2026-06-14

easycrypt - 2026.06
Ebuild name:

sci-mathematics/easycrypt-2026.06

Description

Computer-Aided Cryptographic Proofs

Added to portage

2026-06-14

elementpath - 5.1.2
Ebuild name:

dev-python/elementpath-5.1.2

Description

XPath 1.0/2.0 parsers and selectors for ElementTree and lxml

Added to portage

2026-06-14

filelock - 3.29.4
Ebuild name:

dev-python/filelock-3.29.4

Description

A platform independent file lock for Python

Added to portage

2026-06-14

gallery-dl - 1.32.3
Ebuild name:

net-misc/gallery-dl-1.32.3

Description

Download image galleries and collections from several image hosting site

Added to portage

2026-06-14

kismet - 2025.09.1-r1
Ebuild name:

net-wireless/kismet-2025.09.1-r1

Description

IEEE 802.11 wireless LAN sniffer

Added to portage

2026-06-14

man-pages-l10n - 4.30.2
Ebuild name:

app-i18n/man-pages-l10n-4.30.2

Description

A somewhat comprehensive collection of man page translations

Added to portage

2026-06-14

nss - 3.125
Ebuild name:

dev-libs/nss-3.125

Description

Mozilla's Network Security Services library that implements PKI support

Added to portage

2026-06-14

peewee - 4.0.8
Ebuild name:

dev-python/peewee-4.0.8

Description

Small Python ORM

Added to portage

2026-06-14

pygit2 - 1.19.3
Ebuild name:

dev-python/pygit2-1.19.3

Description

Python bindings for libgit2

Added to portage

2026-06-14

pyproject-fmt - 2.24.1
Ebuild name:

dev-python/pyproject-fmt-2.24.1

Description

Format your pyproject.toml file

Added to portage

2026-06-14

pyrate-limiter - 4.3.1
Ebuild name:

dev-python/pyrate-limiter-4.3.1

Description

Python Rate-Limiter using Leaky-Bucket Algorimth Family

Added to portage

2026-06-14

pytest - 9.1.0
Ebuild name:

dev-python/pytest-9.1.0

Description

Simple powerful testing with Python

Added to portage

2026-06-14

pytest-order - 1.5.0
Ebuild name:

dev-python/pytest-order-1.5.0

Description

pytest plugin to run your tests in a specific order

Added to portage

2026-06-14

signxml - 4.5.1
Ebuild name:

dev-python/signxml-4.5.1

Description

Python XML Signature and XAdES library

Added to portage

2026-06-14

sybil - 10.1.0
Ebuild name:

dev-python/sybil-10.1.0

Description

Automated testing for the examples in your documentation

Added to portage

2026-06-14

terminus-font - 4.49.1-r3
Ebuild name:

media-fonts/terminus-font-4.49.1-r3

Description

A clean fixed font for the console and X11

Added to portage

2026-06-14

virtualenv - 21.5.0
Ebuild name:

dev-python/virtualenv-21.5.0

Description

Virtual Python Environment builder

Added to portage

2026-06-14

wine-staging - 11.11
Ebuild name:

app-emulation/wine-staging-11.11

Description

Free implementation of Windows(tm) on Unix, with Wine-Staging patc

Added to portage

2026-06-14

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