Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

Installing Apache 2.4, MySQL 5.5 and PHP 5.4.2

By: a guest on May 9th, 2012  |  syntax: None  |  size: 6.45 KB  |  hits: 229  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Process for Ubuntu 12.04 LTS
  2.  
  3. ------------------------------------------
  4. Find out IP address
  5. ------------------------------------------
  6.  
  7. ifconfig
  8.  
  9. ------------------------------------------
  10. Install SSH
  11. ------------------------------------------
  12.  
  13. sudo apt-get install openssh-server
  14.  
  15. -> Now login with SSH using PuTTY using the IP address
  16. -> WinSCP can also now be used to get files onto the server
  17.  
  18. ------------------------------------------
  19. INSTALL WGET
  20. ------------------------------------------
  21.  
  22. sudo apt-get install wget
  23.  
  24. ------------------------------------------
  25. Install compiler tools
  26. ------------------------------------------
  27.  
  28. sudo apt-get update
  29. sudo apt-get upgrade
  30. sudo apt-get install build-essential
  31. gcc -v
  32. make -v
  33.  
  34. ------------------------------------------
  35. Download Apache Portable Runtime (APR), Apache, PHP and MySQL
  36. ------------------------------------------
  37.  
  38. -> Copy links and paste into PuTTY with right mouse click
  39.  
  40. wget http://www.bizdirusa.com/mirrors/apache//apr/apr-1.4.6.tar.gz
  41. wget http://mirror.uoregon.edu/apache//apr/apr-util-1.4.1.tar.gz
  42. wget http://zlib.net/zlib-1.2.7.tar.gz
  43. wget http://www.eng.lsu.edu/mirrors/apache//httpd/httpd-2.4.2.tar.gz
  44. wget http://nz.php.net/get/php-5.4.2.tar.gz/from/au.php.net/mirror
  45. wget http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.24.tar.gz/from/ftp://gd.tuwien.ac.at/db/mysql/
  46.  
  47. -> Fix php filename as it downloaded as 'mirror'
  48.  
  49. mv mirror php-5.4.2.tar.gz
  50.  
  51. ------------------------------------------
  52. Unpack APR, APR Util, Zlib compression library, Apache and PHP
  53. ------------------------------------------
  54.  
  55. gzip -d apr-1.4.6.tar.gz
  56. tar -xf apr-1.4.6.tar
  57.  
  58. gzip -d apr-util-1.4.1.tar.gz
  59. tar -xf apr-util-1.4.1.tar
  60.  
  61. gzip -d apr-1.4.6.tar.gz
  62. tar -xf apr-1.4.6.tar
  63.  
  64. gzip -d zlib-1.2.7.tar.gz
  65. tar -xf zlib-1.2.7.tar
  66.  
  67. gzip -d httpd-2.4.2.tar.gz
  68. tar -xf httpd-2.4.2.tar
  69.  
  70. gzip -d php-5.4.2.tar.gz
  71. tar -xf php-5.4.2.tar
  72.  
  73. ------------------------------------------
  74. Install Perl Compatible Regular Expressions (Apache dependency)
  75. ------------------------------------------
  76.  
  77. sudo apt-get install libpcre3 libpcre3-dev
  78.  
  79. ------------------------------------------
  80. Install ZLIB compression library
  81. ------------------------------------------
  82.  
  83. cd zlib-1.2.7
  84. ./configure
  85. make
  86. sudo make install
  87. cd ..
  88.  
  89. ------------------------------------------
  90. Move APR files to apache dependencies dir
  91. ------------------------------------------
  92.  
  93. pwd
  94. -> replace /home/testserver/ with the actual working dir
  95.  
  96. mv/home/testserver/apr-1.4.6 /home/testserver/httpd-2.4.2/srclib/apr
  97. mv/home/testserver/apr-util-1.4.1 /home/testserver/httpd-2.4.2/srclib/apr-util
  98.  
  99. ------------------------------------------
  100. Now finally install Apache
  101. ------------------------------------------
  102.  
  103. cd httpd-2.4.2/
  104. ./configure --enable-so --with-mpm=worker --enable-rewrite --enable-deflate --with-included-apr --with-included-apr-util
  105.  
  106. ------------------------------------------
  107. Configure Apache
  108. ------------------------------------------
  109.  
  110. sudo nano /usr/local/apache2/conf/httpd.conf
  111.  
  112. -> Edit the following line and set to:
  113.  
  114. ServerName localhost
  115.  
  116. -> save file and write out
  117. -> start Apache to test
  118.  
  119. /usr/local/apache2/bin/apachectl start
  120.  
  121. -> browse to http://server ip address/ to test
  122.  
  123. ------------------------------------------
  124. Configure MySQL
  125. ------------------------------------------
  126.  
  127. sudo apt-get install mysql-server
  128.  
  129. -> Test it is running
  130.  
  131. sudo netstat -tap | grep mysql
  132.  
  133. -> Generate MySQL optimisation config from https://tools.percona.com/wizard/result
  134. -> Edit and add config to my.cnf file
  135.  
  136. sudo nano /etc/mysql/my.cnf
  137. sudo service mysql restart
  138.  
  139. -> Test connection with SQLYog
  140.  
  141. SSH tab:
  142. Tick: Use SSH tunneling
  143. SSH host address: IP of the server
  144. Username: Username on server
  145. SSH port: 22
  146.  
  147. MySQL tab:
  148. MySQL host address: localhost
  149. Username: root
  150. Password: password used on setup
  151. Port: 3306
  152.  
  153. ------------------------------------------
  154. Configure PHP
  155. ------------------------------------------
  156.  
  157. sudo apt-get install libxml2-dev
  158.  
  159. ./configure --without-pear --with-zlib --enable-fpm --with-fpm-user=www --enable-cgi --with-fpm-group=www --with-mysql-sock=/var/run/mysqld/mysqld.sock;
  160. make
  161. make install
  162. make test
  163.  
  164. cp php.ini-production /usr/local/lib/php.ini
  165.  
  166.  
  167.  
  168.  
  169. httpd: Syntax error on line 145 of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/local/apache2/modules/libphp5.so into server: /usr/local/apache2/modules/libphp5.so: cannot open shared object file: No such
  170.  
  171. file or directory
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191. ------------------------------------------
  192. Configure MySQL prerequisites
  193. ------------------------------------------
  194.  
  195. -> install ncurses programming library
  196.  
  197. wget http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.9.tar.gz
  198. tar xzf ncurses-5.9.tar.gz
  199. cd ncurses-5.9
  200. ./configure --prefix=/opt/ncurses
  201. make
  202. sudo make install
  203. ls -la /opt/ncurses
  204.  
  205. -> install m4 Macro Processor
  206.  
  207. wget ftp://ftp.gnu.org/gnu/m4/m4-1.4.16.tar.gz
  208. tar -xvzf m4-1.4.16.tar.gz
  209. cd m4-1.4.16
  210. ./configure --prefix=/usr/local/m4
  211. sudo make install
  212.  
  213. -> install Bison (GNU Parser Generator)
  214.  
  215. wget http://ftp.gnu.org/gnu/bison/bison-2.5.tar.gz
  216. tar -xvzf bison-2.5.tar.gz
  217. cd bison-2.5
  218. PATH=$PATH:/usr/local/m4/bin/
  219. ./configure --prefix=/usr/local/bison --with-libiconv-prefix=/usr/local/libiconv/
  220. make
  221. sudo make install
  222.  
  223. -> install CMake (cross-platform, open-source build system)
  224.  
  225. wget http://www.cmake.org/files/v2.8/cmake-2.8.8.tar.gz
  226. tar xzf cmake-2.8.8.tar.gz
  227. cd cmake-2.8.8
  228. ./configure --prefix=/opt/cmake
  229. make
  230. sudo make install
  231. /opt/cmake/bin/cmake -version
  232.  
  233. -> install libaio (Kernel Asynchronous I/O (AIO) Support)
  234.  
  235. cd /opt
  236. sudo wget http://www.morphisms.net/~wkj/download/libaio.tbz
  237. sudo bunzip2 libaio.tbz
  238. sudo tar xf libaio.tar
  239. cd ~
  240.  
  241. ------------------------------------------
  242. Configure MySQL finally
  243. ------------------------------------------
  244.  
  245. tar xzf mysql-5.5.23.tar.gz
  246. cd mysql-5.5.23
  247. PATH=$PATH:/usr/local/bison/bin
  248.  
  249. /opt/cmake/bin/cmake . -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 \
  250. -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DMYSQL_DATADIR=/opt/mysql-5.5.24/data/ \
  251. -DCMAKE_INSTALL_PREFIX=/opt/mysql-5.5.24 -DCURSES_LIBRARY=/opt/ncurses/lib/libncurses.a \
  252. -DCURSES_INCLUDE_PATH=/opt/ncurses/include/ -DHAVE_LIBAIO_H=/opt/libaio/include/ \
  253. -DINSTALL_LAYOUT=STANDALONE -DENABLED_PROFILING=ON \
  254. -DMYSQL_MAINTAINER_MODE=OFF -DWITH_DEBUG=OFF
  255.  
  256. make
  257. make install
  258.  
  259.  
  260. -> Installs correctly but won't run because of sock error