Advertisement
MorpheusArch

Lamp_Install_Debian

Jul 27th, 2016
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 4.91 KB | None | 0 0
  1. #This program is free software; you can redistribute it and/or
  2. #modify it under the terms of the GNU General Public License
  3. #as published by the Free Software Foundation; either version 2
  4. #of the License, or (at your option) any later version.
  5.  
  6. #This program is distributed in the hope that it will be useful,
  7. #but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  9. #GNU General Public License for more details.
  10.  
  11. #You should have received a copy of the GNU General Public License
  12. #along with this program; if not, write to the Free Software
  13. #Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  14.  
  15. ###############################################################
  16.  
  17. if [ $(id -u) != "0" ]; then
  18.         echo "You must be root to run this script"
  19.         exit 1
  20. fi
  21.  
  22. ##############################################################
  23.  
  24. echo "Resolving dependencies for script"
  25. apt-get install sudo
  26.  
  27. ##############################################################
  28.  
  29. echo "You need a user account who is in the sudoers list"
  30. echo "Please enter normal user account name"
  31. read username
  32. adduser $username sudo 2>/dev/null
  33.  
  34. ###############################################################
  35.  
  36. echo ""
  37. echo "Performing system upgrade"
  38. echo ""
  39.  
  40. apt-get update && apt-get upgrade -y
  41.  
  42. ###############################################################
  43.  
  44. echo ""
  45. echo "Installing MySQL"
  46. echo ""
  47. apt-get install mysql-server mysql-client
  48.  
  49. ################################################################
  50.  
  51. echo ""
  52. echo "Installing PHP"
  53. apt-get install php5 php5-mysql libapache2-mod-php5
  54. echo ""
  55.  
  56. ################################################################
  57.  
  58. echo ""
  59. echo "Installing apache2-doc"
  60. echo ""
  61. apt-get install apache2-doc
  62.  
  63. ################################################################
  64.  
  65. echo ""
  66. echo "Restarting apache2"
  67. service apache2 restart
  68. echo ""
  69. ################################################################
  70.  
  71. echo ""
  72. echo "Enabling apache userdir module"
  73. a2enmod userdir
  74. echo ""
  75.  
  76. #################################################################
  77.  
  78. echo ""
  79. echo "Downloading apache userdir.conf"
  80. wget https://pastebin.com/raw/74cZYZ6G -O userdir.conf
  81. echo ""
  82.  
  83. #################################################################
  84.  
  85. echo ""
  86. sleep 1
  87. if cmp -s "$userdir.conf" "$/etc/apache2/mods-enabled/userdir.conf"
  88. then
  89.    echo "userdir.conf is configured correctly"
  90.    echo "Deleting downloaded userdir.conf since one installed is correct"
  91.    sleep 2
  92.    rm userdir.conf
  93. else
  94.    echo "userdir.conf is different from Debian wiki"
  95.    echo "Moving userdir.conf to /etc/apache2/mods-enabled/userdir.conf"
  96.    rm /etc/apache2/mods-enabled/userdir.conf
  97.    mv userdir.conf /etc/apache2/mods-enabled/userdir.conf
  98. fi
  99.  
  100. sleep 2
  101. echo ""
  102.  
  103. ####################################################################
  104.  
  105. echo ""
  106. echo "The directory 'public_html' must be created with user account NOT as root"
  107. sleep 1
  108. echo "Logging out as root"
  109. logout 2>/dev/null
  110.  
  111. #####################################################################
  112.  
  113. echo "What is your username to create the 'public_html' directory?"
  114. read username
  115. echo "Hello, $username please wait for directory to be created"
  116. mkdir /home/$username/public_html
  117. sleep 2
  118. echo ""
  119.  
  120.  
  121. ####################################################################
  122.  
  123. echo "Verifying permissions of public_html"
  124. cd /home/$username
  125. sudo chmod +0750 public_html
  126. echo "Permissions set"
  127.  
  128. #####################################################################
  129.  
  130. echo ""
  131. echo "Changing public_html group as root"
  132. sudo chgrp www-data /home/$username/public_html
  133. echo ""
  134.  
  135. ######################################################################
  136.  
  137. echo ""
  138. echo "Restarting apache2"
  139. sudo service apache2 restart
  140. sleep 2
  141. echo ""
  142.  
  143. ######################################################################
  144.  
  145. echo ""
  146. echo "Displaying apache2 status"
  147. echo ""
  148. sudo service apache2 status
  149.  
  150. ######################################################################
  151.  
  152. echo ""
  153. echo "Downloading php5.conf"
  154. echo ""
  155.  
  156. wget https://pastebin.com/raw/TP7QGKXD -O php.conf
  157.  
  158. if cmp -s "$php.conf" "$/etc/apache2/mods-available/php.conf"
  159. then
  160.    echo "php.conf is configured correctly"
  161.    echo "Deleting downloaded php.conf since one installed is correct"
  162.    sleep 2
  163.    rm php.conf
  164. else
  165.    echo "php.conf is different from Debian wiki"
  166.    echo "Moving php.conf to /etc/apache2/mods-available/php.conf"
  167. fi
  168.  
  169. #######################################################################
  170.  
  171. echo "Creating phpinfo"
  172. echo "<?php phpinfo(); ?>" >> /var/www/html/test.php
  173. echo ""
  174.  
  175. #######################################################################
  176.  
  177. echo "Install complete...Navigate your browser to localhost and locolhost/test.php"
  178.  
  179. #######################################################################
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement