Doc per creare un mirror di Mandriva 2010.0

 

Aggiornato da Arena dom ott 19 00:52:22 CEST 2008 (inserito exclude nello script rsync)

Aggiornato da Arena mar ago  4 08:53:04 CEST 2009 (Inserito mirror per 2009.1 spring)

Aggiornato da Arena ven ott 30 15:05:50 CET 2009  (Inserito pubblicazione doc e iso)

Aggiornato da Arena mer mar 3 15:05:50 CET 2010  (rieditato per 2010)

Aggiornato da Arena sab mar 20 20:35:20 CET 2010  (rieditato per ArenaHome)

Aggiornato da Arena dom giu 27 17:19:47 CEST 2010 (rieditato per ArenaHome)

 

 

Tutta la parte di predisposizione della macchina per il mirror è stata rifatta per la mandriva 2010.0,

 

sarà  necessario modificare la configurazione delle stazioni desktop che continueranno ad usare la 2008.1, aggiungendo all'URL = http://10.42.195.213/2008/

sarà  necessario modificare la configurazione delle stazioni desktop che usano la 2009.0, aggiungendo all'URL = http://10.42.195.213/2009/

sarà  necessario modificare la configurazione delle stazioni desktop che usano la 2009.1, aggiungendo all'URL = http://10.42.195.213/2009.1/

sarà  necessario modificare la configurazione delle stazioni desktop che usano la 2010.0, aggiungendo all'URL = http://10.42.195.213/2010

 

 

-Configurare le stazioni desktop:

      in centro di controllo -->Configura i supporti da cui installare e aggiornare -->Opzioni -->Nuovo Supporto

      tipo di supporto = server http

      Nome supporto = Web-LED Mandriva

      URL = http://10.42.195.213/2010/  (ip della macchina mirror)

      spunta: crea un supporto

      spunta: marca

 

La nuova configurazione per ottenere il mirror di più realease:

Nella macchina mirror-mandriva ip=10.42.195.213

-Disattivare il firewall (drakconf->firewall->spunta nessun firewall

-Installare Apache, php, mysql ed utility:

 urpmi apache php apache-mod_ssl mc htop webmin vim mysql apache-mod_php php-cli sudo

 

-creare il path delle distribuzioni:

mkdir -p /pub/MandrivaLinux/official/2008.1/i586/

mkdir -p /pub/MandrivaLinux/official/2009.0/i586/

mkdir -p /pub/MandrivaLinux/official/2009.1/i586/

mkdir -p /pub/MandrivaLinux/official/2010.0/i586/

mkdir -p /pub/MandrivaRosaLinux/official/2012.0/i586/

mkdir -p /iso/
 

-creare un link simbolico alla dir aggiornata delle distribuzione:

portarsi in: cd /var/www/html/M2010

ln -s /pub/MandrivaLinux/official/2008.1/i586/ 2008

ln -s /pub/MandrivaLinux/official/2009.0/i586/ 2009

ln -s /pub/MandrivaLinux/official/2009.1/i586/ 2009.1

ln -s /pub/MandrivaLinux/official/2009.1/i586/ 2009.1

ln -s /pub/MandrivaRosaLinux/official/2012.0/i586/ 2012

ln -s /iso/ iso
 

-dare i diritti all' owner apache: chown -R apache:apache  /pub/MandrivaLinux

-nella configurazione del client, a seconda della distribuzione inserire:

http e url = http://10.42.195.213/2008/

http e url = http://10.42.195.213/2009/

http e url = http://10.42.195.213/2009.1/

http e url = http://10.42.195.213/2010/

http e url = http://10.42.195.213/2012/

 

Aggiunto la pubblicazione dei doc e delle iso via web:

-creato il file: /etc/httpd/conf/webapps.d/alias_mirror.conf *

-creato il menu di scelta dei doc e delle iso: /var/www/html/index.php **

Esempio Alias_mirror.conf da inserire in: /etc/httpd/conf/webapps.d

Alias /2010 "/pub/MandrivaLinux/official/2010.0/i586/"

<Directory /pub/MandrivaLinux/official/2010.0/i586>

Order deny,allow

Deny from all

Allow from all

</Directory>

<Directory /pub/MandrivaLinux/official/2010.0/i586/>

Options Indexes FollowSymLinks

AllowOverride None

</Directory>

Alias /iso "/iso/"

<Directory /iso>

Order deny,allow

Deny from all

Allow from all

</Directory>

<Directory /iso/>

Options Indexes FollowSymLinks

AllowOverride None

</Directory>


Esempio di menu index.php da inserire nella dir del mirror


<html>

<body>

<!-- $Id: index.html 92365 2007-09-23 14:04:27Z oden $ -->

<!-- $HeadURL: svn+ssh://svn.mandriva.com/svn/packages/cooker/apache-conf/current/SOURCES/index.html $ -->

<h1>Mirror Mandriva multidistribuzioni!</h1>

</body>

<CENTER>

<a TARGET="_top" href="/"><IMG SRC="LMDK.jpg" BORDER=0 width="280" height="130"></a>

</CENTER>

<CENTER>

<b>Mini Howto crea mirror &nbsp;</b><a TARGET="_top" href="./Doc_per_creare_un_mirror_di_Mandriva_2010.html">Doc_per_creare_un_mirror_di_Mandriva_2010.html</a>

</CENTER>

<CENTER>

<b>ISO Mandriva &nbsp;</b><a TARGET="_top" href="/iso/">ISO Mandriva</a>

</CENTER>

<CENTER>

<b>Mandriva 2010.0 &nbsp;</b><a TARGET="_top" href="/2010/">Doc mandriva 2010.0</a>

</CENTER>

<CENTER>

<FONT SIZE=-1>

<b>

<? echo " Mandriva Rel. 2010.0 " ; ?>

</b>

</font>

</CENTER>

</html>


 

Comando per scaricare e mantenere allineati tutti gli update su un server locale.

 

-il comando, tutto di seguito, può essere eseguito a cron una volta al giorno, possibilmente nelle ore notturne, di seguito lo script lanciato in background:

      nohup /usr/sbin/xrsync9.sh &

 

esempio comando, tutto di seguito:

rsync -auvH --verbose --partial --delete --exclude=media/debug_contrib --exclude=media/debug_main --exclude=media/debug_non-free --exclude=main/backports --exclude=main/testing --exclude=non-free/backports --exclude=non-free/testing --exclude=contrib/backports --exclude=contrib/testing rsync://distrib-coffee.ipsl.jussieu.fr/pub/linux/MandrivaLinux/official/2009.0/i586/ /pub/MandrivaLinux/official/2009.0/i586/ > /var/log/xrsync 2>&1

 

-di seguito lo script esempio xrsync.sh

 

#!/bin/bash

# xrsync.sh

# Io sono un commento

# dopo aver salvato il batch eseguire chgmod +x <scriptfile> per renderlo eseguibile

# non cambiate la prima linea, deve restare così com'e'

echo "Ti ricordo che il path e' " $PATH

echo "Oggi e' `date`"  # usa l'output del comando 'date'

echo "Buongiorno " $LOGNAME

echo "Questa macchina e': `uname -a`" # usa l'output del comando

echo "Il mio nome e' $0" # variabile interna

echo "Inizio rsync: `date`"

cd /pub/MandrivaLinux/official/2009.0/i586/

rsync -auvH --verbose --partial --delete --exclude=media/debug_contrib --exclude=media/debug_main --exclude=media/debug_non-free --exclude=main/backports --exclude=main/testing --exclude=non-free/backports --exclude=non-free/testing --exclude=contrib/backports --exclude=contrib/testing rsync://distrib-coffee.ipsl.jussieu.fr/pub/linux/MandrivaLinux/official/2009.0/i586/ /pub/MandrivaLinux/official/2009.0/i586/ > /var/log/xrsync 2>&1

echo "Fine rsync: `date`"

 

 

-Esempio di automazione con cron, l'rsync viene eseguito tutte le notti alle ore 4

 

eseguire : crontab -e

inserire : 00 04 * * * /usr/sbin/xrsync10.0.sh

 

 

 

 

 

 

Configurazione di cron attuale:

58 14 * * * /etc/webmin/cron/tempdelete.pl #Delete Webmin temporary files

#00 02 * * * /usr/sbin/xrsync.sh # mirror di mandriva 2008.1 alle 2 di notte

00 03 * * * /usr/sbin/xrsync9.1.sh # mirror di mandriva 2009.1 alle 3 di notte

00 05 * * * /usr/sbin/xrsync9.sh # mirror di mandriva 2009.0 alle 4 di notte

00 04 * * * /usr/sbin/xrsync10.0.sh # mirror di mandriva 2010.0 alle 5 di notte

 

Gli scrip attualmente in essere sono i seguenti:

-rwx------ 1 root root 2130 2010-02-26 16:54 /usr/sbin/xrsync10.0.sh*

-rwx------ 1 root root 2128 2010-02-26 16:29 /usr/sbin/xrsync9.1.sh*

-rwx------ 1 root root 2558 2010-02-26 16:29 /usr/sbin/xrsync9.sh*

-rwx------ 1 root root 1098 2010-02-26 16:28 /usr/sbin/xrsync.sh*

 

 

 

/**************************************** old non più necessario

 

-Modifiche alla configurazione di proftp.

 

-Creare la dir da pubblicare e settare i permessi a 711 e l'owner all'utente utilizzato

 

mkdir -p /pub/MandrivaLinux/official/2009.0/i586/

 

chmod -R 711 /pub/

chown -R FTP-nopw:FTP-nopw /pub/

 

-I log si trovano di default in: /var/log/proftpd/proftpd.log

-Il comando per restartare Proftp: /etc/init.d/proftpd restart

 

-Creare il file welcome.msg da posizionare nella root pubblicata.

 

Di seguito un esempio:

ArenaHome

Welcome, archive user %U@%R !

The local time is: %T

This is an experimental FTP server.  If have any unusual problems,

please report them via e-mail to <root@%L> or info@arenahome.org.

 

-Configurare Proftp con utente anonymous

 

-file di configurazione: /etc/proftp.conf

 

Di seguito un esempio:

 

# This is the directory where DSO modules resides

 

ModulePath /usr/lib/proftpd

 

# Allow only user root to load and unload modules, but allow everyone

# to see which modules have been loaded

 

ModuleControlsACLs insmod,rmmod allow user root

ModuleControlsACLs lsmod allow user *

 

ServerName                      "ProFTPD ArenaHome Ftp"

ServerType                      standalone

DeferWelcome off

 

MultilineRFC2228                on

DefaultServer on

ShowSymlinks                    on

 

TimeoutNoTransfer               600

TimeoutStalled                  600

TimeoutIdle                     1200

 

DisplayLogin welcome.msg

DisplayChdir                    .message

ListOptions                     "-l"

DenyFilter \*.*/

UseIPv6                         Off

 

# Allow FTP resuming.

# Remember to set to off if you have an incoming ftp for upload.

AllowStoreRestart on

 

# Port 21 is the standard FTP port.

Port 21

 

# In some cases you have to specify passive ports range to by-pass

# firewall limitations. Ephemeral ports can be used for that, but

# feel free to use a more narrow range.

#PassivePorts                    49152 65534

 

# To prevent DoS attacks, set the maximum number of child processes

# to 30.  If you need to allow more than 30 concurrent connections

# at once, simply increase this value.  Note that this ONLY works

# in standalone mode, in inetd mode you should use an inetd server

# that allows you to limit maximum number of processes per service

# (such as xinetd)

MaxInstances                    30

 

# Set the user and group under which the server will run.

User                            nobody

Group                           nogroup

 

# Umask 022 is a good standard umask to prevent new files and dirs

# (second parm) from being group and world writable.

Umask                           022  022

 

# To cause every FTP user to be "jailed" (chrooted) into their home

# directory, uncomment this line.

DefaultRoot ~

#DefaultRoot /pub/MandrivaLinux/official/2008.1/i586

# Normally, we want files to be overwriteable.

AllowOverwrite off

 

# Uncomment this if you are using NIS or LDAP to retrieve passwords:

PersistentPasswd                off

 

# Be warned: use of this directive impacts CPU average load!

#

# Uncomment this if you like to see progress and transfer rate with ftpwho

# in downloads. That is not needed for uploads rates.

#UseSendFile                    off

 

TransferLog /var/log/proftpd/proftpd.log

SystemLog   /var/log/proftpd/proftpd.log

 

<IfModule mod_tls.c>

    TLSEngine off

</IfModule>

 

<IfModule mod_quota.c>

    QuotaEngine on

</IfModule>

 

<IfModule mod_ratio.c>

    Ratios on

</IfModule>

 

# Delay engine reduces impact of the so-called Timing Attack described in

# http://security.lss.hr/index.php?page=details&ID=LSS-2004-10-02

# It is on by default.

<IfModule mod_delay.c>

    DelayEngine on

</IfModule>

 

<IfModule mod_ctrls.c>

    ControlsEngine        on

    ControlsMaxClients    2

    ControlsLog           /var/log/proftpd/controls.log

    ControlsInterval      5

    ControlsSocket        /var/run/proftpd/proftpd.sock

</IfModule>

 

<IfModule mod_cap.c>

CapabilitiesEngine off

</IfModule>

 

<IfModule mod_ctrls_admin.c>

    AdminControlsEngine on

</IfModule>

 

# Bar use of SITE CHMOD by default

<Limit SITE_CHMOD>

    DenyAll

</Limit>

 

<Directory /ftp>

</Directory>

# Una configurazione anonima di base, nessun upload di directory.

# Modifica del path di anonymous

<Anonymous /pub/MandrivaLinux/official>

#<Anonymous /FTP-nopw>

  User                          FTP-nopw

  Group                         FTP-nopw

# I client devono poter effettuare il login con "anonymous"

# o con "FTP-nopw"

  UserAlias                     anonymous FTP-nopw

# Limita il numero massimo di login anonimi

  MaxClients                    10 "Sorry, max %m users -- try again later"

  RequireValidShell             no

  AnonRequirePassword           off

  AccessGrantMsg                "Welcome to FTP Server ArenaHome!"

# 'welcome.msg' deve essere mostrato al login, e '.message'

# mostrato in ciascuna nuova directory in cui si cambia.

  DisplayLogin welcome.msg

  DisplayFirstChdir             .message

# Limita WRITE ovunque nel chroot anonimo

  <Limit WRITE>

    Deny from all

  </Limit>

        <Limit LOGIN>

                AllowAll

        </Limit>

 </Anonymous>

 

*/