Strumenti Utente

Strumenti Sito


script

Differenze

Queste sono le differenze tra la revisione selezionata e la versione attuale della pagina.

Link a questa pagina di confronto

Entrambe le parti precedenti la revisioneRevisione precedente
Prossima revisione
Revisione precedente
script [2019/04/09 07:45] – [Ubuntu] aggiunto build-essential e spostata pausa dopo join diego.zuccato@unibo.itscript [2024/12/24 10:09] (versione attuale) – aggiornata OU mario.petroli@unibo.it
Linea 5: Linea 5:
 Per prelevare direttamente uno degli script senza aprire il browser, usare Per prelevare direttamente uno degli script senza aprire il browser, usare
   wget http://apps.difa.unibo.it/wiki/_export/code/script?codeblock=N -O inst.sh   wget http://apps.difa.unibo.it/wiki/_export/code/script?codeblock=N -O inst.sh
-con N da (rispettivamente Ubuntu, Debian-pbis, Debian-winbind).+con N da (rispettivamente Ubuntu, Debian-pbis, Debian-winbind). 
 + 
 +Per l'installazione dei lab, conviene creare uno script **prepare.sh** su chiavetta contenente 
 +  #!/bin/bash 
 +  export myADUser=nome.cognome 
 +  wget http://apps.difa.unibo.it/wiki/_export/code/script?codeblock=0 -O /home/tecnici/preinst.sh 
 +  sudo bash /home/tecnici/preinst.sh 
 +Ovviamente va cambiato nome.cognome col proprio UPN AD (può essere diverso dalla mail senza dominio, p.e. m.bertelli@unibo.it deve usare michele.bertelli2). 
 + 
 +Quando si entra come tecnici, si inserisce la chiavetta (che viene montata automaticamente) e si lancia 
 +  bash /media/*/*/prepare.sh 
 + 
 +Lo script che viene scaricato ed eseguito è: 
 +<code bash preinst.sh> 
 +#!/bin/bash 
 +##### 
 +# Preparazione per installazione laboratorio 
 +# File release: 20210729 
 +if [ -z "$1" ]; then 
 +    echo -n "Laboratorio (i=Irnerio, nav=Navile) ? " 
 +    read L 
 +else 
 +    L=$1 
 +fi 
 + 
 +if [ -z "$2" ]; then 
 +    echo -n "Numero macchina ? " 
 +    read N 
 +else 
 +    N=$2 
 +fi 
 + 
 +sudo sed -i~ "s/LAB-GEN/${L}-${N}/" /etc/host{s,name} 
 +sudo nmcli c m "Connessione via cavo 1" 802-3.wake-on-lan magic 
 +sudo dpkg-reconfigure openssh-server 
 +sudo apt update 
 +wget http://apps.difa.unibo.it/wiki/_export/code/script?codeblock=1 -O /home/tecnici/inst.sh 
 +sed -i~ "s/=diego.zuccato/=$myADUser/" /home/tecnici/inst.sh 
 +sudo shutdown -r now 
 +</code>
  
 ===== Ubuntu ===== ===== Ubuntu =====
Linea 13: Linea 52:
 ##### #####
 # Script di installazione per Ubuntu. # Script di installazione per Ubuntu.
-# Versione del 09/04/2019+# Versione 20210729
  
 ############################################################ ############################################################
Linea 24: Linea 63:
  
 # Base OU in AD # Base OU in AD
-AD_OU='dsa.auto/str00957-difa/computer'+AD_OU='dsa.auto/Dip-DIFA/computer'
  
 # Pacchetti base, da installare sempre # Pacchetti base, da installare sempre
-SYS_PKGS="vim-nox mc openssh-server unattended-upgrades curl"+SYS_PKGS="vim-nox mc openssh-server unattended-upgrades curl lldpd"
  
 # Pacchetti da installare solo se si effettua il join, *dopo* SYS_PKGS # Pacchetti da installare solo se si effettua il join, *dopo* SYS_PKGS
Linea 33: Linea 72:
  
 # Pacchetti comuni (PC e lab) # Pacchetti comuni (PC e lab)
-XTRA_PKGS="keychain chromium-browser screen gfortran kile k3b konqueror gnuplot kate xemacs21 nedit tcsh clamav clamtk gnudatalanguage plplot12-driver-xwin lldpd build-essential"+XTRA_PKGS="keychain chromium-browser screen gfortran kile k3b konqueror gnuplot kate xemacs21 nedit tcsh clamav clamtk gnudatalanguage plplot12-driver-xwin build-essential htop"
  
 # Pacchetti da installare solo nei laboratori didattici # Pacchetti da installare solo nei laboratori didattici
-LAB_PKGS="nfs-common r-base"+LAB_PKGS="epoptes-client r-base glusterfs-client texlive-lang-italian texlive-publishers"
  
 ############################################################ ############################################################
Linea 62: Linea 101:
 if [ -z "$PCID" ]; then if [ -z "$PCID" ]; then
     echo "Hostname errato! Deve iniziare con 'str957-'"     echo "Hostname errato! Deve iniziare con 'str957-'"
 +    exit
 +fi
 +
 +if [ "LAB-GEN" == "$PCID" ]; then
 +    echo "Fase di personalizzazione dell'installazione non corretta: controlla l'hostname!"
     exit     exit
 fi fi
Linea 83: Linea 127:
     echo "Non è un PC di laboratorio"     echo "Non è un PC di laboratorio"
     ISLAB=0     ISLAB=0
-    mkdir /home/PERSONALE +    readdef 'Vuoi joinare la macchina? (S/n)' 's' JOIN 
-    mkdir /home/STUDENTI+    if [ "n" != "$JOIN" ]; then 
 +        mkdir /home/PERSONALE 
 +        mkdir /home/STUDENTI 
 +    fi
 else else
     # È un lab     # È un lab
     ISLAB=1     ISLAB=1
 +    JOIN=s
     AD_OU="$AD_OU/laboratori"     AD_OU="$AD_OU/laboratori"
  
-    apt-get -qy install ${LAB_PKGS} +    apt install ${LAB_PKGS} 
 +    
     DEFSO=""     DEFSO=""
     case "$LAB" in     case "$LAB" in
-        "n"|"o") +        "nav") 
-            AD_OU="${AD_OU}/belmeloro/${LAB}+            AD_OU="${AD_OU}/navile
-            DEFSO="\"Windows 7 (loader) (su /dev/sda1)\"+            SRV_LAB="srv-lab-m
-            useradd -G root -m -U cirsfid +     useradd -G root -m -U cesia 
-            echo "Imposta password per utente cirsfid+     echo "Imposta password per utente cesia
-            passwd cirsfid +     passwd cesia 
- +     # Creazione delle home sul fileserver 
-            # Creazione delle home sul fileserver +     mkdir /home/PERSONALE 
-            mkdir /home/PERSONALE +     mkdir /home/STUDENTI 
-            mkdir /home/STUDENTI +            echo "137.204.136.90 ${SRV_LAB}" >> /etc/hosts 
-            echo "serverlab.bo.astro.it:/home/PERSONALE/ /home/PERSONALE nfs rsize=8192,wsize=8192,nosuid,soft,vers=3 0 0" >>/etc/fstab +            echo "${SRV_LAB}:homes /home glusterfs defaults,_netdev 0 0" >>/etc/fstab 
-            echo "serverlab.bo.astro.it:/home/STUDENTI/ /home/STUDENTI nfs rsize=8192,wsize=8192,nosuid,soft,vers=3 0 0" >>/etc/fstab +     SM_INST="y" 
-            SM_INST="y" +   
-            ;;+            # Preparazione all'installazione di IRAF (dipendenze e cache) 
 +            mount /home/PERSONALE 
 +            cp /home/PERSONALE/_LIB/IRAF/iraf64.tar.gz /home 
 +            /home/PERSONALE/_LIB/IRAF/deploy.sh 
 +     ;;
         "i")         "i")
             AD_OU="${AD_OU}/irnerio"             AD_OU="${AD_OU}/irnerio"
-            mkdir /home/PERSONALE +            SRV_LAB="srv-labirnerio" 
-            mkdir /home/STUDENTI+            useradd -G root -m -U cesia 
 +     mkdir /home/PERSONALE 
 +     mkdir /home/STUDENTI 
 +            # IP esterno del server 137.204.248.241 
 +            echo "10.10.10.241 ${SRV_LAB}" >> /etc/hosts 
 +            echo "${SRV_LAB}:home-personale /home/PERSONALE glusterfs defaults,_netdev 0 0" >>/etc/fstab 
 +            echo "${SRV_LAB}:home-studenti /home/STUDENTI glusterfs defaults,_netdev 0 0" >>/etc/fstab
             ;;             ;;
         "*")         "*")
Linea 131: Linea 189:
 fi fi
  
-readdef 'Vuoi joinare la macchina? (S/n)' 's' JOIN 
 if [ "n" != "$JOIN" ]; then if [ "n" != "$JOIN" ]; then
     readdef "Nome amministratore AD (${AD_USER})" "$AD_USER" AD_USER     readdef "Nome amministratore AD (${AD_USER})" "$AD_USER" AD_USER
Linea 205: Linea 262:
  $pbis_base/config RequireMembershipOf $reqm $reqm2 $reqm3  $pbis_base/config RequireMembershipOf $reqm $reqm2 $reqm3
     }     }
 +    echo "nameserver 137.204.25.77" >> /etc/resolv.conf
 +    /opt/pbis/bin/update-dns
 fi fi
  
 # Installazione dei pacchetti base # Installazione dei pacchetti base
 apt-get -qy install ${XTRA_PKGS} apt-get -qy install ${XTRA_PKGS}
 +
 +if [ -f /etc/default/epoptes-client ]; then
 +    echo "SERVER=${SRV_LAB}" >> /etc/default/epoptes-client
 +    epoptes-client -c
 +fi
  
 # Aggiornamento completo del sistema # Aggiornamento completo del sistema
 apt-get -qy dist-upgrade apt-get -qy dist-upgrade
-shutdown -now+shutdown -now
 </code> </code>
  
Linea 226: Linea 290:
 #!/bin/bash #!/bin/bash
 ##### #####
-# Script di installazione per server Debian. Versione del 01/08/2017 +# Script di installazione per server Debian. Versione del 09/07/2019 
-Convertito a PBIS-open invece di winbind+Modifiche per Debian 10 
 +# Permessa installazione senza join per macchine non str957-*
  
 ############################################################ ############################################################
Linea 238: Linea 303:
  
 # Base OU in AD # Base OU in AD
-AD_OU='dsa.auto/str00957-difa/computer/server'+AD_OU='dsa.auto/Dip-DIFA/computer/server'
  
 # Pacchetti base, da installare sempre # Pacchetti base, da installare sempre
-SYS_PKGS="vim-nox mc openssh-server curl apt-transport-https"+SYS_PKGS="vim-nox mc openssh-server curl gnupg"
  
 # Pacchetti da installare solo se si effettua il join, *dopo* SYS_PKGS # Pacchetti da installare solo se si effettua il join, *dopo* SYS_PKGS
Linea 247: Linea 312:
  
 # Pacchetti comuni # Pacchetti comuni
-XTRA_PKGS="keychain screen tcsh clamav"+XTRA_PKGS="keychain screen tcsh clamav htop"
  
 ############################################################ ############################################################
Linea 256: Linea 321:
 usrgrp="${NAME}-abilitati" usrgrp="${NAME}-abilitati"
 pbis_base=/opt/pbis/bin pbis_base=/opt/pbis/bin
 +AD_HOME='%H/%D/%U'
  
 # Read user input with a default # Read user input with a default
Linea 272: Linea 338:
  
 if [ -z "$PCID" ]; then if [ -z "$PCID" ]; then
-    echo "Hostname erratoDeve iniziare con 'str957-'" +        echo "Hostname non joinabileDovrebbe iniziare con 'str957-' ." 
-    exit+        echo "Premi INVIO per continuare comunque." 
 +        JOIN=n 
 +        read A 
 +    else 
 +        readdef 'Vuoi joinare la macchina? (S/n)' 's' JOIN
 fi fi
  
-LAB=`echo $PCID| sed 's/\([^-]*\)-[0-9]*/\1/; t; s/.*//'` 
-PCNO=`echo $PCID| sed "s/$LAB-\(.*\)/\1/"` 
-AD_HOME='%H/%D/%U' 
- 
-# All our servers are x86_64 . Moreover, often "uname -i" on Debian returns "unknown" 
-#ARCH="x86" 
-#CURARCH=$(uname -i) 
-#if [ "$CURARCH" == "x86_64" -o "$CURARCH" == "amd64"]; then 
-    ARCH="x86_64"; 
-#fi 
- 
-mkdir /home/PERSONALE 
-mkdir /home/STUDENTI 
- 
-readdef 'Vuoi joinare la macchina? (S/n)' 's' JOIN 
 if [ "n" != "$JOIN" ]; then if [ "n" != "$JOIN" ]; then
     readdef "Nome amministratore AD (${AD_USER})" "$AD_USER" AD_USER     readdef "Nome amministratore AD (${AD_USER})" "$AD_USER" AD_USER
 +    mkdir /home/PERSONALE
 +    mkdir /home/STUDENTI
 fi fi
  
 # Primo aggiornamento/installazione pacchetti di sistema base # Primo aggiornamento/installazione pacchetti di sistema base
-apt-get -qy install $SYS_PKGS+apt -qy install $SYS_PKGS
 if [ "n" != "$JOIN" ]; then if [ "n" != "$JOIN" ]; then
     wget -O - http://repo.pbis.beyondtrust.com/apt/RPM-GPG-KEY-pbis|apt-key add -     wget -O - http://repo.pbis.beyondtrust.com/apt/RPM-GPG-KEY-pbis|apt-key add -
     wget -O /etc/apt/sources.list.d/pbiso.list http://repo.pbis.beyondtrust.com/apt/pbiso.list     wget -O /etc/apt/sources.list.d/pbiso.list http://repo.pbis.beyondtrust.com/apt/pbiso.list
-    apt-get update +    apt update 
-    apt-get -qy install $AD_PKGS pbis-open+    apt -qy install $AD_PKGS pbis-open
 fi fi
  
Linea 307: Linea 364:
 sed -i~ "s/^\(root:x:0:\)\$/\1${LOCAL_USER}/" /etc/group sed -i~ "s/^\(root:x:0:\)\$/\1${LOCAL_USER}/" /etc/group
 sed -i~ "s,^\(#\|//\)\s*\(auth\s*\(required\s*pam_wheel.so\|sufficient\s*pam_wheel.so\s*trust\)\)\$,\2," /etc/pam.d/su sed -i~ "s,^\(#\|//\)\s*\(auth\s*\(required\s*pam_wheel.so\|sufficient\s*pam_wheel.so\s*trust\)\)\$,\2," /etc/pam.d/su
-#sed -i~ 's,//\(Unattended-Upgrade::\(MinimalSteps\|InstallOnShutdown\)\|.*-\(updates\|backports\).*\),\1,' /etc/apt/apt.conf.d/50unattended-upgrades 
  
 # Operazioni relative al dominio # Operazioni relative al dominio
Linea 319: Linea 375:
     sed -i 's/^\(.*\)sufficient\(.*\)$/\1[success=ok default=ignore]\2/' /usr/share/pam-configs/pbis     sed -i 's/^\(.*\)sufficient\(.*\)$/\1[success=ok default=ignore]\2/' /usr/share/pam-configs/pbis
     pam-auth-update     pam-auth-update
-    $pbis_base/config HomeDirTemplate %H/%D/%U+    $pbis_base/config HomeDirTemplate $AD_HOME
     $pbis_base/config AssumeDefaultDomain 1     $pbis_base/config AssumeDefaultDomain 1
     $pbis_base/config LoginShellTemplate /bin/bash     $pbis_base/config LoginShellTemplate /bin/bash
Linea 347: Linea 403:
  
 # Installazione dei pacchetti base # Installazione dei pacchetti base
-apt-get -qy install ${XTRA_PKGS}+apt -qy install ${XTRA_PKGS}
  
 # Aggiornamento completo del sistema # Aggiornamento completo del sistema
-apt-get -qy dist-upgrade+apt -qy dist-upgrade
 shutdown -r now shutdown -r now
 </code> </code>
Linea 373: Linea 429:
    
 # Base OU in AD # Base OU in AD
-AD_OU='Dsa.Auto/Str00957-DIFA/Computer/Server'+AD_OU='Dsa.Auto/Dip-DIFA/Computer/Server'
    
 # Pacchetti base, da installare sempre # Pacchetti base, da installare sempre
script.1554795940.txt.gz · Ultima modifica: 2019/04/09 07:45 da diego.zuccato@unibo.it

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki