Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #https://www.howtoforge.com/tutorial/how-to-install-a-ceph-cluster-on-ubuntu-16-04/
- #w VirtualBoxie zakładam vm Lubuntu z 2GB RAM i dwa dyski 8GB i 8GB
- #TUTAJ SĄ FUNKCJE DO GŁÓWNEGO SKRYPTU
- #GŁÓWNY SKRYPT
- #curl https://pastebin.com/raw/LK85bZ8D | sed 's/\r//g' > ceph.txt
- #FUNKCJE CZYLI TEN PLIK
- #curl https://pastebin.com/raw/tULD18VV | sed 's/\r//g' > cephfun.sh
- ###############################################################################################
- #updatuje Ubuntu, dodając pakiety np. ceph-deploy
- cat << 'EOF' > /usr/local/bin/ubuntu_update
- apt-get update
- apt-get dist-upgrade -y
- apt-get install -y build-essential
- apt-get install -y ceph-deploy glusterfs-server
- 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
- aptitude install quota gdebi-core -y
- wget http://prdownloads.sourceforge.net/webadmin/webmin_1.831_all.deb
- gdebi webmin_1.831_all.deb -n
- curl http://ix.io/pnr > /etc/ntp.conf
- systemctl restart ntp
- systemctl enable ntp
- hwclock --systohc
- ufw status verbose
- ufw disable
- [ -f /etc/ansible/hosts ] && mv /etc/ansible/hosts /etc/ansible/hosts.orig -f
- echo "[web]" > /etc/ansible/hosts
- #echo server1 > /etc/ansible/hosts
- #echo server2 >> /etc/ansible/hosts
- #echo server3 >> /etc/ansible/hosts
- echo 'ansible all -s -m shell -a "$1"' > /usr/local/bin/ae
- chmod 700 /usr/local/bin/ae
- curl ix.io/client > /usr/local/bin/ix
- chmod +x /usr/local/bin/ix
- sed -i 's/prohibit-password/yes/g' /etc/ssh/sshd_config
- echo "Zmień hasło roota!"
- EOF
- chmod 755 /usr/local/bin/ubuntu_update
- ###############################################################################################
- #debian_static_ip "server" "77" "78" "79"
- #server="server"; ip01="77"; ip02="78"; ip03="79"
- cat << 'EOF' > /usr/local/bin/ubuntu_static_ip
- server=$1
- #tu wpisuje uzyskane z dhcp ip
- ip01=$2
- ip02=$3
- ip03=$4
- echo "127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4" > /etc/hosts
- echo "192.168.2.${ip01} ${server}1" >> /etc/hosts
- echo "192.168.2.${ip02} ${server}2" >> /etc/hosts
- echo "192.168.2.${ip03} ${server}3" >> /etc/hosts
- echo "${server}1" >> /etc/ansible/hosts
- echo "${server}2" >> /etc/ansible/hosts
- echo "${server}3" >> /etc/ansible/hosts
- ssh-keygen -t rsa -b 2048 -N '' -f ~/.ssh/id_rsa
- for node in ${server}1 ${server}2 ${server}3; do ssh-copy-id $node ; done
- scp /etc/hosts root@${server}2:/etc
- scp /etc/hosts root@${server}3:/etc
- ssh ${server}1 "echo ${server}1 > /etc/hostname"
- ssh ${server}2 "echo ${server}2 > /etc/hostname"
- ssh ${server}3 "echo ${server}3 > /etc/hostname"
- #tu wpisuje pożądane ustawione ip 3 maszyn
- ip01="51"
- ip02="52"
- ip03="53"
- echo "auto lo" > /etc/network/interfaces
- echo "iface lo inet loopback" >> /etc/network/interfaces
- echo "auto enp0s3" >> /etc/network/interfaces
- echo "iface enp0s3 inet static" >> /etc/network/interfaces
- echo " address 192.168.2.${ip01}" >> /etc/network/interfaces
- echo " netmask 255.255.255.0" >> /etc/network/interfaces
- echo " network 192.168.2.0" >> /etc/network/interfaces
- echo " gateway 192.168.2.1" >> /etc/network/interfaces
- echo " dns-nameservers 8.8.8.8" >> /etc/network/interfaces
- rm ~/interfaces -f;
- cp -a /etc/network/interfaces ~
- echo sed -i 's/address\ 192.168.2.'$ip01'/address\ 192.168.2.'$ip02'/g' ~/interfaces > ~/ip.sh
- sh ~/ip.sh
- scp ~/interfaces root@server2:/etc/network
- rm ~/interfaces -f;
- cp -a /etc/network/interfaces ~
- echo sed -i 's/address\ 192.168.2.'$ip01'/address\ 192.168.2.'$ip03'/g' ~/interfaces > ~/ip.sh
- sh ~/ip.sh
- scp ~/interfaces root@server3:/etc/network
- echo "127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4" > ~/hosts
- echo "192.168.2.${ip01} ${server}1" >> ~/hosts
- echo "192.168.2.${ip02} ${server}2" >> ~/hosts
- echo "192.168.2.${ip03} ${server}3" >> ~/hosts
- scp ~/hosts root@${server}2:/etc
- scp ~/hosts root@${server}3:/etc
- ssh ${server}2 reboot
- ssh ${server}3 reboot
- rm -rf /etc/hosts
- cp ~/hosts /etc
- EOF
- chmod 755 /usr/local/bin/ubuntu_static_ip
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement