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:

39390

userrating:

average rating: 1.5 (4 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.7 (10 votes) (1=very good 6=terrible)
Your rating:
Very good (1) Good (2) ok (3) average (4) bad (5) terrible (6)

back
Please read "Why adblockers are bad".



other Ads
Trace My Cash
Wenn Sie sich schon immer mal gefragt haben, wo eigentlich Ihr geliebtes Bargeld geblieben ist, finden Sie hier vielleicht die Antwort.
www.tracemycash.com
Other free services
toURL.org
Shorten long
URLs to short
links like
http://tourl.org/2
tourl.org
.
Reverse DNS lookup
Find out which hostname(s)
resolve to a
given IP or other hostnames for the server
www.reversednslookup.org

New Packages

- as rdf newsfeed
- as rss newsfeed
- as Atom newsfeed
2017-10-23
Gearman - 2.4.9
Ebuild name:

dev-perl/Gearman-2.4.9

Description

Gearman distributed job system, client and worker libraries

Added to portage

2017-10-23

Gearman-Server - 1.120.0-r1
Ebuild name:

dev-perl/Gearman-Server-1.120.0-r1

Description

Gearman distributed job system - worker/client connector

Added to portage

2017-10-23

Gearman-Server - 1.130.1-r1
Ebuild name:

dev-perl/Gearman-Server-1.130.1-r1

Description

Gearman distributed job system - worker/client connector

Added to portage

2017-10-23

Getopt-Long-Descriptive - 0.100.0
Ebuild name:

dev-perl/Getopt-Long-Descriptive-0.100.0

Description

Getopt with usage text

Added to portage

2017-10-23

Google-Ads-AdWords-Client - 4.18.0
Ebuild name:

dev-perl/Google-Ads-AdWords-Client-4.18.0

Description

Google AdWords API Perl Client Library

Added to portage

2017-10-23

apr - 1.6.3
Ebuild name:

dev-libs/apr-1.6.3

Description

Apache Portable Runtime Library

Added to portage

2017-10-23

apr-util - 1.6.1
Ebuild name:

dev-libs/apr-util-1.6.1

Description

Apache Portable Runtime Utility Library

Added to portage

2017-10-23

arpwatch - 2.1.15-r10
Ebuild name:

net-analyzer/arpwatch-2.1.15-r10

Description

An ethernet monitor program that keeps track of ethernet/IP addres

Added to portage

2017-10-23

daemons - 1.2.5
Ebuild name:

dev-ruby/daemons-1.2.5

Description

Wrap existing ruby scripts to be run as a daemon

Added to portage

2017-10-23

git - 2.14.3
Ebuild name:

dev-vcs/git-2.14.3

Description

stupid content tracker distributed VCS designed for speed and efficiency

Added to portage

2017-10-23

glib-perl - 1.326.0
Ebuild name:

dev-perl/glib-perl-1.326.0

Description

Glib - Perl wrappers for the GLib utility and Object libraries

Added to portage

2017-10-23

harfbuzz - 1.6.1
Ebuild name:

media-libs/harfbuzz-1.6.1

Description

An OpenType text shaping engine

Added to portage

2017-10-23

libinput - 1.9.0
Ebuild name:

dev-libs/libinput-1.9.0

Description

Library to handle input devices in Wayland

Added to portage

2017-10-23

lighttpd - 1.4.47
Ebuild name:

www-servers/lighttpd-1.4.47

Description

Lightweight high-performance web server

Added to portage

2017-10-23

mcelog - 154
Ebuild name:

app-admin/mcelog-154

Description

A tool to log and decode Machine Check Exceptions

Added to portage

2017-10-23

monitoring-plugins - 2.2-r1
Ebuild name:

net-analyzer/monitoring-plugins-2.2-r1

Description

50+ standard plugins for Icinga, Naemon, Nagios, Shinken, Se

Added to portage

2017-10-23

nagios-plugins - 2.2.1-r1
Ebuild name:

net-analyzer/nagios-plugins-2.2.1-r1

Description

Official plugins for Nagios

Added to portage

2017-10-23

openssl - 1.0.2l-r1
Ebuild name:

dev-libs/openssl-1.0.2l-r1

Description

full-strength general purpose cryptography library (including SSL and TL

Added to portage

2017-10-23

openssl - 1.1.0f-r1
Ebuild name:

dev-libs/openssl-1.1.0f-r1

Description

full-strength general purpose cryptography library (including SSL and TL

Added to portage

2017-10-23

pillow - 4.3.0
Ebuild name:

dev-python/pillow-4.3.0

Description

Python Imaging Library (fork)

Added to portage

2017-10-23

purple-mattermost - 1.2
Ebuild name:

x11-plugins/purple-mattermost-1.2

Description

A libpurple/Pidgin plugin for Mattermost

Added to portage

2017-10-23

vanilla-sources - 4.13.9
Ebuild name:

sys-kernel/vanilla-sources-4.13.9

Description

Full sources for the Linux kernel

Added to portage

2017-10-23

vanilla-sources - 4.4.94
Ebuild name:

sys-kernel/vanilla-sources-4.4.94

Description

Full sources for the Linux kernel

Added to portage

2017-10-23

vanilla-sources - 4.9.58
Ebuild name:

sys-kernel/vanilla-sources-4.9.58

Description

Full sources for the Linux kernel

Added to portage

2017-10-23

webkit-gtk - 2.18.1
Ebuild name:

net-libs/webkit-gtk-2.18.1

Description

Open source web browser engine

Added to portage

2017-10-23

2017-10-22
albert - 0.14.3
Ebuild name:

x11-misc/albert-0.14.3

Description

Desktop agnostic launcher

Added to portage

2017-10-22

binding_of_caller - 0.7.3
Ebuild name:

dev-ruby/binding_of_caller-0.7.3

Description

Retrieve the binding of a method's caller

Added to portage

2017-10-22

buka - 3.0.1
Ebuild name:

net-misc/buka-3.0.1

Description

Download manga from buka.cn

Added to portage

2017-10-22

ck-sources - 4.13.9
Ebuild name:

sys-kernel/ck-sources-4.13.9

Description

Con Kolivas' high performance patchset and Gentoo's genpatches for Lin

Added to portage

2017-10-22

ck-sources - 4.9.58
Ebuild name:

sys-kernel/ck-sources-4.9.58

Description

Con Kolivas' high performance patchset and Gentoo's genpatches for Lin

Added to portage

2017-10-22

corebird - 1.6
Ebuild name:

net-im/corebird-1.6

Description

Native GTK+3 Twitter client

Added to portage

2017-10-22

cryptography - 2.1.1
Ebuild name:

dev-python/cryptography-2.1.1

Description

Library providing cryptographic recipes and primitives

Added to portage

2017-10-22

cryptography-vectors - 2.1.1
Ebuild name:

dev-python/cryptography-vectors-2.1.1

Description

Test vectors for the cryptography package

Added to portage

2017-10-22

dxf - 6.2.0
Ebuild name:

app-admin/dxf-6.2.0

Description

Docker registry v2 client in Python

Added to portage

2017-10-22

elinks - 0.12_pre6-r3
Ebuild name:

www-client/elinks-0.12_pre6-r3

Description

Advanced and well-established text-mode web browser

Added to portage

2017-10-22

forks - 0.360.0-r1
Ebuild name:

dev-perl/forks-0.360.0-r1

Description

Emulate threads with fork

Added to portage

2017-10-22

frontier-rpc - 0.07_beta4-r2
Ebuild name:

dev-perl/frontier-rpc-0.07_beta4-r2

Description

Perform remote procedure calls using extensible markup language

Added to portage

2017-10-22

gentoo-sources - 4.13.9
Ebuild name:

sys-kernel/gentoo-sources-4.13.9

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2017-10-22

gentoo-sources - 4.4.94
Ebuild name:

sys-kernel/gentoo-sources-4.4.94

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2017-10-22

gentoo-sources - 4.9.58
Ebuild name:

sys-kernel/gentoo-sources-4.9.58

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2017-10-22

gitea - 1.2.1
Ebuild name:

www-apps/gitea-1.2.1

Description

A painless self-hosted Git service, written in Go

Added to portage

2017-10-22

glusterfs - 3.12.2
Ebuild name:

sys-cluster/glusterfs-3.12.2

Description

GlusterFS is a powerful network/cluster filesystem

Added to portage

2017-10-22

gnome2-perl - 1.46.0
Ebuild name:

dev-perl/gnome2-perl-1.46.0

Description

Perl interface to the 2.x series of the Gnome libraries

Added to portage

2017-10-22

gnutls - 3.5.16
Ebuild name:

net-libs/gnutls-3.5.16

Description

A TLS 1.2 and SSL 3.0 implementation for the GNU project

Added to portage

2017-10-22

gnutls - 3.6.1
Ebuild name:

net-libs/gnutls-3.6.1

Description

A TLS 1.2 and SSL 3.0 implementation for the GNU project

Added to portage

2017-10-22

hexinject - 1.6
Ebuild name:

net-analyzer/hexinject-1.6

Description

Network packet sniffer and injector

Added to portage

2017-10-22

hgview - 1.9.0-r1
Ebuild name:

dev-vcs/hgview-1.9.0-r1

Description

A Mercurial interactive history viewer

Added to portage

2017-10-22

hplip - 3.17.10
Ebuild name:

net-print/hplip-3.17.10

Description

HP Linux Imaging and Printing - Print, scan, fax drivers and service tools

Added to portage

2017-10-22

hplip-plugin - 3.17.10
Ebuild name:

net-print/hplip-plugin-3.17.10

Description

Proprietary plugins and firmware for HPLIP

Added to portage

2017-10-22

irssi - 1.0.5
Ebuild name:

net-irc/irssi-1.0.5

Description

A modular textUI IRC client with IPv6 support

Added to portage

2017-10-22

java-sdk-docs - 1.8.0.152
Ebuild name:

dev-java/java-sdk-docs-1.8.0.152

Description

Oracle's documentation bundle (including API) for Java SE

Added to portage

2017-10-22

libepubgen - 0.0.1
Ebuild name:

app-text/libepubgen-0.0.1

Description

EPUB generator for librevenge

Added to portage

2017-10-22

libqxp - 0.0.0
Ebuild name:

app-text/libqxp-0.0.0

Description

Library parsing QuarkXpress documents

Added to portage

2017-10-22

makemkv - 1.10.7-r1
Ebuild name:

media-video/makemkv-1.10.7-r1

Description

Tool for ripping and streaming Blu-ray, HD-DVD and DVD discs

Added to portage

2017-10-22

mvcase - 0.1-r2
Ebuild name:

app-misc/mvcase-0.1-r2

Description

A modified version of mv, used to convert filenames to lower/upper case

Added to portage

2017-10-22

ncmpcpp - 0.8.1
Ebuild name:

media-sound/ncmpcpp-0.8.1

Description

featureful ncurses based MPD client inspired by ncmpc

Added to portage

2017-10-22

openscad - 2015.03_p2-r3
Ebuild name:

media-gfx/openscad-2015.03_p2-r3

Description

The Programmers Solid 3D CAD Modeller

Added to portage

2017-10-22

oracle-jdk-bin - 1.8.0.152
Ebuild name:

dev-java/oracle-jdk-bin-1.8.0.152

Description

Oracle's Java SE Development Kit

Added to portage

2017-10-22

oracle-jre-bin - 1.8.0.152
Ebuild name:

dev-java/oracle-jre-bin-1.8.0.152

Description

Oracle's Java SE Runtime Environment

Added to portage

2017-10-22

pelican-minify - 0.9
Ebuild name:

dev-python/pelican-minify-0.9

Description

An HTML minification plugin for Pelican, the static site generator.

Added to portage

2017-10-22

pillow - 4.2.1-r2
Ebuild name:

dev-python/pillow-4.2.1-r2

Description

Python Imaging Library (fork)

Added to portage

2017-10-22

pmacct - 1.7.0
Ebuild name:

net-analyzer/pmacct-1.7.0

Description

A network tool to gather IP traffic information

Added to portage

2017-10-22

sddm - 0.16.0-r2
Ebuild name:

x11-misc/sddm-0.16.0-r2

Description

Simple Desktop Display Manager

Added to portage

2017-10-22

spark - 2017
Ebuild name:

dev-lang/spark-2017

Description

Software development for high-reliability applications.

Added to portage

2017-10-22

sqliteman - 1.2.2-r4
Ebuild name:

dev-db/sqliteman-1.2.2-r4

Description

Powerful GUI manager for the Sqlite3 database

Added to portage

2017-10-22

youtube-dl - 2017.10.20
Ebuild name:

net-misc/youtube-dl-2017.10.20

Description

Download videos from YouTube.com (and more sites...)

Added to portage

2017-10-22

yubikey-manager - 0.4.6
Ebuild name:

app-crypt/yubikey-manager-0.4.6

Description

Python library and command line tool for configuring a YubiKey

Added to portage

2017-10-22

zim - 0.67
Ebuild name:

x11-misc/zim-0.67

Description

A desktop wiki

Added to portage

2017-10-22

rdf newsfeed | rss newsfeed | Atom newsfeed
- Powered by LeopardCMS - Running on Gentoo -
Copyright 2004-2017 Sascha Nitsch Unternehmensberatung UG(haftungsbeschänkt)
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: 4.8 ms
system status display