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:

82312

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-06
aardvark-dns - 1.17.0
Ebuild name:

app-containers/aardvark-dns-1.17.0

Description

A container-focused DNS server

Added to portage

2025-12-06

aiodns - 3.6.0
Ebuild name:

dev-python/aiodns-3.6.0

Description

Simple DNS resolver for asyncio

Added to portage

2025-12-06

awscli - 1.43.10
Ebuild name:

app-admin/awscli-1.43.10

Description

Universal Command Line Environment for AWS

Added to portage

2025-12-06

bcc - 0.35.0-r2
Ebuild name:

dev-util/bcc-0.35.0-r2

Description

Tools for BPF-based Linux IO analysis, networking, monitoring, and more

Added to portage

2025-12-06

bcrypt_pbkdf - 1.1.2
Ebuild name:

dev-ruby/bcrypt_pbkdf-1.1.2

Description

Implements bcrypt_pdkfd (a variant of PBKDF2 with bcrypt-based PRF)

Added to portage

2025-12-06

blas-lapack-aux-wrapper - 3
Ebuild name:

sci-libs/blas-lapack-aux-wrapper-3

Description

BLAS/LAPACK wrappers for FlexiBLAS

Added to portage

2025-12-06

boto3 - 1.42.4
Ebuild name:

dev-python/boto3-1.42.4

Description

The AWS SDK for Python

Added to portage

2025-12-06

botocore - 1.42.4
Ebuild name:

dev-python/botocore-1.42.4

Description

Low-level, data-driven core of boto 3

Added to portage

2025-12-06

fastfetch - 2.56.0
Ebuild name:

app-misc/fastfetch-2.56.0

Description

Fast neofetch-like system information tool

Added to portage

2025-12-06

gcc - 13.4.1_p20251204
Ebuild name:

sys-devel/gcc-13.4.1_p20251204

Description

The GNU Compiler Collection

Added to portage

2025-12-06

gcc - 14.3.1_p20251205
Ebuild name:

sys-devel/gcc-14.3.1_p20251205

Description

The GNU Compiler Collection

Added to portage

2025-12-06

go - 1.24.11
Ebuild name:

dev-lang/go-1.24.11

Description

A concurrent garbage collected and typesafe programming language

Added to portage

2025-12-06

go - 1.25.5
Ebuild name:

dev-lang/go-1.25.5

Description

A concurrent garbage collected and typesafe programming language

Added to portage

2025-12-06

hotspot - 1.5.1_p20250907
Ebuild name:

dev-debug/hotspot-1.5.1_p20250907

Description

Linux perf GUI for performance analysis

Added to portage

2025-12-06

hotspot - 9999
Ebuild name:

dev-debug/hotspot-9999

Description

Linux perf GUI for performance analysis

Added to portage

2025-12-06

knot - 3.4.9-r1
Ebuild name:

net-dns/knot-3.4.9-r1

Description

High-performance authoritative-only DNS server

Added to portage

2025-12-06

knot - 3.5.2-r1
Ebuild name:

net-dns/knot-3.5.2-r1

Description

High-performance authoritative-only DNS server

Added to portage

2025-12-06

marshmallow - 4.1.1
Ebuild name:

dev-python/marshmallow-4.1.1

Description

A library for converting to and from native Python datatypes

Added to portage

2025-12-06

netavark - 1.17.0
Ebuild name:

app-containers/netavark-1.17.0

Description

A container network stack

Added to portage

2025-12-06

openblas - 0.3.30-r4
Ebuild name:

sci-libs/openblas-0.3.30-r4

Description

Optimized BLAS library based on GotoBLAS2

Added to portage

2025-12-06

pbs-installer - 2025.12.5
Ebuild name:

dev-python/pbs-installer-2025.12.5

Description

Installer for Python Build Standalone

Added to portage

2025-12-06

phonenumbers - 9.0.20
Ebuild name:

dev-python/phonenumbers-9.0.20

Description

Python port of Google's libphonenumber

Added to portage

2025-12-06

platformdirs - 4.5.1
Ebuild name:

dev-python/platformdirs-4.5.1

Description

A small Python module for determining appropriate platform-specific d

Added to portage

2025-12-06

postfix - 3.11_pre20251205
Ebuild name:

mail-mta/postfix-3.11_pre20251205

Description

A fast and secure drop-in replacement for sendmail

Added to portage

2025-12-06

protobuf - 6.33.2
Ebuild name:

dev-python/protobuf-6.33.2

Description

Google's Protocol Buffers - Python bindings

Added to portage

2025-12-06

ptools - 1.5.2
Ebuild name:

dev-ruby/ptools-1.5.2

Description

Several handy methods to Ruby's core File class

Added to portage

2025-12-06

pyqt-builder - 1.19.1
Ebuild name:

dev-python/pyqt-builder-1.19.1

Description

The PEP 517 compliant PyQt build system

Added to portage

2025-12-06

pyqt6 - 6.10.1
Ebuild name:

dev-python/pyqt6-6.10.1

Description

Python bindings for the Qt framework

Added to portage

2025-12-06

pytest-jobserver - 1.0.0
Ebuild name:

dev-python/pytest-jobserver-1.0.0

Description

Limit parallel tests with POSIX jobserver

Added to portage

2025-12-06

python - 0.3.13.11
Ebuild name:

dev-lang/python-0.3.13.11

Description

Freethreading (no-GIL) version of Python programming language

Added to portage

2025-12-06

python - 0.3.14.2
Ebuild name:

dev-lang/python-0.3.14.2

Description

Freethreading (no-GIL) version of Python programming language

Added to portage

2025-12-06

python - 3.13.11
Ebuild name:

dev-lang/python-3.13.11

Description

An interpreted, interactive, object-oriented programming language

Added to portage

2025-12-06

python - 3.14.2
Ebuild name:

dev-lang/python-3.14.2

Description

An interpreted, interactive, object-oriented programming language

Added to portage

2025-12-06

python-tests - 0.3.13.11
Ebuild name:

dev-python/python-tests-0.3.13.11

Description

Test modules from dev-lang/python

Added to portage

2025-12-06

python-tests - 0.3.14.2
Ebuild name:

dev-python/python-tests-0.3.14.2

Description

Test modules from dev-lang/python

Added to portage

2025-12-06

python-tests - 3.13.11
Ebuild name:

dev-python/python-tests-3.13.11

Description

Test modules from dev-lang/python

Added to portage

2025-12-06

python-tests - 3.14.2
Ebuild name:

dev-python/python-tests-3.14.2

Description

Test modules from dev-lang/python

Added to portage

2025-12-06

rackup - 2.3.1
Ebuild name:

dev-ruby/rackup-2.3.1

Description

A general server command for Rack applications

Added to portage

2025-12-06

rdoc - 6.16.1
Ebuild name:

dev-ruby/rdoc-6.16.1

Description

An extended version of the RDoc library from Ruby 1.8

Added to portage

2025-12-06

recog - 3.1.24
Ebuild name:

dev-ruby/recog-3.1.24

Description

Pattern recognition for hosts, services, and content

Added to portage

2025-12-06

ssss - 0.5.7-r3
Ebuild name:

app-crypt/ssss-0.5.7-r3

Description

Shamir's Secret Sharing Scheme

Added to portage

2025-12-06

stan - 0.4.1-r1
Ebuild name:

app-crypt/stan-0.4.1-r1

Description

Stan analyzes binary streams and calculates statistical information

Added to portage

2025-12-06

statsmodels - 0.14.6
Ebuild name:

dev-python/statsmodels-0.14.6

Description

Statistical computations and models for use with SciPy

Added to portage

2025-12-06

stoken - 0.92-r3
Ebuild name:

app-crypt/stoken-0.92-r3

Description

Software Token for Linux/UNIX

Added to portage

2025-12-06

stringio - 3.1.9
Ebuild name:

dev-ruby/stringio-3.1.9

Description

Pseudo IO class from/to String.

Added to portage

2025-12-06

test-unit - 3.7.3
Ebuild name:

dev-ruby/test-unit-3.7.3

Description

An xUnit family unit testing framework for Ruby

Added to portage

2025-12-06

test-unit-ruby-core - 1.0.14
Ebuild name:

dev-ruby/test-unit-ruby-core-1.0.14

Description

Additional test assertions for Ruby standard libraries

Added to portage

2025-12-06

transformers - 4.57.3
Ebuild name:

sci-ml/transformers-4.57.3

Description

State-of-the-art Machine Learning for JAX, PyTorch and TensorFlow

Added to portage

2025-12-06

urllib3 - 2.6.0
Ebuild name:

dev-python/urllib3-2.6.0

Description

HTTP library with thread-safe connection pooling, file post, and more

Added to portage

2025-12-06

xarray - 2025.12.0
Ebuild name:

dev-python/xarray-2025.12.0

Description

N-D labeled arrays and datasets in Python

Added to portage

2025-12-06

2025-12-05
android-studio - 2025.2.2.7
Ebuild name:

dev-util/android-studio-2025.2.2.7

Description

Android development environment based on IntelliJ IDEA

Added to portage

2025-12-05

apache - 2.4.66
Ebuild name:

www-servers/apache-2.4.66

Description

The Apache Web Server

Added to portage

2025-12-05

apache-tools - 2.4.66
Ebuild name:

app-admin/apache-tools-2.4.66

Description

Useful Apache tools - htdigest, htpasswd, ab, htdbm

Added to portage

2025-12-05

awscli - 1.43.9
Ebuild name:

app-admin/awscli-1.43.9

Description

Universal Command Line Environment for AWS

Added to portage

2025-12-05

boto3 - 1.42.3
Ebuild name:

dev-python/boto3-1.42.3

Description

The AWS SDK for Python

Added to portage

2025-12-05

botocore - 1.42.3
Ebuild name:

dev-python/botocore-1.42.3

Description

Low-level, data-driven core of boto 3

Added to portage

2025-12-05

cliff - 4.13.0
Ebuild name:

dev-python/cliff-4.13.0

Description

Command Line Interface Formulation Framework

Added to portage

2025-12-05

clion - 2025.2.5
Ebuild name:

dev-util/clion-2025.2.5

Description

A complete toolset for C and C++ development

Added to portage

2025-12-05

createrepo_c - 1.2.1-r3
Ebuild name:

app-arch/createrepo_c-1.2.1-r3

Description

C implementation of createrepo

Added to portage

2025-12-05

django-polymorphic - 4.2.0
Ebuild name:

dev-python/django-polymorphic-4.2.0

Description

Seamless Polymorphic Inheritance for Django Models

Added to portage

2025-12-05

duplicity - 3.0.6.3
Ebuild name:

app-backup/duplicity-3.0.6.3

Description

Secure backup system using gnupg to encrypt data

Added to portage

2025-12-05

e16-themes - 1.0.3
Ebuild name:

x11-themes/e16-themes-1.0.3

Description

All the official E16 themes

Added to portage

2025-12-05

eid-mw - 5.1.26
Ebuild name:

app-crypt/eid-mw-5.1.26

Description

Electronic Identity Card middleware supplied by the Belgian Federal Governm

Added to portage

2025-12-05

gnu-efi - 4.0.3
Ebuild name:

sys-boot/gnu-efi-4.0.3

Description

Library for build EFI Applications

Added to portage

2025-12-05

goland - 2025.2.5
Ebuild name:

dev-util/goland-2025.2.5

Description

Golang IDE by JetBrains

Added to portage

2025-12-05

greenlet - 3.3.0
Ebuild name:

dev-python/greenlet-3.3.0

Description

Lightweight in-process concurrent programming

Added to portage

2025-12-05

hypothesis - 6.148.7
Ebuild name:

dev-python/hypothesis-6.148.7

Description

A library for property based testing

Added to portage

2025-12-05

jj - 0.36.0
Ebuild name:

dev-vcs/jj-0.36.0

Description

Jujutsu - an experimental version control system

Added to portage

2025-12-05

pecl-xattr - 1.4.1
Ebuild name:

dev-php/pecl-xattr-1.4.1

Description

Extended attributes for PHP

Added to portage

2025-12-05

pf-sources - 6.17_p4
Ebuild name:

sys-kernel/pf-sources-6.17_p4

Description

Added to portage

2025-12-05

pf-sources - 6.18_p2
Ebuild name:

sys-kernel/pf-sources-6.18_p2

Description

Added to portage

2025-12-05

pkg-config - 1.6.5
Ebuild name:

dev-ruby/pkg-config-1.6.5

Description

A pkg-config implementation by Ruby

Added to portage

2025-12-05

posh - 0.14.3
Ebuild name:

app-shells/posh-0.14.3

Description

Reimplementation of Bourne shell based on pdksh

Added to portage

2025-12-05

pycharm-community - 2025.2.5
Ebuild name:

dev-util/pycharm-community-2025.2.5

Description

Intelligent Python IDE with unique code assistance and analysis

Added to portage

2025-12-05

pycharm-professional - 2025.2.5
Ebuild name:

dev-util/pycharm-professional-2025.2.5

Description

Intelligent Python IDE with unique code assistance and analy

Added to portage

2025-12-05

pyghmi - 1.6.8
Ebuild name:

dev-python/pyghmi-1.6.8

Description

A pure python implementation of IPMI protocol

Added to portage

2025-12-05

qdmr - 0.13.2
Ebuild name:

net-wireless/qdmr-0.13.2

Description

GUI application for configuring and programming cheap DMR radios

Added to portage

2025-12-05

ruff - 0.14.8
Ebuild name:

dev-util/ruff-0.14.8

Description

An extremely fast Python linter, written in Rust

Added to portage

2025-12-05

signal-desktop-bin - 7.81.0
Ebuild name:

net-im/signal-desktop-bin-7.81.0

Description

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

Added to portage

2025-12-05

sphinx - 9.0.4
Ebuild name:

dev-python/sphinx-9.0.4

Description

Python documentation generator

Added to portage

2025-12-05

swi-prolog - 10.0.0
Ebuild name:

dev-lang/swi-prolog-10.0.0

Description

Versatile implementation of the Prolog programming language

Added to portage

2025-12-05

translate-toolkit - 3.17.4
Ebuild name:

dev-python/translate-toolkit-3.17.4

Description

Toolkit to convert between many translation formats

Added to portage

2025-12-05

transmission - 4.1.0_beta4
Ebuild name:

net-p2p/transmission-4.1.0_beta4

Description

A fast, easy, and free BitTorrent client

Added to portage

2025-12-05

tsmuxer - 2.7.0
Ebuild name:

media-video/tsmuxer-2.7.0

Description

Utility to create and demux TS and M2TS files

Added to portage

2025-12-05

upterm - 0.20.0
Ebuild name:

app-misc/upterm-0.20.0

Description

Instant Terminal Sharing

Added to portage

2025-12-05

vanilla-sources - 6.18.0
Ebuild name:

sys-kernel/vanilla-sources-6.18.0

Description

Full sources for the Linux kernel

Added to portage

2025-12-05

wayfire - 0.10.1
Ebuild name:

gui-wm/wayfire-0.10.1

Description

compiz like 3D wayland compositor

Added to portage

2025-12-05

wireshark - 4.6.2-r1
Ebuild name:

net-analyzer/wireshark-4.6.2-r1

Description

Network protocol analyzer (sniffer)

Added to portage

2025-12-05

xdp-tools - 1.5.8
Ebuild name:

net-libs/xdp-tools-1.5.8

Description

The libxdp library and various tools for use with XDP

Added to portage

2025-12-05

zen-sources - 6.17.8
Ebuild name:

sys-kernel/zen-sources-6.17.8

Description

The Zen Kernel Live Sources

Added to portage

2025-12-05

zen-sources - 6.17.9
Ebuild name:

sys-kernel/zen-sources-6.17.9

Description

The Zen Kernel Live Sources

Added to portage

2025-12-05

zen-sources - 6.18
Ebuild name:

sys-kernel/zen-sources-6.18

Description

The Zen Kernel Live Sources

Added to portage

2025-12-05

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