Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # puppet enterprise master for ubuntu 14.04 LTS server for developers
- # pre-install
- sudo apt-get update -y && sudo apt-get upgrade -y
- #
- # change hostname
- sudo hostname puppet
- #
- # To change the name permanently, run command to edit the host files:
- sudo sed -i 's/ubuntu/puppet/g' /etc/hosts
- sudo sed -i 's/ubuntu/puppet/g' /etc/hostname
- #
- # To disable the reboot action taken by pressing the Ctrl+Alt+Delete key combination, comment out the following line in the file /etc/init/control-alt-delete.conf.
- sudo 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
- #
- # Edit /etc/network/interfaces to meet your requirements.
- #
- sudo sed -i 's!dhcp!static!g' /etc/network/interfaces
- sudo sed -i '$ a\address 192.168.0.2' /etc/network/interfaces
- sudo sed -i '$ a\netmask 255.255.255.0' /etc/network/interfaces
- sudo sed -i '$ a\network 192.168.0.0' /etc/network/interfaces
- sudo sed -i '$ a\broadcast 192.168.0.255' /etc/network/interfaces
- sudo sed -i '$ a\gateway 192.168.0.1' /etc/network/interfaces
- #
- # Name resolution: Every node must have a unique hostname.
- # Forward and reverse DNS must both be configured correctly.
- # (If your site lacks DNS, you must write an /etc/hosts file on each node.)
- # Note: The default puppet master hostname is puppet.
- # Your agent nodes can be ready sooner if this hostname resolves to your puppet master.
- sudo sed -i '$ a\dns-nameservers 192.168.0.1' /etc/network/interfaces
- #
- sudo apt-get install ntp -y
- #
- # install LAMP server
- # https://help.ubuntu.com/lts/serverguide/httpd.html
- # https://help.ubuntu.com/lts/serverguide/php5.html
- # https://help.ubuntu.com/lts/serverguide/mysql.html
- sudo apt-get install apache2 -y
- sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql -y
- sudo mysql_install_db
- sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt -y
- sudo a2enmod ssl
- sudo a2ensite default-ssl
- sudo service apache2 restart
- # disable apache directory listing
- sudo sed -i 's!Options Indexes FollowSymLinks MultiViews!Options All FollowSymLinks MultiViews -Indexes!g' /etc/apache2/sites-available/default
- sudo sed -i 's!Options Indexes FollowSymLinks MultiViews!Options All FollowSymLinks MultiViews -Indexes!g' /etc/apache2/sites-available/default-ssl
- sudo service apache2 restart
- #
- # install webbased admin for MySQL
- sudo apt-get install phpmyadmin -y
- # install mediawiki for documentation and phpbb for forum discussion
- sudo apt-get install mediawiki imagemagick mediawiki-math php5-gd -y
- sudo apt-get install phpbb3 -y
- #
- # install munin monitoring
- # https://help.ubuntu.com/lts/serverguide/munin.html
- # http://munin-monitoring.org/
- # https://www.digitalocean.com/community/articles/how-to-install-munin-on-an-ubuntu-vps
- sudo apt-get install sysstat -y
- sudo apt-get install munin -y
- sudo apt-get install munin-node -y
- sudo apt-get install munin-plugins-extra -y
- sudo mkdir /var/www/munin
- sudo chown munin:munin /var/www/munin
- #
- sudo sed -i 's!# dbdir!dbdir!g' /etc/munin/munin.conf
- sudo sed -i 's!# htmldir /var/cache/munin/www!htmldir /var/cache/munin/www!g' /etc/munin/munin.conf
- sudo sed -i 's!# logdir /var/log/munin!logdir /var/log/munin!g' /etc/munin/munin.conf
- sudo sed -i 's!# rundir /var/run/munin!rundir /var/run/munin!g' /etc/munin/munin.conf
- #
- sudo sed -i '$ a\tmpldir /etc/munin/templates' /etc/munin/munin.conf
- sudo sed -i '$ a\[ServerMonitor]' /etc/munin/munin.conf
- sudo sed -i '$ a\address 127.0.0.1' /etc/munin/munin.conf
- sudo sed -i '$ a\use_node_name yes' /etc/munin/munin.conf
- #
- sudo sed -i 's!localhost 127.0.0.0/8 ::1!all!g' /etc/munin/apache.conf
- #
- sudo sed -i '$ a\[iostat]' /etc/munin/plugin-conf.d/munin-node
- sudo sed -i '$ a\env.SHOW_NUMBERED 1' /etc/munin/plugin-conf.d/munin-node
- #
- #
- sudo service munin-node restart
- sudo service apache2 restart
- #
- # install nagios
- ### op server:
- sudo apt-get install nagios-nrpe-server -y
- # op remote host:
- sudo apt-get install nagios3 nagios-nrpe-plugin -y
- # change the password for the nagiosadmin user:
- sudo htpasswd /etc/nagios3/htpasswd.users nagiosadmin
- # add a user:
- sudo htpasswd /etc/nagios3/htpasswd.users henry
- #
- # https://docs.puppetlabs.com/guides/install_puppet/post_install.html#configure-a-puppet-master-server
- #
- wget https://apt.puppetlabs.com/puppetlabs-release-trusty.deb
- sudo dpkg -i puppetlabs-release-precise.deb
- sudo apt-get update
- sudo apt-get install puppetmaster-passenger -y
- sudo apt-get install puppetmaster -y
- # upgrade!
- # sudo apt-get update
- # sudo puppet resource package puppetmaster ensure=latest
- #
- # SSH security
- # install OpenSSH server
- sudo apt-get install openssh-server -y
- sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.factory-defaults
- sudo chmod a-w /etc/ssh/sshd_config.factory-defaults
- sudo sed -i '$ a\ClientAliveInterval 300' /etc/ssh/sshd_config
- sudo sed -i '$ a\ClientAliveCountMax 0' /etc/ssh/sshd_config
- #
- # configuratie firewall (ip4+ip6) https://help.ubuntu.com/14.04/serverguide/firewall.html
- sudo ufw enable
- sudo ufw logging on
- sudo ufw allow 22
- sudo ufw allow 80
- sudo ufw allow 443
- sudo ufw allow 8140
- #
- sudo reboot
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement