Configurazione di un sistema gentoo per un server proxy

Nell’anno 2007/2008 il tronweb ha deciso di portare avanti un progetto ideato l’annno precedente: Il TronProxy.
É un progetto che prevede l’installazione di un proxy con Squid e un successivo sviluppo di un’interfaccia grafica in PHP; per poter fare ciò è stata richiesta una macchina che verrà utilizzata e sarà accessibilie solo dall’interno della rete scolastica.
Il giorno 27 dicembre 2007 il nuovo server è stato trasferito a casa di friggi dove è stato configurato assieme a umbytux.
Il sistema scelto è la distribuzione Gentoo Linux.

Configurazione Hardware

Come si può vedere il processore è un Intel(R) Pentium(R) 4 da 1.5GHz, la ram è stata incrementata a 768MB.
Le schede di rete sono:

  • eth0 10/100 (presa sulla scheda madre)
  • eth1 10/100/1000 (presa in basso)

L’hard disk è IDE

livecd root # lspci

 00:00.0 Host bridge: Intel Corporation 82845 845 (Brookdale) Chipset Host Bridge (rev 03)
 00:01.0 PCI bridge: Intel Corporation 82845 845 (Brookdale) Chipset AGP Bridge (rev 03)
 00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev 12)
 00:1f.0 ISA bridge: Intel Corporation 82801BA ISA Bridge (LPC) (rev 12)
 00:1f.1 IDE interface: Intel Corporation 82801BA IDE U100 Controller (rev 12)
 00:1f.2 USB Controller: Intel Corporation 82801BA/BAM USB Controller #1 (rev 12)
 00:1f.3 SMBus: Intel Corporation 82801BA/BAM SMBus Controller (rev 12)
 00:1f.4 USB Controller: Intel Corporation 82801BA/BAM USB Controller #1 (rev 12)
 00:1f.5 Multimedia audio controller: Intel Corporation 82801BA/BAM AC'97 Audio Controller (rev 12)
 01:00.0 VGA compatible controller: nVidia Corporation NV11DDR [GeForce2 MX200] (rev b2)
 02:08.0 Ethernet controller: Intel Corporation 82801BA/BAM/CA/CAM Ethernet Controller (rev 03)
 02:0a.0 Ethernet controller: Intel Corporation 82540EM Gigabit Ethernet Controller (rev 02)

livecd root # cat /proc/cpuinfo

 processor       : 0
 vendor_id       : GenuineIntel
 cpu family      : 15
 model           : 0
 model name      : Intel(R) Pentium(R) 4 CPU 1500MHz
 stepping        : 10
 cpu MHz         : 1495.235
 cache size      : 256 KB
 fdiv_bug        : no
 hlt_bug         : no
 f00f_bug        : no
 coma_bug        : no
 fpu             : yes
 fpu_exception   : yes
 cpuid level     : 2
 wp              : yes
 flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm up pebs bts        sync_rdtsc
 bogomips        : 2993.70
 clflush size    : 64

Preparazione disco

Ablilitiamo il DMA: (facoltativo)

livecd root # hdparm -d 1 -A 1 -m 16 -u 1 -a 64 /dev/hda

Partizioniam l'hd:

livecd root # cfdisk

         Name               Flags             Part Type        FS Type                    [Label]                Size (MB)
    ------------------------------------------------------------------------------------------------------------------------------
         hda1               Boot               Primary         Linux                                                 50.07
         hda2                                  Primary         Linux                                               1499.78
         hda3                                  Primary         Linux                                              18940.73

Creiamo i filesystems

livecd root # mke2fs /dev/hda1 # creiamo nella prima partizione il filesystem ext2 (Verrà utilizzata per il file di boot)
livecd root # mke2fs -j /dev/hda3 # creiamo nella terza partizione il filesystem ext3 (Sarà la partizione di root)
livecd root # mkswap /dev/hda2 # creiamo nella terza partizione l’area di swap

Montare le partizioni

livecd root # swapon /dev/hda2
livecd root # mount /dev/hda3 /mnt/gentoo/
livecd root # cd /mnt/gentoo/
livecd gentoo # mkdir boot/
livecd gentoo # mount /dev/hda1 /mnt/gentoo/boot

Installazione sistema base

livecd gentoo # date # regolare bene la data!
livecd gentoo # wget http://ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/releases/x86/2007.0/stages/stage3-i686-2007.0.tar.bz2 # Scarico lo stage3
livecd gentoo # wget http://ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/releases/x86/2007.0/stages/stage3-i686-2007.0.tar.bz2.DIGESTS # Scarico lo md5 dello stage3
livecd gentoo # md5sum -c stage3-i686-2007.0.tar.bz2.DIGESTS # Controllo md5

   stage3-i686-2007.0.tar.bz2: OK

livecd gentoo # tar xvjpf stage3-i686-2007.0.tar.bz2 # Estrazione dello stage3

   (L'output è troppo lungo da postare XD)

livecd gentoo # wget http://ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/snapshots/portage-latest.tar.bz2 # Scarico lo snapshot del portage
livecd gentoo # wget http://ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/snapshots/portage-latest.tar.bz2.md5sum # Scarico lo md5 dello snapshot del portage
livecd gentoo # md5sum -c portage-latest.tar.bz2.md5sum # Controllo md5

   portage-latest.tar.bz2: OK

livecd gentoo # tar xvjf portage-latest.tar.bz2 -C usr/

   (L'output è troppo lungo da postare XD)

livecd gentoo # vim etc/make.conf

   # These settings were set by the catalyst build script that automatically
   # built this stage.
   # Please consult /etc/make.conf.example for a more detailed example.
   CFLAGS="-O2 -march=i686 -pipe"
   CXXFLAGS="${CFLAGS}"
   # This should not be changed unless you know exactly what you are doing.  You
   # should probably be using a different stage, instead.
   CHOST="i686-pc-linux-gnu"
   MAKEOPTS="-j2"
   ACCEPT_KEYWORDS="x86"
   LINGUAS="it"
   FEATURES="ccache"
   CCACHE_DIR="/tmp/ccache"
   CCACHE_SIZE="2G"
   USE="fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm up xml2 -ipv6 -X -gnome 
   -kde -qt -gtk -alsa -arts -opengl -cups apache2 vhost ssl php mysql mysqli vhosts unicode bzip2 spell jpeg png snmp bash-completion -ldap"
   PORTDIR_OVERLAY="/usr/local/portage"
   PORTAGE_ELOG_CLASSES="warn error log info"
   PORTAGE_ELOG_SYSTEM="save"
   #PORTAGE_ELOG_MAILURI="mail.tronweb@gmail.com"
   #PORTAGE_ELOG_MAILFROM="Proxy-portage"
   APACHE2_MPMS="prefork"
   

livecd gentoo # mirrorselect -i -o » /etc/make.conf
livecd gentoo # mirrorselect -i -o » /etc/make.conf

livecd / # mkdir /usr/local/portage
livecd / # chown -R root:portage /usr/local/portage/
livecd / # chmod g+rwx /usr/local/portage/

Entriamo nel nuovo ambiente

livecd gentoo # mount -t proc none /mnt/gentoo/proc/
livecd gentoo # mount -o bind dev /mnt/gentoo/dev/
livecd gentoo # chroot /mnt/gentoo/ /bin/bash
livecd gentoo # cp -L /etc/resolv.conf etc/
livecd / # env-update
Regenerating /etc/ld.so.cache...
livecd / # source /etc/profile
livecd / # export PS1=”(chroot) $PS1”

Configuriamo il nuovo sistema

(chroot) livecd / # emerge –sync
(chroot) livecd / # emerge -av portage
(chroot) livecd / # cp /usr/share/zoneinfo/Europe/Rome /etc/localtime
(chroot) livecd / # emerge -av gentoo-sources
(chroot) livecd / # cd /usr/src/linux
(chroot) livecd linux # make menuconfig
(chroot) livecd linux # make all && make modules_install

FIXME continuare!!!

Una volta completati i passaggi descritti sopra, abbiamo provveduto ad installare alcuni pacchetti estremamente importanti:

 emerge -av php mysql apache pear squid phpsysinfo rdate

Non spaventatevi! Ora ve li spieghiamo tutti quanti:

PHP → è il pacchetto comprendente le specifiche per interpretare il linguaggio php;
MySQL → è il database per la gestione dei dati web;
Apache → è il server web;
PEAR → è un framework e un sistema di distribuzione per codice scritto in PHP;
SQUID → è il proxy! Il pacchetto in assoluto più importante per questo server!
PhpSysInfo → è un modulo in php per vedere le statistiche di utilizzo del server;
RDate → è un pacchetto per la sincronizzazione dell’orario (???).

 
Tronweb on Facebook @tronweb on Twitter Recent changes RSS feed Creative Commons License Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki