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:

82101

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.
rate this article:
current rating: average rating: 1.4 (42 votes) (1=very good 6=terrible)
Your rating:
Very good (1) Good (2) ok (3) average (4) bad (5) terrible (6)

back



Support us on Content Nation

New Packages

- as rdf newsfeed
- as rss newsfeed
- as Atom newsfeed
2025-11-17
asttokens - 3.0.1
Ebuild name:

dev-python/asttokens-3.0.1

Description

Annotate Python AST trees with source text and token information

Added to portage

2025-11-17

backrefs - 6.1
Ebuild name:

dev-python/backrefs-6.1

Description

Wrapper around re or regex that adds additional back references

Added to portage

2025-11-17

boogie - 3.5.5-r1
Ebuild name:

dev-lang/boogie-3.5.5-r1

Description

SMT-based program verifier

Added to portage

2025-11-17

ccls - 0.20250815.1
Ebuild name:

dev-util/ccls-0.20250815.1

Description

C/C++/ObjC language server

Added to portage

2025-11-17

chromium - 142.0.7444.162
Ebuild name:

www-client/chromium-142.0.7444.162

Description

Open-source version of Google Chrome web browser

Added to portage

2025-11-17

click - 8.3.1-r1
Ebuild name:

dev-python/click-8.3.1-r1

Description

A Python package for creating beautiful command line interfaces

Added to portage

2025-11-17

csharp-gentoodotnetinfo - 2.0.0-r1
Ebuild name:

dev-dotnet/csharp-gentoodotnetinfo-2.0.0-r1

Description

.NET information tool for Gentoo

Added to portage

2025-11-17

dbus-fast - 2.46.4
Ebuild name:

dev-python/dbus-fast-2.46.4

Description

A faster version of dbus-next

Added to portage

2025-11-17

dbus-fast - 3.1.2
Ebuild name:

dev-python/dbus-fast-3.1.2

Description

A faster version of dbus-next

Added to portage

2025-11-17

direwolf - 1.8.1
Ebuild name:

media-radio/direwolf-1.8.1

Description

Decoded Information from Radio Emissions for Windows Or Linux Fans

Added to portage

2025-11-17

dirty-equals - 0.11.0
Ebuild name:

dev-python/dirty-equals-0.11.0

Description

Doing dirty (but extremely useful) things with equals

Added to portage

2025-11-17

dotnet-outdated - 4.6.4-r2
Ebuild name:

dev-dotnet/dotnet-outdated-4.6.4-r2

Description

Display and update outdated NuGet packages in a project

Added to portage

2025-11-17

easycrypt - 2025.11
Ebuild name:

sci-mathematics/easycrypt-2025.11

Description

Computer-Aided Cryptographic Proofs

Added to portage

2025-11-17

eisl - 5.58
Ebuild name:

dev-lang/eisl-5.58

Description

Interpreter and compiler compatible with the ISLisp standard

Added to portage

2025-11-17

fastfetch - 2.55.1
Ebuild name:

app-misc/fastfetch-2.55.1

Description

Fast neofetch-like system information tool

Added to portage

2025-11-17

freeglut - 3.8.0
Ebuild name:

media-libs/freeglut-3.8.0

Description

A free OpenGL utility toolkit, the open-sourced alternative to the GLUT l

Added to portage

2025-11-17

gcc - 16.0.0_p20251116
Ebuild name:

sys-devel/gcc-16.0.0_p20251116

Description

The GNU Compiler Collection

Added to portage

2025-11-17

gettext_i18n_rails - 2.1.0
Ebuild name:

dev-ruby/gettext_i18n_rails-2.1.0

Description

FastGettext / Rails integration

Added to portage

2025-11-17

git - 2.51.2-r2
Ebuild name:

dev-vcs/git-2.51.2-r2

Description

Stupid content tracker distributed VCS designed for speed and efficiency

Added to portage

2025-11-17

git-filter-repo - 2.47.0-r1
Ebuild name:

dev-vcs/git-filter-repo-2.47.0-r1

Description

Quickly rewrite git repository history (filter-branch replacement

Added to portage

2025-11-17

git-sources - 6.18_rc6
Ebuild name:

sys-kernel/git-sources-6.18_rc6

Description

The very latest -git version of the Linux kernel

Added to portage

2025-11-17

gitea - 1.25.1
Ebuild name:

www-apps/gitea-1.25.1

Description

A painless self-hosted Git service

Added to portage

2025-11-17

haproxy - 3.2.8-r1
Ebuild name:

net-proxy/haproxy-3.2.8-r1

Description

A TCP/HTTP reverse proxy for high availability environments

Added to portage

2025-11-17

hypothesis - 6.148.1
Ebuild name:

dev-python/hypothesis-6.148.1

Description

A library for property based testing

Added to portage

2025-11-17

jellyfin-bin - 10.11.3
Ebuild name:

www-apps/jellyfin-bin-10.11.3

Description

Jellyfin puts you in control of managing and streaming your media

Added to portage

2025-11-17

keyring - 25.7.0
Ebuild name:

dev-python/keyring-25.7.0

Description

Provides access to the system keyring service

Added to portage

2025-11-17

libva-intel-driver - 2.4.5
Ebuild name:

media-libs/libva-intel-driver-2.4.5

Description

HW video decode support for Intel integrated graphics

Added to portage

2025-11-17

lumberjack - 2.0.3
Ebuild name:

dev-ruby/lumberjack-2.0.3

Description

A simple, powerful, and very fast logging utility

Added to portage

2025-11-17

mattermost-desktop-bin - 6.0.1_rc2
Ebuild name:

net-im/mattermost-desktop-bin-6.0.1_rc2

Description

Mattermost Desktop application

Added to portage

2025-11-17

nprolog - 4.76
Ebuild name:

dev-lang/nprolog-4.76

Description

Interpreter and compiler to be compatible with Arity/Prolog32

Added to portage

2025-11-17

numpy - 2.3.5
Ebuild name:

dev-python/numpy-2.3.5

Description

Fast array and numerical python library

Added to portage

2025-11-17

omemo-dr - 1.1.0
Ebuild name:

dev-python/omemo-dr-1.1.0

Description

OMEMO Crypto Library

Added to portage

2025-11-17

onedrive - 2.5.9
Ebuild name:

net-misc/onedrive-2.5.9

Description

Free Client for OneDrive on Linux

Added to portage

2025-11-17

poke - 3.0
Ebuild name:

app-emacs/poke-3.0

Description

Emacs meets GNU poke

Added to portage

2025-11-17

poke - 3.2
Ebuild name:

app-emacs/poke-3.2

Description

Emacs meets GNU poke

Added to portage

2025-11-17

poke-mode - 3.0
Ebuild name:

app-emacs/poke-mode-3.0

Description

Major mode for editing Poke programs

Added to portage

2025-11-17

polymode - 0.2.2_p20220322
Ebuild name:

app-emacs/polymode-0.2.2_p20220322

Description

Framework for Multiple Major Modes in Emacs

Added to portage

2025-11-17

popup - 0.5.9
Ebuild name:

app-emacs/popup-0.5.9

Description

Visual popup interface library for Emacs

Added to portage

2025-11-17

portage - 3.0.72
Ebuild name:

sys-apps/portage-3.0.72

Description

The package management and distribution system for Gentoo

Added to portage

2025-11-17

pypdf - 6.3.0
Ebuild name:

dev-python/pypdf-6.3.0

Description

Python library to work with PDF files

Added to portage

2025-11-17

pytest-localftpserver - 1.5.0
Ebuild name:

dev-python/pytest-localftpserver-1.5.0

Description

A PyTest plugin which provides an FTP fixture for your tests

Added to portage

2025-11-17

pythran - 0.18.1
Ebuild name:

dev-python/pythran-0.18.1

Description

Ahead of Time compiler for numeric kernels

Added to portage

2025-11-17

rpds-py - 0.29.0
Ebuild name:

dev-python/rpds-py-0.29.0

Description

Python bindings to Rust's persistent data structures (rpds)

Added to portage

2025-11-17

ruamel-yaml-clib - 0.2.15
Ebuild name:

dev-python/ruamel-yaml-clib-0.2.15

Description

C-based reader/scanner and emitter for dev-python/ruamel-yaml

Added to portage

2025-11-17

tempel - 1.8
Ebuild name:

app-emacs/tempel-1.8

Description

Templates with in-buffer field editing for GNU Emacs

Added to portage

2025-11-17

vertico - 2.6
Ebuild name:

app-emacs/vertico-2.6

Description

Vertical interactive completion

Added to portage

2025-11-17

wine-staging - 10.19
Ebuild name:

app-emulation/wine-staging-10.19

Description

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

Added to portage

2025-11-17

xelb - 0.22
Ebuild name:

app-emacs/xelb-0.22

Description

X protocol Emacs Lisp Binding

Added to portage

2025-11-17

xfce4-panel - 4.21.1
Ebuild name:

xfce-base/xfce4-panel-4.21.1

Description

Panel for the Xfce desktop environment

Added to portage

2025-11-17

zstd-ruby - 2.0.3
Ebuild name:

dev-ruby/zstd-ruby-2.0.3

Description

Ruby binding for zstd (Zstandard - Fast real-time compression algorithm).

Added to portage

2025-11-17

2025-11-16
86Box - 5.2-r1
Ebuild name:

app-emulation/86Box-5.2-r1

Description

Emulator of x86-based machines based on PCem

Added to portage

2025-11-16

ansible-pylibssh - 1.3.0
Ebuild name:

dev-python/ansible-pylibssh-1.3.0

Description

Python bindings for libssh client specific to Ansible use case

Added to portage

2025-11-16

aotriton-bin - 0.11b-r1
Ebuild name:

sci-libs/aotriton-bin-0.11b-r1

Description

Ahead of Time (AOT) Triton Math Library (binary package)

Added to portage

2025-11-16

curl - 8.17.0-r1
Ebuild name:

net-misc/curl-8.17.0-r1

Description

A Client that groks URLs

Added to portage

2025-11-16

elasticsearch - 8.19.2
Ebuild name:

dev-ruby/elasticsearch-8.19.2

Description

Ruby integrations for ES, elasticsearch module

Added to portage

2025-11-16

elasticsearch - 9.2.0
Ebuild name:

dev-ruby/elasticsearch-9.2.0

Description

Ruby integrations for ES, elasticsearch module

Added to portage

2025-11-16

elasticsearch-api - 8.19.2
Ebuild name:

dev-ruby/elasticsearch-api-8.19.2

Description

Ruby integrations for ES, elasticsearch-api module

Added to portage

2025-11-16

elasticsearch-api - 9.2.0
Ebuild name:

dev-ruby/elasticsearch-api-9.2.0

Description

Ruby integrations for ES, elasticsearch-api module

Added to portage

2025-11-16

erb - 6.0.0
Ebuild name:

dev-ruby/erb-6.0.0

Description

An easy to use but powerful templating system for Ruby

Added to portage

2025-11-16

fake-py - 0.11.10
Ebuild name:

dev-python/fake-py-0.11.10

Description

Minimalistic, standalone alternative fake data generator with no depende

Added to portage

2025-11-16

filezilla - 3.69.5
Ebuild name:

net-ftp/filezilla-3.69.5

Description

FTP client with lots of useful features and an intuitive interface

Added to portage

2025-11-16

fish - 4.2.1
Ebuild name:

app-shells/fish-4.2.1

Description

Friendly Interactive SHell

Added to portage

2025-11-16

fzf - 0.67.0
Ebuild name:

app-shells/fzf-0.67.0

Description

General-purpose command-line fuzzy finder, written in Golang

Added to portage

2025-11-16

gcc - 15.2.1_p20251115
Ebuild name:

sys-devel/gcc-15.2.1_p20251115

Description

The GNU Compiler Collection

Added to portage

2025-11-16

goland - 2025.2.4
Ebuild name:

dev-util/goland-2025.2.4

Description

Golang IDE by JetBrains

Added to portage

2025-11-16

hipBLASLt - 7.1.0-r2
Ebuild name:

sci-libs/hipBLASLt-7.1.0-r2

Description

General matrix-matrix operations library for AMD Instinct accelerators

Added to portage

2025-11-16

hypothesis - 6.148.0
Ebuild name:

dev-python/hypothesis-6.148.0

Description

A library for property based testing

Added to portage

2025-11-16

mocha - 2.8.2
Ebuild name:

dev-ruby/mocha-2.8.2

Description

Mocking and stubbing using a syntax like that of JMock and SchMock

Added to portage

2025-11-16

pg_background - 1.5
Ebuild name:

dev-db/pg_background-1.5

Description

Postgres Background Worker

Added to portage

2025-11-16

popwin - 1.0.0
Ebuild name:

app-emacs/popwin-1.0.0

Description

Popup window manager for Emacs

Added to portage

2025-11-16

pycharm-community - 2025.2.4
Ebuild name:

dev-util/pycharm-community-2025.2.4

Description

Intelligent Python IDE with unique code assistance and analysis

Added to portage

2025-11-16

pycharm-professional - 2025.2.4
Ebuild name:

dev-util/pycharm-professional-2025.2.4

Description

Intelligent Python IDE with unique code assistance and analy

Added to portage

2025-11-16

pytest-localftpserver - 1.4.0
Ebuild name:

dev-python/pytest-localftpserver-1.4.0

Description

A PyTest plugin which provides an FTP fixture for your tests

Added to portage

2025-11-16

rmg - 0.8.7
Ebuild name:

games-emulation/rmg-0.8.7

Description

Rosalie's Mupen GUI

Added to portage

2025-11-16

rocm_bandwidth_test - 7.1.0-r1
Ebuild name:

dev-util/rocm_bandwidth_test-7.1.0-r1

Description

Bandwidth test for ROCm

Added to portage

2025-11-16

signal-desktop-bin - 7.79.0
Ebuild name:

net-im/signal-desktop-bin-7.79.0

Description

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

Added to portage

2025-11-16

sshfs - 3.7.5
Ebuild name:

net-fs/sshfs-3.7.5

Description

Fuse-filesystem utilizing the sftp service

Added to portage

2025-11-16

starship - 1.24.1
Ebuild name:

app-shells/starship-1.24.1

Description

The minimal, blazing-fast, and infinitely customizable prompt for any sh

Added to portage

2025-11-16

syd - 3.45.0
Ebuild name:

sys-apps/syd-3.45.0

Description

seccomp and landlock based application sandbox with support for namespaces

Added to portage

2025-11-16

syd-tui - 0.2.2
Ebuild name:

sys-apps/syd-tui-0.2.2

Description

Syd's Terminal User Interface

Added to portage

2025-11-16

systemtap - 5.4
Ebuild name:

dev-debug/systemtap-5.4

Description

Linux trace/probe tool

Added to portage

2025-11-16

tavern - 3.0.1
Ebuild name:

dev-python/tavern-3.0.1

Description

A tool, library, and Pytest plugin for testing RESTful APIs

Added to portage

2025-11-16

types-psutil - 7.0.0.20251116
Ebuild name:

dev-python/types-psutil-7.0.0.20251116

Description

Typing stubs for psutil

Added to portage

2025-11-16

vivaldi - 7.7.3851.48
Ebuild name:

www-client/vivaldi-7.7.3851.48

Description

A browser for our friends

Added to portage

2025-11-16

vivaldi-snapshot - 7.7.3851.44
Ebuild name:

www-client/vivaldi-snapshot-7.7.3851.44

Description

A browser for our friends

Added to portage

2025-11-16

xmlstarlet - 1.6.1-r5
Ebuild name:

app-text/xmlstarlet-1.6.1-r5

Description

A set of tools to transform, query, validate, and edit XML documents

Added to portage

2025-11-16

zope-interface - 8.1.1
Ebuild name:

dev-python/zope-interface-8.1.1

Description

Interfaces for Python

Added to portage

2025-11-16

rdf newsfeed | rss newsfeed | Atom newsfeed
- Powered by LeopardCMS - Running on Gentoo -
Copyright 2004-2020 Sascha Nitsch Unternehmensberatung GmbH
Valid XHTML1.1 : Valid CSS : buttonmaker
- Level Triple-A Conformance to Web Content Accessibility Guidelines 1.0 -
- Copyright and legal notices -
Time to create this page: 65.2 ms