Advertisement
quiliro

InstantHobo.bash

Apr 19th, 2012
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 4.37 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # Copyright (C) 2012-2014 Quiliro Ordóñez
  4. #
  5. # This program is free software: you can redistribute it and/or modify
  6. # it under the terms of the GNU Affero General Public License as
  7. # published by the Free Software Foundation, either version 3 of the
  8. # License, or (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
  13. # GNU Affero General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU Affero General Public
  16. # License along with this program.If not, see
  17. # <http://www.gnu.org/licenses/>.
  18. #
  19. # InstantHobo.bash version 0.5.10
  20.  
  21.  
  22. # This program installs Hobo stable version 2.1.0 on Trisquel 6.0.1
  23. # distribution of the GNU operating system by installing Ruby version
  24. # 1.9.3 and other binary software packages from the repository.
  25.  
  26.  
  27. # Installation:
  28. #
  29. # Just download this file and save it as InstantHobo.bash . Then make it
  30. # executable by typing:
  31. # chmod +x InstantHobo.bash
  32. # Run it by typing:
  33. # ./InstantHobo.bash
  34. # It will ask you for the current user password. It will work if the user
  35. # is in the sudoers list.
  36.  
  37.  
  38. # Note: If you want to remove all gems, before running this script type:
  39. # sudo gem list | cut -d" " -f1 | xargs sudo gem uninstall -aIx
  40.  
  41.  
  42. # This script has been untested on Trisquel 6.0.1 with Apache & Webmin
  43. # web servers and with SQLite3, PostgreSQL & MySQL database engines.
  44. # Have fun using and modifying it. Please send me your updates
  45. # at quiliro [at] fsfla [dot] org so I can share them with others.
  46. # Keep hacking!
  47.  
  48.  
  49. echo "Updating package database"
  50. sudo apt-get update
  51. # Uncomment the following line if you want to update installed packages.
  52. # sudo apt-get upgrade -y
  53.  
  54. echo
  55. echo "Installing stable versions of Build utilities, Ruby"
  56. echo " and Rubygems as well as the git versioning system"
  57. sudo apt-get -y install build-essential libssl-dev libreadline-gplv2-dev
  58. sudo apt-get -y install zlib1g-dev checkinstall nodejs ruby1.9.1-full git-core
  59.  
  60. # Uncomment the following 3 lines if you want to update installed gems.
  61. # echo
  62. # echo "Updating currently installed gems"
  63. # sudo gem update
  64.  
  65. # Choosing the web server
  66.  
  67. echo
  68. echo "Choose web server"
  69. echo "------ --- ------"
  70. echo "Choose one of the following webserver:"
  71. echo
  72. echo "[A]pache 2"
  73. echo "[W]ebrick"
  74.  
  75. read webserver
  76.  
  77. case "$webserver" in
  78.  
  79. "A" | "a" )
  80.  
  81. echo "Installing Apache 2 Web server"
  82. sudo apt-get -y install apache2
  83. ;;
  84.  
  85. "W" | "w" )
  86.  
  87. echo "Webrick Web server is always installed by Hobo"
  88. ;;
  89.  
  90. esac
  91.  
  92. # Choosing the database
  93.  
  94. echo
  95. echo "Choose database"
  96. echo "------ --------"
  97. echo "Choose one of the following databases:"
  98. echo
  99. echo "[M]ySQL 5"
  100. echo "[S]QLite 3"
  101. echo "[P]ostgreSQL"
  102.  
  103. read database
  104.  
  105. case "$database" in
  106.  
  107. "M" | "m" )
  108.  
  109. echo
  110. echo "Installing MySQL database management system server"
  111. sudo apt-get -y install mysql-server libmysqlclient-dev libmysql-ruby1.9.1
  112. echo "Installing MySQL gem"
  113. sudo gem install mysql2
  114. ;;
  115.  
  116. "S" | "s" )
  117.  
  118. echo
  119. echo "Installing SQLite 3 database management system server"
  120. sudo apt-get -y install sqlite3 libsqlite3-dev
  121. echo "Installing Sqlite3 gem"
  122. sudo gem install sqlite3
  123. ;;
  124.  
  125.  
  126. #
  127. #
  128. # When using PostgreSQL, the database requires to change:
  129. # local   all             all                                     peer
  130. # for:
  131. # local   all             all                                     md5
  132. # Also tried with changing to this:
  133. # local   all             all                                     trust
  134. # host    all             all             127.0.0.1/32            trust
  135. #
  136. # Then restart the database motor with:
  137. # sudo service postgresql restart
  138. # But it still has errors which I am currently correcting. I guess you have
  139. # to create the user and the database first. But I have no experience with
  140. # Hobo and PostgreSQL.
  141.  
  142. "P" | "p" )
  143.  
  144. echo
  145. echo "Installing PostgreSQL database management system server"
  146. sudo apt-get -y install postgresql postgresql-server-dev-9.1
  147. echo "Installing PostgreSQL gem"
  148. sudo gem install pg
  149. ;;
  150.  
  151. esac
  152.  
  153. echo
  154. echo "Installing the Hobo gem"
  155. sudo gem install hobo
  156. echo "You can create a new Hobo application with: "
  157. echo "hobo new application_name --setup"
  158. echo "You can remove it with: "
  159. echo "rm -rf application_name"
  160. echo "Happy hacking!"
  161.  
  162. # End of script
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement