henrydenhengst

Ovirt, Foreman and KVM install on CentOS7 host

Sep 15th, 2016
696
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 5.14 KB | None | 0 0
  1. #!/bin/bash
  2. #
  3. # Installation: KVM - LXC - LetsEncrypt - Ovirt - The Foreman
  4. # Tested on HOST Xeon D-1520 64G with CentOS 7.2-1511
  5. # Inspiration: https://raymii.org/s/articles/virt-install_introduction_and_copy_paste_distro_install_commands.html
  6. # version 1.00
  7. # written by Henry den Hengst
  8. #
  9. #
  10. if [[ $EUID -ne 0 ]]; then
  11.    echo "This script must be run as root"
  12.    exit 1
  13. fi
  14. # MAKE SURE you have an active and static TCP/IP:
  15. #   cat /etc/sysconfig/network-scripts/ifcfg-eth0
  16. # MAKE SURE you have configured your hostfile and DNS well:
  17. #   cat /etc/hosts
  18. #   hostname -f
  19. # MUST return with a FQDN
  20. cd /etc
  21. cp hosts hosts-backup
  22. wget -c https://dl.dropboxusercontent.com/u/36257811/hosts
  23. cd /root
  24. wget -c https://dl.dropboxusercontent.com/u/36257811/ovirt-answer.txt
  25. yum update
  26. setenforce 0
  27. sed -i 's!SELINUX=enforcing!SELINUX=disabled!g' /etc/selinux/config
  28. yum -y install deltarpm
  29. yum -y install qemu-kvm libvirt virt-install bridge-utils qemu-img libvirt-python libvirt-client libguestfs-tools-c git epel-release ntp
  30. yum install -y oz libguestfs-tools
  31. systemctl start libvirtd
  32. systemctl enable libvirtd
  33. mkdir /iso
  34. mkdir /iso-download
  35. mkdir /vm
  36. mkdir /scripts
  37. virsh pool-define-as VMpool01 dir - - - - "/vm/"
  38. virsh pool-build VMpool01
  39. virsh pool-start VMpool01
  40. virsh pool-autostart VMpool01
  41. qemu-img create -f raw /vm/VM-Vol1.img 100G
  42. # download all (current) templates to the local cache
  43. virt-builder --cache-all-templates
  44. #
  45. # automated KVM installation scripts of CentOS 7, OpenSUSE 13, Ubuntu 16.04 LTS and Debian 8
  46. cd /scripts
  47. wget -c https://dl.dropboxusercontent.com/u/36257811/centos7.sh
  48. chmod 755 centos7.sh
  49. # ./centos7.sh
  50. wget -c https://dl.dropboxusercontent.com/u/36257811/deb8.sh
  51. chmod 755 deb8.sh
  52. # ./deb8.sh
  53. wget -c https://dl.dropboxusercontent.com/u/36257811/opensuse13.sh
  54. chmod 755 opensuse13.sh
  55. # ./opensuse13.sh
  56. wget -c https://dl.dropboxusercontent.com/u/36257811/ubuntu1604.sh
  57. chmod 755 ubuntu1604.sh
  58. # ./ubuntu1604.sh
  59. wget -c https://dl.dropboxusercontent.com/u/36257811/win2012r2.sh
  60. chmod 755 win2012r2.sh
  61. wget -c https://dl.dropboxusercontent.com/u/36257811/autounattend.xml
  62. # ./win2012r2.sh
  63. wget -c https://dl.dropboxusercontent.com/u/36257811/create_autostart_iso.sh
  64. chmod 755 create_autostart_iso.sh
  65. # ./create_autostart_iso.sh
  66. #
  67. # Download Popular Linux Distro ISOs. Put a # before line to skip
  68. cd /iso-download
  69. wget -c http://releases.ubuntu.com/16.04/ubuntu-16.04.1-server-amd64.iso
  70. wget -c http://ftp.tudelft.nl/centos.org/7/isos/x86_64/CentOS-7-x86_64-Everything-1511.iso
  71. wget -c http://frafiles.pfsense.org/mirror/downloads/pfSense-CE-2.3.2-RELEASE-amd64.iso.gz
  72. gunzip pfSense-CE-2.3.2-RELEASE-amd64.iso.gz
  73. wget -c ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/amd64/ISO-IMAGES/10.3/FreeBSD-10.3-RELEASE-amd64-dvd1.iso
  74. wget -c ftp://opensuse.mirrors.ovh.net/opensuse/distribution/13.2/iso/openSUSE-13.2-DVD-x86_64.iso
  75. wget -c http://slackware.mirrors.ovh.net/ftp.slackware.com/slackware64-14.2-iso/slackware64-14.2-install-dvd.iso
  76. wget -c http://archlinux.mirrors.ovh.net/archlinux/iso/2016.09.03/archlinux-2016.09.03-dual.iso
  77. wget -c http://download.fedoraproject.org/pub/fedora/linux/releases/24/Server/x86_64/iso/Fedora-Server-dvd-x86_64-24-1.2.iso
  78. wget -c https://dl.dropboxusercontent.com/u/36257811/en_windows_server_2012_r2_vl_with_update_x64_dvd_6052766.iso
  79. wget -c http://cdimage.debian.org/debian-cd/8.5.0/amd64/iso-dvd/debian-8.5.0-amd64-DVD-1.iso
  80. wget -c http://cdimage.debian.org/debian-cd/8.5.0/amd64/iso-dvd/debian-8.5.0-amd64-DVD-2.iso
  81. wget -c http://cdimage.debian.org/debian-cd/8.5.0/amd64/iso-dvd/debian-8.5.0-amd64-DVD-3.iso
  82. End of Downloading ISOs.
  83. #
  84. # Install the oVirt engine repository and then install the oVirt-engine package:
  85. hostnamectl set-hostname www.vendorlock.nl
  86. yum -y install http://plain.resources.ovirt.org/pub/yum-repo/ovirt-release40.rpm
  87. yum -y install ovirt-engine
  88. # engine-setup --generate-answer=/root/ovirt-answer.txt
  89. #
  90. # login with admin=admin password=password
  91. engine-setup --config=/root/ovirt-answer.txt
  92. #
  93. # UNDER CONSTRUCTION !!!
  94. # If you can help contact [email protected]
  95. #
  96. # Now let us clone the github repository of Let's encrypt
  97. #   cd /root/
  98. #   git clone https://github.com/letsencrypt/letsencrypt
  99. # cd to the letsencrypt directory
  100. #   cd letsencrypt
  101. # Run the auto installer
  102. #   ./letsencrypt-auto
  103. #
  104. # LetsEncrypt comes up with this error after installing:
  105. # " ovirt "sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target" "
  106. # https://bugzilla.redhat.com/show_bug.cgi?id=1336838
  107. # Letsencrypt is not in the default list of CAs in the Oracle Java JDK. Discussion here: https://community.letsencrypt.org/t/will-the-cross-root-cover-trust-by-the-default-list-in-the-jdk-jre/134
  108. # Therefor you will have to do without nice SSL certificate :(
  109. #
  110. # Install The Foreman
  111. #  rpm -ivh https://yum.puppetlabs.com/puppetlabs-release-pc1-el-7.noarch.rpm
  112. #  yum -y install epel-release https://yum.theforeman.org/releases/1.12/el7/x86_64/foreman-release.rpm
  113. #  yum -y install foreman-installer
  114. #  hostname -f
  115. #  foreman-installer
Advertisement
Add Comment
Please, Sign In to add comment