Advertisement
Guest User

Untitled

a guest
Feb 21st, 2014
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.55 KB | None | 0 0
  1. FQDN=ub0.dev.local
  2. PASS=pass
  3. IPAHOST=ipa.dev.local
  4. IPA_IP=192.168.20.17
  5. DNS_SEARCH=dev.local
  6.  
  7. ###########################################################
  8. ## set apt to use fastest mirror.
  9. ## http://askubuntu.com/questions/39922/how-do-you-select-the-fastest-mirror-from-the-command-line #39
  10. #mv /etc/apt/sources.list{,.dist}
  11. echo -e "deb mirror://mirrors.ubuntu.com/mirrors.txt precise main restricted universe multiverse\ndeb mirror://mirrors.ubuntu.com/mirrors.txt precise-updates main restricted universe multiverse\ndeb mirror://mirrors.ubuntu.com/mirrors.txt precise-backports main restricted universe multiverse\ndeb mirror://mirrors.ubuntu.com/mirrors.txt precise-security main restricted universe multiverse" >> /etc/apt/sources.list
  12. apt-get -y install python-software-properties
  13. apt-add-repository http://ppa.launchpad.net/freeipa/ppa/ubuntu
  14. apt-add-repository http://ppa.launchpad.net/sssd/updates/ubuntu
  15. apt-get update && apt-get -y upgrade
  16. # krb5-config asks for a default realm so supress interactive apt prompts
  17. DEBIAN_FRONTEND=noninteractive apt-get install -y krb5-config sssd libnss3-tools openssh-server \
  18.     openssh-client freeipa-client nscd libpam-ldapd libpam-krb5 libpam-ccreds \
  19.     libpam-foreground libnss-ldap nss-updatedb libnss-db nscd ldap-utils ntp
  20.  
  21.  
  22. #get hostname from FQDN
  23. HOSTNAME=`echo $FQDN | cut -d'.' -f1 - `
  24.  
  25. echo "FQDN=$FQDN"
  26. echo "HOSTNAME=$HOSTNAME"
  27.  
  28. #set hostname
  29. echo $HOSTNAME > /etc/hostname
  30. hostname $HOSTNAME
  31.  
  32. #edit resolv.conf to point to IPA: X.X.X.X
  33. #echo "nameserver $IPA_IP" >> /etc/resolvconf/resolv.conf.d/head
  34. #resolvconf -u
  35. #IPAHOSTIP=`host -t A $IPAHOST | awk -F' ' '{print$4}'`
  36.  
  37. #make resolv.conf that isn't stupid
  38. rm -f /etc/resolv.conf && echo -e "nameserver $IPA_IP\nsearch $DNS_SEARCH" > /etc/resolv.conf
  39.  
  40.  
  41. # remove any lines that start 127.0.0.1
  42. sed -i 's:127.0.0.1.*$::g' /etc/hosts
  43. # Set /etc/hostname and add FQDN to /etc/hosts
  44. sed -i "1i127.0.0.1\t$FQDN $HOSTNAME" /etc/hosts
  45.  
  46. # remove default conf file or clint install script won't run
  47. rm /etc/ipa/default.conf
  48.  
  49. # install script dies if this folder doesnt exist.
  50. mkdir /var/run/ipa
  51.  
  52. # certutil error (SEC_ERROR_LEGACY_DATABASE) if this folder doesnt exist
  53. mkdir -p /etc/pki/nssdb
  54.  
  55. # configure ntpd
  56. #sed -i 's/0.ubuntu.pool.ntp.org/vanipa.appnovation.com/g' /etc/ntp.conf
  57.  
  58. # stop ntp so install script can sync time using ntpdate.
  59. /etc/init.d/ntp stop
  60. #ntpdate ipa.appno.net
  61.  
  62. #revert reported version of ipapython so keys will upload properly (backup first tho)
  63. #cp /usr/share/pyshared/ipapython/version.py /usr/share/pyshared/ipapython/version.py.bak
  64. #sed -i "s/API_VERSION=.*/API_VERSION=u'2.49'/g" /usr/share/pyshared/ipapython/version.py
  65.  
  66. echo "about to install client, any key to ocntinue..."
  67. read
  68.  
  69. #install the client! (note: have to pre-create in web interface and add OTP of secpass)
  70. # or use `ipa host-add --force --password=$PASS $FQDN` on an authorised machine.
  71. # [TODO] wtf is candlepin? see error during install:
  72. # skipping plugin module ipalib.plugins.entitle: No module named rhsm.connection
  73. # error required https://github.com/candlepin/python-rhsm
  74. # candlepin module. No ubuntu package exists & it doesn't look important
  75. ipa-client-install -d --enable-dns-updates --hostname=$FQDN --mkhomedir --password=$PASS
  76.  
  77. #revert thei revert to change to the ipapython version back again ([TODO] is this a good idea?)
  78. #rm -f /usr/share/pyshared/ipapython/version.py && mv /usr/share/pyshared/ipapython/version.py.bak /usr/share/pyshared/ipapython/version.py
  79.  
  80. # [TODO] add additonal stuff from https://bugs.launchpad.net/bugs/1280215
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement