Advertisement
that0n3guy

Aegir slaves - ubuntu 10.04 - php 5.2

Apr 8th, 2011
1,624
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.46 KB | None | 0 0
  1. #!/bin/bash
  2. # See peterjolson.com for useage
  3. CLI_MEMORY=192M
  4. APACHE_MEMORY=128M
  5.  
  6.  
  7. # Dont change below here
  8. apt-get update
  9. apt-get upgrade
  10. apt-get install build-essential git-core python-software-properties curl nano
  11.  
  12. # use php 5.2 instead of 5.3 - instructions from the "Install Apache, PHP and MySQL" section on http://jeffbeeman.com/node/117
  13. add-apt-repository ppa:txwikinger/php5.2
  14. wget http://github.com/jrbeeman/drupal-patches/raw/master/ubuntu-10.04-apt-php-prefs.txt -O /etc/apt/preferences.d/php --no-check-certificate
  15. apt-get update
  16.  
  17. # start aegir manual install guide: http://community.aegirproject.org/installing/manual
  18. apt-get install apache2 php5 php5-cli php5-gd php5-mysql postfix sudo rsync git-core unzip mysql-server
  19. a2enmod rewrite
  20. ln -s /var/aegir/config/apache.conf /etc/apache2/conf.d/aegir.conf
  21.  
  22. # Changing memory config and commenting out bind in mysql
  23. sed -i "s/memory_limit = .*/memory_limit = ${CLI_MEMORY}/" /etc/php5/cli/php.ini
  24. sed -i "s/memory_limit = .*/memory_limit = ${APACHE_MEMORY}/" /etc/php5/apache2/php.ini
  25. sed -i "s/bind-address.*/# bind-address = 127.0.0.1/" /etc/mysql/my.cnf
  26.  
  27. # restart mysql
  28. sudo /etc/init.d/mysql restart
  29.  
  30. #add aegir_root user to mysql
  31. echo "Please enter your root mysql password: "
  32. OLDMODES=`stty -g`
  33. stty -echo
  34. read MYSQL_ROOT
  35. stty $OLDMODES
  36.  
  37. echo "Enter what you WANT your aegir_root mysql password to be: "
  38. stty -echo
  39. read MYSQL_AEGIRROOT
  40. stty $OLDMODES
  41.  
  42. echo "Please enter master aegir servers ip address: "
  43. read AEGIRIP
  44.  
  45. mysql -p$MYSQL_ROOT -uroot <<< 'CREATE USER "aegir_root"@'$AEGIRIP' IDENTIFIED BY "'$MYSQL_AEGIRROOT'";'
  46. mysql -p$MYSQL_ROOT -uroot <<< 'CREATE USER "aegir_root"@"localhost" IDENTIFIED BY "'$MYSQL_AEGIRROOT'";'
  47. mysql -p$MYSQL_ROOT -uroot <<< 'GRANT ALL PRIVILEGES ON *.* TO "aegir_root"@'$AEGIRIP' WITH GRANT OPTION;'
  48. mysql -p$MYSQL_ROOT -uroot <<< 'GRANT ALL PRIVILEGES ON *.* TO "aegir_root"@"localhost" WITH GRANT OPTION;'
  49.  
  50.  
  51. # add aegir user to the system, set bash as schell,
  52. # use ubuntu's profile and bash for pretty console colors
  53. # create ssh dir in aegir home
  54. adduser --system --group --home /var/aegir aegir
  55. adduser aegir www-data
  56. chsh -s /bin/bash aegir
  57. cp /home/ubuntu/.bashrc /var/aegir/
  58. cp /home/ubuntu/.profile /var/aegir/
  59. mkdir /var/aegir/.ssh
  60.  
  61. # add aegir user to sudoers
  62. if [ -e /etc/sudoers.tmp -o "$(pidof visudo)" ]; then
  63.   echo "/etc/sudoers busy, try again later"
  64.   exit 1
  65. fi
  66.  
  67. cp /etc/sudoers /etc/sudoers.bak
  68. cp /etc/sudoers /etc/sudoers.tmp
  69. chmod 0640 /etc/sudoers.tmp
  70. echo "aegir ALL=NOPASSWD: /usr/sbin/apache2ctl" >> /etc/sudoers.tmp
  71. chmod 0440 /etc/sudoers.tmp
  72. mv /etc/sudoers.tmp /etc/sudoers
  73.  
  74. # install drush because its awesome
  75. wget http://ftp.drupal.org/files/projects/drush-7.x-4.4.tar.gz
  76. mv drush-7.x-4.4.tar.gz /var/aegir
  77. cd /var/aegir
  78. tar zxvf /var/aegir/drush-7.x-4.4.tar.gz
  79. rm /var/aegir/drush-7.x-4.4.tar.gz
  80. chmod u+x /var/aegir/drush/drush
  81. ln -s /var/aegir/drush/drush /usr/bin/drush
  82. chown aegir:aegir /var/aegir -R
  83.  
  84. #install pecl upload progress
  85. apt-get install php5-dev php-pear
  86. pecl install uploadprogress
  87. echo "extension=uploadprogress.so" >> /etc/php5/apache2/php.ini
  88.  
  89. echo " "
  90. echo " "
  91. echo "Finished, but you need to edit your hosts file with: nano /etc/hosts"
  92. echo "Also, if your running this on amazon ec2 you need to edit rc.local: nano /etc/rc.local"
  93. echo "After doing the above 2 items, reboot: sudo reboot"
  94. echo "p.s. don't forget to copy your ssh key from your master aegir server to /var/aegir/.ssh"
  95.  
  96. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement