BackupPC_install.sh 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #!/bin/bash
  2. clear
  3. echo "BackupPC Install Script for CentOS 6.x"
  4. echo "pbourdin@ceme-sa.com"
  5. echo "NOZEROCONF=yes" >> /etc/sysconfig/network
  6. sed -i -e "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/sysconfig/selinux
  7. setenforce 0
  8. configure_repo() {
  9. cd /tmp
  10. wget -c http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
  11. rpm -Uvh epel-release-6-8.noarch.rpm
  12. yum update -y
  13. yum -y install wget vim htop nmap iftop iotop nmap screen tmux nano
  14. }
  15. configure_iptables() {
  16. iptables -F
  17. iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
  18. iptables -A INPUT -p icmp -j ACCEPT
  19. iptables -A INPUT -i lo -j ACCEPT
  20. iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
  21. iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
  22. iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
  23. iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 10050 -j ACCEPT
  24. iptables -A INPUT -j REJECT --reject-with icmp-host-prohibited
  25. /etc/init.d/iptables save
  26. /etc/init.d/iptables restart
  27. }
  28. install_backuppc() {
  29. yum -y install perl-Compress-Zlib perl-Archive-Zip perl-File-RsyncP perl-suidperl openssh-clients expect httpd htpasswd backuppc lsof eject smartmontools parted
  30. chkconfig backuppc on
  31. chkconfig httpd on
  32. echo "Entrer le mot de passe pour l'utilisateur 'backuppc'"
  33. htpasswd -c /etc/BackupPC/apache.users backuppc
  34. echo "Entrer le mot de passe pour l'utilisateur 'root'"
  35. htpasswd /etc/BackupPC/apache.users root
  36. sed -i -e "s/allow from 127.0.0.1/allow from all/g" /etc/httpd/conf.d/BackupPC.conf
  37. sed -i -e "s/$Conf{ServerHost} = 'localhost';/$Conf{ServerHost} = '$(hostname)';/g" /etc/BackupPC/config.pl
  38. sed -i -e "s/$Conf{CgiAdminUsers} = '';/$Conf{CgiAdminUsers} = 'root';/g" /etc/BackupPC/config.pl
  39. sed -i -e "s/$Conf{Language} = 'en';/$Conf{Language} = 'fr';/g" /etc/BackupPC/config.pl
  40. rm -rf /var/lib/BackupPC/*
  41. /etc/init.d/httpd restart
  42. /etc/init.d/backuppc restart
  43. }
  44. install_zabbix() {
  45. rpm -ivh http://repo.zabbix.com/zabbix/2.2/rhel/6/x86_64/zabbix-release-2.2-1.el6.noarch.rpm
  46. yum -y update
  47. yum -y install zabbix-agent
  48. sed -i -e "s/Server=127.0.0.1/Server=172.20.11.100/g" /etc/zabbix/zabbix_agentd.conf
  49. chkconfig zabbix-agent on
  50. /etc/init.d/zabbix-agent start
  51. }
  52. configure_repo
  53. install_zabbix
  54. configure_iptables
  55. install_backuppc