Home Accessibility Courses Twitter The Mouth Facebook Resources Site Map About Us Contact
 
20.9.2014 - We have just updated our course layouts and descriptions and added our 2015 schedule.

Apache httpd, MySQL, PHP - installation procedure

Customer training RoomIf you're installing LAMP (Linux, Apache, MySQL, PHP), what do you do and in which order? Here's a summary of the procedure we followed on todays Apache httpd deployment course - in this case running (tailored) for a single company audience, and tailored for specfic needs.

(I've documented this and reproduced it here as it brings together in a short reminder form material from many different sources / help files, and shows you the decisions taken in real life as we followed the procedures. In the case of the examples, httpd, mysql and PHP were already installed and had to be stopped and deleted before fresh copies could be installed!)


Illustration - a room on a customer site waiting for the delegates to learn Linux Web Server deployment.

a) Build of httpd (Must do this before we install PHP)

As root

1. Stop the old daemon
2. Take backups of data to be kept
3. cd /usr/local; rm -rf apache2

As admin user

(cd to user's build area)
3. rm -rf httpd-2.2.8
4. tar xzf httpd-2.2.8.tar.gz
5. cd httpd-2.2.8
6. ./configure --enable-proxy --enable-proxy-httpd --enable-proxy-balance --enable-jk --enable-so --enable-rewrite
Note:--enable-so is needed later on for PHP. The other modules were selected because of our requirements later in the day to proxy requests on to another system, to rewrite URLs, and to talk to Apache Tomcat via an AJP 1.3 connector
7. make

Back as root

(cd to user's build area)
8. cd httpd-2.2.8
9. make install
10. cd /usr/local/apache2
11. ./bin/apachectl start

From a browser

12. Test - visit http://yourhostname/

b) Add in MySQL (must do this before PHP as PHP uses its C library)

As root

101. Backup old data
102. Stop the old daemon (./support-files/mysql.server stop)
103. cd /usr/local - remove old version AND symlink!
Note:You should also delete the old /etc/my.cnf file, and the .my.cnf file in root's home directory, if you want to create a fresh build with fresh databases and tables. Otherwise it will inherit the old ones
104. tar xzf ~trainee/mysql-5.1.24-rc-linux-i686-icc-glibc23.tar.gz
105. ln -s mysql-5.1.24-rc-linux-i686-icc-glibc23/ mysql
106. cd mysql; chown -R mysql.mysql .
107 ./scripts/mysql_install_db --user=mysql
108. chown -R root .
109. chown -R mysql data
110. ./support-files/mysql.server start
111. ./bin/mysqladmin -u root password 'abc123'
112. Test - visit via ./bin/mysql -pabc123

c) And now PHP

(Nothing to delete or backup as you've done that already!)

As admin user

201. tar xzf php-5.2.5.tar.gz
202. cd php-5.2.5
203. /configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql
204. make

As root

205. cd /usr/local/apache2
206. ./bin/apachectl stop
207. cd ~trainee/php-5.2.5
208. make install
209. cp php.ini-dist /usr/local/lib/php.ini
210. Edit /usr/local/apache2/conf/httpd.conf to ensure the following are there:
LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps

211. cd /usr/local/apache2
212. ./bin/apachectl start
213. Add in file /usr/local/apache2/htdocs/phtest.php to contain just
<?php phpinfo(); ?>

214. Test - browse to http://yourservername/phtest.php

d) Make them restart at reboot

301. cd /etc/rc3.d or /etc/rc5.d
302. remove old symbolic links to previous installs
303. cd /etc/init.d
304. remove old apachectl and mysql.server files

305. cp /usr/local/apache2/bin/apachectl .
306. cp /usr/local/mysql/support-files/mysql.server .
307. cd /etc/rc3.d or /etc/rc5.d
308. ln -s ../init.d/apachectl S94webserver
309. ln -s ../init.d/mysql.server S93sqlserver

310. Test by rebooting!
311. Visit the MySQL client program(repeat step 112) and web server(repeat step 214)

Should you get an error message like:

httpd: Syntax error on line 53 of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/local/apache2/modules/libphp5.so into server: /usr/local/mysql/lib/libmysqlclient.so.16: cannot restore segment prot after reloc: Permission denied

it's likely you're having issues with SELinux. As a quick fix, you may like to
add
setenforce 0
near the beginning of the scripts that you have copied into /etc/init.d

------ All basically running at this point --------

e) Further near-mandatory setup!

Move Web Site to appropriate place (e.g. /home or /var or /websites) (and switch web server to use it!)

Set up user and group for web server and switch server to use it! (or use the standard Apache one)

Set up user (same group) for web developer / provider

Set up MySQL account for web server. Set MySQL passwords.

Remove spurious accounts in MySQL!

Set up test page. Reboot (to ensure restarts AOK still!) Test.
(written 2008-08-01, updated 2010-06-23)

 
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articles
A164 - Web Application Deployment - Services and Regular Jobs
  [3792] Managing daemons from a terminal session - (2012-07-01)
  [3791] The Kernel, Shells and Daemons. Greek Gods in computing - (2012-07-01)
  [3143] On time - (2011-01-23)
  [3011] What are .pid files? - (2010-10-23)
  [2182] What Linux run level am I in? - (2009-05-15)
  [2145] Using the internet to remotely check for power failure at home (PHP) - (2009-04-29)
  [1903] daemons - what is running on my Linux server? - (2008-11-23)
  [1765] Dialects of English and Unix - (2008-08-21)
  [1733] memcached - overview, installation, example of use in PHP - (2008-08-02)
  [1700] FTP server on Fedora Linux - (2008-07-06)
  [1633] Changing a screen saver from a web page (PHP, Perl, OSX) - (2008-05-06)
  [1553] Automatic startup and shutdown of Tomcat - (2008-02-24)
  [1288] Linux run states, shell special commands, and directory structures - (2007-08-03)
  [1028] Linux / Unix - process priority and nice - (2007-01-10)
  [907] Browser -> httpd -> Tomcat -> MySQL. Restarting. - (2006-10-28)
  [544] Repeating tasks with crontab - (2005-12-27)

A602 - Web Application Deployment - Apache httpd - Sourcing, Installation, Testing
  [3426] Automed web site testing scripted in Ruby using watir-webdriver - (2011-09-09)
  [2520] Global and Enable - two misused words! - (2009-11-30)
  [2184] Choosing the right version of Java and Tomcat - (2009-05-16)
  [2096] Where is my new Apache httpd installed - (2009-03-22)
  [2080] Using ApacheBench and jconsole to test and monitor Tomcat - (2009-03-14)
  [1945] Summary - Apache httpd build on Linux - (2008-12-14)
  [1768] What is built in to this httpd and PHP? - (2008-08-23)
  [1707] Configuring Apache httpd - (2008-07-12)
  [1455] Connecting to MySQL 5 from PHP on Mac OSX Leopard - (2007-12-03)
  [1449] Upgrade Mac OSX to Leopard, Web Server Apache httpd config lost - (2007-11-29)
  [1292] DHCP automatic IP address v Static IP - (2007-08-06)
  [1095] Apache httpd , browser, MySQL and MySQL client downloads - (2007-02-28)
  [982] Notes from the white board - (2006-12-14)
  [660] Stopping and restarting Apache httpd cleanly - (2006-03-29)
  [550] 2006 - Making business a pleasure - (2006-01-01)
  [526] Apache httpd - serving web documents from different directories - (2005-12-12)
  [523] Apache httpd release 2.2 - (2005-12-10)

A607 - Web Application Deployment - Apache httpd mod_rewrite
  [3862] Forwarding a whole domain, except for a few directories - Apache http server - (2012-09-17)
  [3753] Adding a passcode to a directory - (2012-06-05)
  [3568] Telling which ServerAlias your visitor used - useful during merging domains - (2012-01-04)
  [3339] Simplest ever proxy configuration? - (2011-06-28)
  [3197] Finding and diverting image requests from rogue domains - (2011-03-08)
  [2981] How to set up short and meaningfull alternative URLs - (2010-10-02)
  [2900] Redirecting a page - silent, temporary or permanent? - (2010-08-03)
  [2773] Dynamically watching your web site via a PHP wrapper - (2010-05-21)
  [2768] Carrying a long URL around - looking for memorable shorts - (2010-05-17)
  [2728] Redirecting a home page using mod_rewrite - (2010-04-17)
  [2555] Bookkeeping - (2009-12-29)
  [2094] If you have a spelling mistake in your URL / page name - (2009-03-21)
  [1954] mod_rewrite for newcomers - (2008-12-20)
  [1778] Pointing all the web pages in a directory at a database - (2008-08-30)
  [1771] More HowTo diagrams - MySQL, Tomcat and Java - (2008-08-24)
  [1636] What to do if the Home Page is missing - (2008-05-08)
  [1381] Using a MySQL database to control mod_rewrite via PHP - (2007-10-06)
  [1376] Choosing between mod_proxy and mod_rewrite - (2007-10-02)
  [1207] Simple but effective use of mod_rewrite (Apache httpd) - (2007-05-27)
  [1009] Passing GET parameters through Apache mod_rewrite - (2006-12-27)
  [1006] Apache httpd and Apache Tomcat together tips - (2006-12-24)
  [934] Clustering, load balancing, mod_rewrite and mod_proxy - (2006-11-21)
  [755] Using different URLs to navigate around a single script - (2006-06-11)
  [631] Apache httpd to Tomcat - jk v proxy - (2006-03-03)

H114 - Sourcing, installing and configuring PHP
  [3955] Building up from a small PHP setup to an enterprise one - (2012-12-16)
  [3635] Parse error: parse error, unexpected T_STRING on brand new web site - why? - (2012-03-03)
  [3132] Virtual Hosting with Apache http server - an overall scheme, and avoiding common pitfalls - (2011-01-14)
  [2646] Compile but do not run PHP - syntax check only - (2010-02-22)
  [2589] Your PHP code does not work? Here is where to start looking. - (2010-01-18)
  [2433] Controlling, supressing, enabling PHP error messages - (2009-10-02)
  [2317] How to make a Risotto (PHP build style) - (2009-08-02)
  [1936] Quick Summary - PHP installation - (2008-12-12)
  [1688] cannot restore segment prot after reloc message - PHP / httpd - (2008-06-26)
  [1667] Checking server performance for PHP generated pages - (2008-06-06)
  [481] PHP upgrade - traps to watch - (2005-10-31)
  [316] Development Environments - (2005-05-19)
  [192] Current MySQL and PHP paths and upgrades - (2005-01-28)

S153 - Sourcing, Running and Configuring MySQL
  [2458] Cant connect to local MySQL server through socket /tmp/mysql.sock - (2009-10-17)
  [2445] Securing MySQL on a production server - (2009-10-09)
  [2444] Potted MySQL installation - (2009-10-09)
  [2426] Which version of MySQL am I running? - (2009-09-26)
  [2209] Monitoring and Tuning your MySQL installation - (2009-05-31)
  [2085] MySQL - licensing issues, even with using the name - (2009-03-16)
  [1935] Summary of MySQL installation on a Linux system - (2008-12-11)
  [1689] Some sideways thoughts on the news - (2008-06-27)
  [1131] MySQL - Password security (authentication protocol) - (2007-04-02)
  [1123] mysqldump and mysqlrestore - (2007-03-30)
  [591] Key facts - SQL and MySQL - (2006-02-04)
  [535] MySQL permissions and privileges - (2005-12-20)
  [515] MySQL - an FAQ - (2005-12-03)
  [489] Which MySQL server am I using? - (2005-11-07)
  [334] Symbolic links and hard links - (2005-06-02)


Back to
Punting on the Cam
Previous and next
or
Horse's mouth home
Forward to
Old pictures and comparisons
Some other Articles
Finding words and work boundaries (MySQL, Perl, PHP)
All around the world?
Old pictures and comparisons
Apache httpd, MySQL, PHP - installation procedure
Punting on the Cam
Back from the future
A short Perl example
Equality and looks like tests - Perl
Hot Courses - Perl
4291 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86 at 50 posts per page


This is a page archived from The Horse's Mouth at http://www.wellho.net/horse/ - the diary and writings of Graham Ellis. Every attempt was made to provide current information at the time the page was written, but things do move forward in our business - new software releases, price changes, new techniques. Please check back via our main site for current courses, prices, versions, etc - any mention of a price in "The Horse's Mouth" cannot be taken as an offer to supply at that price.

Link to Ezine home page (for reading).
Link to Blogging home page (to add comments).

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2014: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 899360 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/mouth/1731_apa ... edure.html • PAGE BUILT: Thu Sep 18 15:30:25 2014 • BUILD SYSTEM: WomanWithCat