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 [2017/03/24 08:26] – BeyondTrust ha cambiato la chiave di autenticazione dei pacchetti (prima era la stessa usata per yum) 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).
  
-===== Ubuntu =====+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).
  
-:?TODO testare l'uso del repo ufficiale di PBIS prima del do-release-upgrade da 14.04 a 16.04: +Quando si entra come tecnici, si inserisce la chiavetta (che viene montata automaticamente) e si lancia 
-  wget -http://repo.pbis.beyondtrust.com/apt/RPM-GPG-KEY-pbis|sudo apt-key add +  bash /media/*/*/prepare.sh 
-  sudo wget -O /etc/apt/sources.list.d/pbiso.list http://repo.pbis.beyondtrust.com/apt/pbiso.list + 
-  sudo apt-get update +Lo script che viene scaricato ed eseguito è: 
-  sudo apt-get install pbis-open+<code bash preinst.sh> 
 +#!/bin/bash 
 +##### 
 +# Preparazione per installazione laboratorio 
 +# File release20210729 
 +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 =====
  
 <code bash inst.sh> <code bash inst.sh>
Linea 19: Linea 52:
 ##### #####
 # Script di installazione per Ubuntu. # Script di installazione per Ubuntu.
-# Versione del 6/12/2016 - Uso del repo PBIS e aggiornamento a 16.04 +# Versione 20210729
-# Per Ubuntu LTS 16.04LTS+
  
 ############################################################ ############################################################
Linea 31: 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 grub2 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 40: 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"+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 69: 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 80: Linea 117:
     ARCH="x86_64";     ARCH="x86_64";
 fi fi
-#@ AD_SCRIPT=pbis-open-8.3.0.3287.linux.${ARCH}.deb.sh 
-#@ AD_SCRIPTURL=http://apps.difa.unibo.it/wiki/_media/script:$AD_SCRIPT 
  
 SM_FILE=sm2_4_25tot.tar.gz SM_FILE=sm2_4_25tot.tar.gz
Linea 92: 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) 
-        "r1") +            mount /home/PERSONALE 
-            AD_OU="${AD_OU}/r1" +            cp /home/PERSONALE/_LIB/IRAF/iraf64.tar.gz /home 
-            AD_HOME='%H/local/%D/%U+            /home/PERSONALE/_LIB/IRAF/deploy.sh 
-            # Creazione delle home sul fileserver +     ;;
-            mkdir /home/local +
-            echo "137.204.65.251:/nas/NASDisk-00021/home_r1 /home/local nfs rsize=8192,wsize=8192,vers=3,nosuid,soft 0 0" >>/etc/fstab +
-            mkdir /home/remote/ +
-            mkdir /home/remote/PERSONALE +
-            mkdir /home/remote/STUDENTI +
-            echo "serverlab.bo.astro.it:/home/PERSONALE/ /home/remote/PERSONALE nfs rsize=8192,wsize=8192,nosuid,soft,vers=3 0 0" >>/etc/fstab +
-            echo "serverlab.bo.astro.it:/home/STUDENTI/ /home/remote/STUDENTI nfs rsize=8192,wsize=8192,nosuid,soft,vers=3 0 0" >>/etc/fstab +
-            SM_INST="y" +
-            ;;+
         "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 153: 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 168: Linea 203:
 apt-get -qy install $SYS_PKGS apt-get -qy install $SYS_PKGS
 if [ "n" != "$JOIN" ]; then if [ "n" != "$JOIN" ]; then
-#@    curl $AD_SCRIPTURL > ~/$AD_SCRIPT 
     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
Linea 177: Linea 211:
 # Fix schermata di login # Fix schermata di login
 if [ ! -s /etc/lightdm/lightdm.conf ]; then if [ ! -s /etc/lightdm/lightdm.conf ]; then
-    # il file non pare esistere in 14.04LTS...+    # il file non pare esistere in 18.04LTS...
     echo "[SeatDefaults]" > /etc/lightdm/lightdm.conf     echo "[SeatDefaults]" > /etc/lightdm/lightdm.conf
     echo "user-session=ubuntu" >> /etc/lightdm/lightdm.conf     echo "user-session=ubuntu" >> /etc/lightdm/lightdm.conf
Linea 198: Linea 232:
     $pbis_base/domainjoin-cli join --ou "$AD_OU" personale.dir.unibo.it "$AD_USER"     $pbis_base/domainjoin-cli join --ou "$AD_OU" personale.dir.unibo.it "$AD_USER"
     echo "Se il join è riuscito, premi INVIO, altrimenti ^C"     echo "Se il join è riuscito, premi INVIO, altrimenti ^C"
 +    read A
     # Corregge errore con PAM (il file pbis viene creato col join, non prima...)     # Corregge errore con PAM (il file pbis viene creato col join, non prima...)
     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
-    read A 
     $pbis_base/config HomeDirTemplate %H/%D/%U     $pbis_base/config HomeDirTemplate %H/%D/%U
     $pbis_base/config AssumeDefaultDomain 1     $pbis_base/config AssumeDefaultDomain 1
Linea 228: 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
  
Linea 233: Linea 269:
 apt-get -qy install ${XTRA_PKGS} apt-get -qy install ${XTRA_PKGS}
  
-# Installa ORACLE Java (richiede conferma sia per l'aggiunta del repository che per la licenza) +if [ -/etc/default/epoptes-client ]; then 
-add-apt-repository ppa:webupd8team/java +    echo "SERVER=${SRV_LAB}" >> /etc/default/epoptes-client 
-apt-get update +    epoptes-client -
-apt-get -qy install oracle-java7-installer+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 254: Linea 290:
 #!/bin/bash #!/bin/bash
 ##### #####
-# Script di installazione per server Debian. Versione del 03/08/2015 +# 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 266: 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"+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 275: Linea 312:
  
 # Pacchetti comuni # Pacchetti comuni
-XTRA_PKGS="keychain screen tcsh clamav"+XTRA_PKGS="keychain screen tcsh clamav htop"
  
 ############################################################ ############################################################
Linea 284: 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 300: 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 
-AD_SCRIPT=pbis-open-8.3.0.3287.linux.${ARCH}.deb.sh 
-AD_SCRIPTURL=http://apps.difa.unibo.it/wiki/_media/script:$AD_SCRIPT 
- 
-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
-    apt-get -qy install $AD_PKGS +    wget -O - http://repo.pbis.beyondtrust.com/apt/RPM-GPG-KEY-pbis|apt-key add 
-    curl $AD_SCRIPTURL > ~/$AD_SCRIPT+    wget -O /etc/apt/sources.list.d/pbiso.list http://repo.pbis.beyondtrust.com/apt/pbiso.list 
 +    apt update 
 +    apt -qy install $AD_PKGS pbis-open
 fi fi
  
Linea 335: 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 347: 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 375: 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 401: 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.1490344014.txt.gz · Ultima modifica: 2017/03/24 08:26 da diego.zuccato@unibo.it

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki