Vous êtes sur la page 1sur 39

Installing an Apache Server

What is Apache Server? Why is it useful?

Apache Software Foundation


Open source software
Community of developers and users Collaborative software development Create high quality software;
commercial grade Robust Featureful

27/01/2012

Apache Software Foundation


3

Support for Apache projects;


Tomcat powers large scale mission critical web applications HTTP Server open source server for modern OSs (most popular web server since April 1996) ver. 2.2 latest. Abdera simplified server side framework for implementing services ActiveMQ message broker & enterprise integration patterns and much more (apache.org)

27/01/2012

Apache on Talisker (Linux server)


4

Requires disk space:


Create a directory under /tmp for temporary unlimited disk space. Copy the apache folder from /mdx/modules/ccm2424/

ANSI-C Compiler:
GNU C compiler is available with Linux; if not GCC ensure compiler is ANSI compliant.

27/01/2012

Unzip & untar the distribution


5

Take note of the size of apache_1.3.20.tar.gz before unzipping with;


gzip d

Untar the archive, apache_1.3.20.tar with;


tar xvf

Navigate to the resulting apache folder and read the README & README.configure files.

27/01/2012

Configuring Apache
6

The most important setup here is the location prefix:


Where Apache is to be installed Has to be configured to this location to work properly
./configure --prefix=PREFIX replace the word PREFIX with your directory path /usr/local/apache (/home2/userid/apache)

27/01/2012

Building & Installing Apache


7

Build various parts which form the Apache package make Install the package under the configured installation path PREFIX make install

27/01/2012

Starting Apache
8

Apache is configured by inserting directives in the plain text configuration file Navigate to the conf folder of your installation and view the httpd.conf
Modify default port to values above 1023

Changes to httpd.conf file are recognised when are Apache is started or restarted

27/01/2012

Starting Apache
9

Locate the bin directory and fire up apache with the following; ./apachectl start

Load your browser and request via URL


talisker.mdx.ac.uk:portnumber
portnumber = numerical value

27/01/2012

Coursework support
10

Read the coursework specification on OasisPlus Access required to mysql databse;


mysql u student p
password = ccm2092

A command usually consists of an SQL statement followed by a semicolon


SELECT VERSION ( ), CURRENT_DATE;

27/01/2012

Coursework support
11

The database is ccm2092, and the table is beer with four columns; NAME, COUNTRY, RATING & PRICE Show databases; Use ccm2092 Show tables; Select * from beer;

27/01/2012

Coursework support
12

Scripting and databases allow us to create database-enabled websites and programs for displaying dynamic content PHP: Hypertext Preprocessor server-side language (run on server and not on user s web browser) Writing PHP: simple to learn. (Your task)
Text editor required: save file with .php extension

27/01/2012

How do you Install and run Apache server on Talisker


Go to start button and then to Programs Select Middlesex Software Then select A-Z Then choose SSH (Secure Shell)

How do you Install and run Apache server on Talisker


You will be presented with a user interface, use this to logon to the Apache Server
(When working from home you can use putty)

When presented with a new window Choose File then Connect (Note do not use quick connect) You will be presented with a new window

How do you Install and run Apache server on Talisker


Hostname:

Username:

Portnumber: 22

How do you Install and run Apache server on Talisker


The hostname you need to enter is: Talisker.mdx.ac.uk You must then enter your user name Do not change the portnumber. On connection you will be presented with a public key which you must accept. And you are in.

How do you Install and run Apache server on Talisker


You will now have a command prompt window. Check your directory. What command will you use? ls pwd how do you go back to your root? cd / how do you view contents of your directory? ls

How do you Install and run Apache server on Talisker


change directory and go to the temporary directory cd tmp view the contents of this directory now create a new folder in this directory giving it your username mkdir username go back to the root cd /

How do you Install and run Apache server on Talisker


view contents of the root. What command will you use? Go to the directory mdx cd mdx Check contents using ls Go to the directory modules cd modules Check contents using ls

How do you Install and run Apache server on Talisker


Find CCM2424 Goto CCM2424 using cd CCM2424 Check contents, find apache folder Go into this folder Then check contents Check presentation with ls l

How do you Install and run Apache server on Talisker


You are now going to copy the apache folder into the directory you created. Go back to the root which command will you use for this? Check the contents to make sure Change to the temporary directory and then into the directory you created

How do you Install and run Apache server on Talisker


At each stage check the contents Once you are in the directory you created you are ready to copy the apache folder cp r /mdx/modules/ccm2424/apache/ /tmp/username Check contents of your directory

How do you Install and run Apache server on Talisker


Change into the apache folder and check contents using ls l unzip the folder apache tar.gz gzip d apache_1.3XX.tar.gz What does zip do? How will you know if zip or unzip command has been successful?

How do you Install and run Apache server on Talisker


You now need to untar the file tar xvf filename now go into the apache directory look at the readme file use cat readme.configure to configure you need to replace the uppercase PREFIX with your pathname $ ./configure --prefix=/home2/studentid/apache /home/ferdinand1/tmp/apache/bin/apachectl start

How do you Install and run Apache server on Talisker


| You now have successfully built and installed the | | Apache 1.3 HTTP server. To verify that Apache actually | | works correctly you now should first check the | | (initially created or preserved) configuration files | | | | /home/ferdinand1/tmp/apache/conf/httpd.conf | | | and then you should be able to immediately fire up | | Apache the first time by running: | | | | /home/ferdinand1/tmp/apache/bin/apachectl start | | | Thanks for using Apache. The Apache Group | | http://www.apache.org/

How do you Install and run Apache server on Talisker


283 ls 284 cd ccm2424 285 ls 286 cd .. 287 cd .. 288 cd .. 289 pwd 290 ls 291 cd ~ 292 pwd 293 ls 294 mkdir tmp 295 cd tmp 296 ls 297 cp -r /mdx/modules/ccm2424/apache/ . /

How do you Install and run Apache server on Talisker


297 cp -r /mdx/modules/ccm2424/apache/ . 298 ls 299 cd apache 300 ls 301 gzip -d apache_1.3.20.tar.gz 302 tar -xvf apache_1.3.20.tar 303 cd apache_1.3.20 304 ls 305 ./configure prefix/home/ferdinand1/apache 306 pwd 307 ./configure /home/ferdinand1/tmp/apache 308 pwd 309 ./configure prefix/home/ferdinand1/tmp/apache 310 more readme.configure 311 ls

How do you Install and run Apache server on Talisker


312 313 314 315 316 317 318 319 320 321 322 323 324 325 more README.configure ./configure --prefix=/home/ferdinand1/tmp/apache more README.configure make make install /home/ferdinand1/tmp/apache/bin/apachectl start top ls cd conf ls cd .. ls /home/ferdinand1/tmp/apache/bin/apachectl start top

How do you Install and run Apache server on Talisker


326 /home/ferdinand1/tmp/apache/bin/apachectl start 327 ps -aux | more 328 /home/ferdinand1/tmp/apache/bin/apachectl start 329 ps -aux | more 330 ls 331 cd conf 332 more httpd.conf-dist 333 ./ex.php 334 emacs ex.php 335 ls 336 ls -l 337 chmod u+x ex.php 338 ./ex.php 339 cat ex.php

How do you Install and run Apache server on Talisker


340 341 342 343 344 345 346 347 348 ls rm ex.php ls cat access.conf-dist ls httpd.conf-dist more httpd.conf-dist ls more httpd.conf-dist-nw

http://www.apache.org/

How do you Install and run Apache server on Talisker


349 clear 350 ls -l 351 cd tmp 352 ls 353 pwd 354 mv apache/ /home/ferdinand1/ 355 cd 356 ls -l 357 cd tmp 358 ls 359 ccd 360 cd 361 rm -r tmp/ 362 ls l

How do you Install and run Apache server on Talisker


363 rm -r bin 364 rm -r src 365 ls -l 366 cd apache/ 367 ls 368 ls -l 369 pwd 370 clear 371 cd /tmp 372 ls 373 mkdir ferdy 374 pwd 375 ls 376 cd ferdy 377 cd

How do you Install and run Apache server on Talisker


378 pwd 379 cd / 380 pwd 381 ls 382 ls -l 383 384 clear 385 ls 386 cd tmp 387 ls 388 cd ferdy 389 pwd 390 ls 391 cp -r /home/ferdinand1/ /tmp/ferdy

How do you Install and run Apache server on Talisker


392 pwd 393 ls 394 cd ferdinand1/ 395 ls 396 mv apache/ /tmp/ferdy 397 pwd 398 cd .. 399 ls 400 rm -r ferdinand1/ 401 ls 402 pwd 403 cd apache/ 404 ls 405 rm -r apache_1.3.20 406 rm -r icons/

How do you Install and run Apache server on Talisker


407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 rm -r libexec/ rm -r man rm -r logs rm -r include/ ls rm -r proxy/ rm -r ht rm -r htdocs/ rm -r conf/ rm -r bin ls rm -r cgi-bin/ ls gzip apache_1.3.20.tar ls

How do you Install and run Apache server on Talisker


422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 ls -l cd ls rm apache/ rm -r apache/ ls rm ex.php ls clear cd /tmp/ferdy ls cd apache/ ls ls -l gzip -d apache_1.3.20.tar.gz

How do you Install and run Apache server on Talisker


437 ls -l 438 tar -xvf apache_1.3.20.tar 439 ls -l 440 cd apache_1.3.20 441 ls -l 442 ls 443 cat README.configure 444 clear 445 ls 446 ./configure --prefix=/home/ferdinand1/apache 447 make 448 make install 449 pwd 450 cd 451 pwd

How do you Install and run Apache server on Talisker


<?php $dbhost = 'localhost'; $dbuser = 'student'; $dbpass = 'ccm2092'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die $dbname = 'ccm2092'; mysql_select_db($dbname); $result = mysqlquery("Select * from beers",$dbname); echo "<html>"; echo "<head><title>PHP mySQL test</title></head>"; echo "<table> ;

('Error connecting to mysql');

How do you Install and run Apache server on Talisker


while($myrow = mysql_fetch_array($result)) { echo "<tr><td> echo "name : " . $myrow["name"]; echo "country : ". $myrow["country"]; echo "rating : ". $myrow["rating"]; echo "price : ". $myrow["price"]; echo "<td></tr>"; } echo "</table>"; echo "</html>"; ?>

Vous aimerez peut-être aussi