#!/bin/bash clear echo "BackupPC Install Script for CentOS 6.x" echo "pbourdin@ceme-sa.com" echo "NOZEROCONF=yes" >> /etc/sysconfig/network sed -i -e "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/sysconfig/selinux setenforce 0 configure_repo() { cd /tmp wget -c http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm rpm -Uvh epel-release-6-8.noarch.rpm yum update -y yum -y install wget vim htop nmap iftop iotop nmap screen tmux nano } configure_iptables() { iptables -F iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT iptables -A INPUT -p icmp -j ACCEPT iptables -A INPUT -i lo -j ACCEPT iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 10050 -j ACCEPT iptables -A INPUT -j REJECT --reject-with icmp-host-prohibited /etc/init.d/iptables save /etc/init.d/iptables restart } install_backuppc() { yum -y install perl-Compress-Zlib perl-Archive-Zip perl-File-RsyncP perl-suidperl openssh-clients expect httpd htpasswd backuppc lsof eject smartmontools parted chkconfig backuppc on chkconfig httpd on echo "Entrer le mot de passe pour l'utilisateur 'backuppc'" htpasswd -c /etc/BackupPC/apache.users backuppc echo "Entrer le mot de passe pour l'utilisateur 'root'" htpasswd /etc/BackupPC/apache.users root sed -i -e "s/allow from 127.0.0.1/allow from all/g" /etc/httpd/conf.d/BackupPC.conf sed -i -e "s/$Conf{ServerHost} = 'localhost';/$Conf{ServerHost} = '$(hostname)';/g" /etc/BackupPC/config.pl sed -i -e "s/$Conf{CgiAdminUsers} = '';/$Conf{CgiAdminUsers} = 'root';/g" /etc/BackupPC/config.pl sed -i -e "s/$Conf{Language} = 'en';/$Conf{Language} = 'fr';/g" /etc/BackupPC/config.pl rm -rf /var/lib/BackupPC/* /etc/init.d/httpd restart /etc/init.d/backuppc restart } install_zabbix() { rpm -ivh http://repo.zabbix.com/zabbix/2.2/rhel/6/x86_64/zabbix-release-2.2-1.el6.noarch.rpm yum -y update yum -y install zabbix-agent sed -i -e "s/Server=127.0.0.1/Server=172.20.11.100/g" /etc/zabbix/zabbix_agentd.conf chkconfig zabbix-agent on /etc/init.d/zabbix-agent start } configure_repo install_zabbix configure_iptables install_backuppc