Advertisement
42n4

CEPH4UBUNTUFUNKCJE

Mar 28th, 2017
326
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 4.09 KB | None | 0 0
  1. #https://www.howtoforge.com/tutorial/how-to-install-a-ceph-cluster-on-ubuntu-16-04/
  2. #w VirtualBoxie zakładam vm Lubuntu z 2GB RAM i dwa dyski 8GB i 8GB
  3. #TUTAJ SĄ FUNKCJE DO GŁÓWNEGO SKRYPTU
  4. #GŁÓWNY SKRYPT
  5. #curl https://pastebin.com/raw/LK85bZ8D | sed 's/\r//g' > ceph.txt
  6. #FUNKCJE CZYLI TEN PLIK
  7. #curl https://pastebin.com/raw/tULD18VV | sed 's/\r//g' > cephfun.sh
  8.  
  9. ###############################################################################################
  10. #updatuje Ubuntu, dodając pakiety np. ceph-deploy
  11. cat << 'EOF' > /usr/local/bin/ubuntu_update
  12. apt-get update
  13. apt-get dist-upgrade -y
  14. apt-get install -y build-essential
  15. apt-get install -y ceph-deploy glusterfs-server
  16. apt-get install -y curl iotop vim git lm-sensors sg3-utils mc ethtool wpagui wireless-tools bonnie++ iperf sysbench ansible ntp ntpdate ntpstat rdate nmap aptitude openssh-server arp-scan
  17. aptitude install quota gdebi-core -y
  18. wget http://prdownloads.sourceforge.net/webadmin/webmin_1.831_all.deb
  19. gdebi webmin_1.831_all.deb -n
  20. curl http://ix.io/pnr > /etc/ntp.conf
  21. systemctl restart ntp
  22. systemctl enable ntp
  23. hwclock --systohc
  24. ufw status verbose
  25. ufw disable
  26. [ -f /etc/ansible/hosts ] && mv /etc/ansible/hosts /etc/ansible/hosts.orig -f
  27. echo "[web]" > /etc/ansible/hosts
  28. #echo server1  > /etc/ansible/hosts
  29. #echo server2 >> /etc/ansible/hosts
  30. #echo server3 >> /etc/ansible/hosts
  31. echo 'ansible all -s -m shell -a "$1"' > /usr/local/bin/ae
  32. chmod 700 /usr/local/bin/ae
  33. curl ix.io/client > /usr/local/bin/ix
  34. chmod +x /usr/local/bin/ix
  35. sed -i 's/prohibit-password/yes/g' /etc/ssh/sshd_config
  36. echo "Zmień hasło roota!"
  37. EOF
  38. chmod 755 /usr/local/bin/ubuntu_update
  39.  
  40. ###############################################################################################
  41. #debian_static_ip "server" "77" "78" "79"
  42. #server="server"; ip01="77"; ip02="78"; ip03="79"
  43. cat << 'EOF' > /usr/local/bin/ubuntu_static_ip
  44. server=$1
  45. #tu wpisuje uzyskane z dhcp ip
  46. ip01=$2
  47. ip02=$3
  48. ip03=$4
  49. echo "127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4" > /etc/hosts
  50. echo "192.168.2.${ip01} ${server}1" >> /etc/hosts
  51. echo "192.168.2.${ip02} ${server}2" >> /etc/hosts
  52. echo "192.168.2.${ip03} ${server}3" >> /etc/hosts
  53. echo "${server}1" >> /etc/ansible/hosts
  54. echo "${server}2" >> /etc/ansible/hosts
  55. echo "${server}3" >> /etc/ansible/hosts
  56.  
  57. ssh-keygen -t rsa -b 2048 -N '' -f ~/.ssh/id_rsa
  58. for node in ${server}1 ${server}2 ${server}3; do ssh-copy-id $node ; done
  59.  
  60. scp /etc/hosts root@${server}2:/etc
  61. scp /etc/hosts root@${server}3:/etc
  62. ssh ${server}1 "echo ${server}1 > /etc/hostname"
  63. ssh ${server}2 "echo ${server}2 > /etc/hostname"
  64. ssh ${server}3 "echo ${server}3 > /etc/hostname"
  65.  
  66. #tu wpisuje pożądane ustawione ip 3 maszyn
  67. ip01="51"
  68. ip02="52"
  69. ip03="53"
  70. echo "auto lo"                      >  /etc/network/interfaces
  71. echo "iface lo inet loopback"       >> /etc/network/interfaces
  72. echo "auto enp0s3"                  >> /etc/network/interfaces
  73. echo "iface enp0s3 inet static"     >> /etc/network/interfaces
  74. echo "   address 192.168.2.${ip01}" >> /etc/network/interfaces
  75. echo "   netmask 255.255.255.0"     >> /etc/network/interfaces
  76. echo "   network 192.168.2.0"       >> /etc/network/interfaces
  77. echo "   gateway 192.168.2.1"       >> /etc/network/interfaces
  78. echo "   dns-nameservers 8.8.8.8"   >> /etc/network/interfaces
  79.  
  80. rm  ~/interfaces -f;
  81. cp -a /etc/network/interfaces ~
  82. echo sed -i 's/address\ 192.168.2.'$ip01'/address\ 192.168.2.'$ip02'/g' ~/interfaces > ~/ip.sh
  83. sh ~/ip.sh
  84. scp  ~/interfaces root@server2:/etc/network
  85. rm  ~/interfaces -f;
  86. cp -a /etc/network/interfaces ~
  87. echo sed -i 's/address\ 192.168.2.'$ip01'/address\ 192.168.2.'$ip03'/g' ~/interfaces > ~/ip.sh
  88. sh ~/ip.sh
  89. scp  ~/interfaces root@server3:/etc/network
  90.  
  91. echo "127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4" > ~/hosts
  92. echo "192.168.2.${ip01} ${server}1" >> ~/hosts
  93. echo "192.168.2.${ip02} ${server}2" >> ~/hosts
  94. echo "192.168.2.${ip03} ${server}3" >> ~/hosts
  95. scp ~/hosts root@${server}2:/etc
  96. scp ~/hosts root@${server}3:/etc
  97. ssh ${server}2 reboot
  98. ssh ${server}3 reboot
  99. rm -rf /etc/hosts
  100. cp ~/hosts /etc
  101. EOF
  102. chmod 755 /usr/local/bin/ubuntu_static_ip
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement