Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #
- # Script must be run as root !!!
- #
- # Check root privileges
- if [[ $EUID -ne 0 ]]; then
- echo "This script must be run as root"
- exit 1
- fi
- #
- # change hostname
- hostname puppet
- #
- # change the name permanently
- sed -i 's/ubuntu/puppet/g' /etc/hosts
- sed -i 's/ubuntu/puppet/g' /etc/hostname
- #
- # To disable the reboot action taken by pressing the Ctrl+Alt+Delete key combination
- sed -i 's!#exec shutdown -r now "Control-Alt-Delete pressed"!exec shutdown -r now "Control-Alt-Delete pressed"!g' /etc/init/control-alt-delete.conf
- #
- # Install, configure and enable firewall for foreman
- apt-get -y install ufw
- ufw allow ssh
- ufw allow 53
- ufw allow 67/udp
- ufw allow 68/udp
- ufw allow 69/udp
- ufw allow 80/tcp
- ufw allow 443/tcp
- ufw allow 3000/tcp
- ufw allow 3306/tcp
- ufw allow 5910:5930/tcp
- ufw allow 5432/tcp
- ufw allow 8140/tcp
- ufw allow 8443/tcp
- ufw enable
- #
- # update server
- apt-get update && apt-get upgrade -y && apt-get dist-upgrade -y
- # Install Network Time Protocol, CA certificates & wget
- apt-get -y install ntp ca-certificates wget
- # Download Puppet
- wget https://apt.puppetlabs.com/puppetlabs-release-trusty.deb
- # Install Puppet
- dpkg -i puppetlabs-release-trusty.deb
- #
- # Add Puppet Repository
- bash -c 'echo "deb http://deb.theforeman.org/ trusty 1.9" > /etc/apt/sources.list.d/foreman.list'
- bash -c 'echo "deb http://deb.theforeman.org/ plugins 1.9" >> /etc/apt/sources.list.d/foreman.list'
- wget -q http://deb.theforeman.org/pubkey.gpg -O- | apt-key add -
- #
- # Install Foreman
- apt-get update && apt-get -y install foreman-installer
- foreman-installer
Advertisement
Add Comment
Please, Sign In to add comment