|
| 1 | +# Licensed to the Apache Software Foundation (ASF) under one |
| 2 | +# or more contributor license agreements. See the NOTICE file |
| 3 | +# distributed with this work for additional information |
| 4 | +# regarding copyright ownership. The ASF licenses this file |
| 5 | +# to you under the Apache License, Version 2.0 (the |
| 6 | +# "License"); you may not use this file except in compliance |
| 7 | +# with the License. You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, |
| 12 | +# software distributed under the License is distributed on an |
| 13 | +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 | +# KIND, either express or implied. See the License for the |
| 15 | +# specific language governing permissions and limitations |
| 16 | +# under the License. |
| 17 | + |
| 18 | + |
| 19 | +ROOTPW=password |
| 20 | +CLOUDSTACK_RELEASE=4.2.0 |
| 21 | + |
| 22 | + |
| 23 | +install_packages() { |
| 24 | + DEBIAN_FRONTEND=noninteractive |
| 25 | + DEBIAN_PRIORITY=critical |
| 26 | + |
| 27 | + #basic stuff |
| 28 | + apt-get --no-install-recommends -q -y --force-yes install rsyslog logrotate cron chkconfig insserv net-tools ifupdown vim-tiny netbase iptables openssh-server grub-legacy e2fsprogs dhcp3-client dnsmasq tcpdump socat wget python bzip2 sed gawk diff grep gzip less tar telnet ftp rsync traceroute psmisc lsof procps monit inetutils-ping iputils-arping httping dnsutils zip unzip ethtool uuid file iproute acpid iptables-persistent virt-what sudo |
| 29 | + |
| 30 | + #sysstat |
| 31 | + echo 'sysstat sysstat/enable boolean true' | debconf-set-selections |
| 32 | + apt-get --no-install-recommends -q -y --force-yes install sysstat |
| 33 | + #apache |
| 34 | + apt-get --no-install-recommends -q -y --force-yes install apache2 ssl-cert |
| 35 | + #haproxy |
| 36 | + apt-get --no-install-recommends -q -y --force-yes install haproxy |
| 37 | + #dnsmasq |
| 38 | + apt-get --no-install-recommends -q -y --force-yes install dnsmasq |
| 39 | + #nfs client |
| 40 | + apt-get --no-install-recommends -q -y --force-yes install nfs-common |
| 41 | + #vpn stuff |
| 42 | + apt-get --no-install-recommends -q -y --force-yes install xl2tpd openswan bcrelay ppp ipsec-tools tdb-tools |
| 43 | + #vmware tools |
| 44 | + apt-get --no-install-recommends -q -y --force-yes install open-vm-tools |
| 45 | + #xenstore utils |
| 46 | + apt-get --no-install-recommends -q -y --force-yes install xenstore-utils libxenstore3.0 |
| 47 | + #keepalived and conntrackd |
| 48 | + apt-get --no-install-recommends -q -y --force-yes install keepalived conntrackd ipvsadm libnetfilter-conntrack3 libnl1 |
| 49 | + #ipcalc |
| 50 | + apt-get --no-install-recommends -q -y --force-yes install ipcalc |
| 51 | + #java |
| 52 | + apt-get --no-install-recommends -q -y --force-yes install default-jre-headless |
| 53 | + |
| 54 | +} |
| 55 | + |
| 56 | +accounts() { |
| 57 | + # Setup sudo to allow no-password sudo for "admin" |
| 58 | + groupadd -r admin |
| 59 | + #create a 'cloud' user |
| 60 | + usermod -a -G admin cloud |
| 61 | + echo "root:password" | chpasswd |
| 62 | + echo "cloud:password" | chpasswd |
| 63 | + sed -i -e '/Defaults\s\+env_reset/a Defaults\texempt_group=admin' /etc/sudoers |
| 64 | + sed -i -e 's/%admin ALL=(ALL) ALL/%admin ALL=NOPASSWD:ALL/g' /etc/sudoers |
| 65 | + |
| 66 | + mkdir -p /home/cloud/.ssh |
| 67 | + chmod 700 /home/cloud/.ssh |
| 68 | + |
| 69 | +} |
| 70 | + |
| 71 | +do_fixes() { |
| 72 | + #fix hostname in openssh-server generated keys |
| 73 | + sed -i "s/root@\(.*\)$/root@systemvm/g" etc/ssh/ssh_host_*.pub |
| 74 | +} |
| 75 | + |
| 76 | +signature() { |
| 77 | + touch /var/cache/cloud/cloud-scripts-signature |
| 78 | + echo "Cloudstack Release $CLOUDSTACK_RELEASE $(date)" > /etc/cloudstack-release |
| 79 | +} |
| 80 | + |
| 81 | +echo "*************INSTALLING PACKAGES********************" |
| 82 | +install_packages |
| 83 | +echo "*************DONE INSTALLING PACKAGES********************" |
| 84 | +accounts |
| 85 | +do_fixes |
| 86 | +signature |
0 commit comments