Linux Webserver Installation Command and GUI.ppt


Published on

1 Like
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Linux Webserver Installation Command and GUI.ppt

  1. 1. Chapter Apache Installation on Linux
  2. 2. Acknowledgement <ul><li>The contribution made by Darrin Morison is acknowledged </li></ul>
  3. 3. <ul><li>Demonstrate a basic installation and setup of an Apache Web Server on a PC running the Linux OS. </li></ul>Chapter Objectives
  4. 4. Chapter Modules <ul><li>Apache Web Server installation </li></ul>
  5. 5. Introduction to Apache <ul><li>Apache is a web server package that works under Linux as well as under other operating systems </li></ul><ul><li>The name Apache comes from the concept of extensive patching of existing code </li></ul><ul><li>The primary advantage of Apache is that it is generally free or available at modest costs </li></ul>
  6. 6. Apache Server Installation <ul><li>Download newest version of Apache </li></ul><ul><ul><li>May be installed from a CD-ROM as well </li></ul></ul><ul><li>Unzip downloaded file </li></ul><ul><li>Untar the tar file </li></ul><ul><li>Create the MAKE files </li></ul><ul><li>Make Install </li></ul><ul><li>Edit httpd.conf file </li></ul><ul><li>Start Apache Server </li></ul>
  7. 7. Installing Apache From a CD-ROM <ul><li>If your CD-ROM has Apache and you want to use RPM to install the package, issue this command </li></ul><ul><ul><li>rpm –i apache_1_3_4.rpm </li></ul></ul><ul><ul><li>(substitute the full name of the Apache package) </li></ul></ul>
  8. 8. Downloading the newest Apache <ul><li>First, in Linux, create a folder to hold the Apache file you will download. </li></ul><ul><li>The newest version of Apache Server and Documentation can be found at The Apache Software Foundation </li></ul><ul><li>To download the newest version of Apache go to and click on apache_1.3.12.tar. gz . </li></ul><ul><li>Download this file into your newly created directory. </li></ul><ul><li>NOTE: apache 1.3.12 is the latest version at the time of this writing. You may want to check for newer releases. </li></ul>
  9. 9. Unzipping Downloaded File <ul><li>After you have downloaded your Apache file go into the folder you have downloaded it into by typing cd /path to folder/name of folder/. </li></ul><ul><li>Next, to unzip the .gz file at the prompt type: gunzip apache_1.3.12 </li></ul><ul><li>and press the enter key. </li></ul><ul><li>This will unzip the file into the current directory. </li></ul>
  10. 10. Untarring the TAR file <ul><li>After unzipping the .gz file the resulting file will be a .tar file. (Which stands for tape archival) </li></ul><ul><li>You will need to untar this file by typing at the prompt: tar –xvf apache_1.3.12 and press the enter key. </li></ul><ul><li>This will untar the file to a new directory named apache_1.3.12 </li></ul>
  11. 11. Creating the Make Files <ul><li>Go into the folder that now contains the untarred apache files. To change into that folder, at the prompt type: cd /<path to folder>/apache_1.3.12. </li></ul><ul><li>Once you are in the apache_1.3.12 folder you will need to create the apache make files. </li></ul><ul><li>To do this, at the prompt type: </li></ul><ul><li>./configure --prefix=/usr/local/apache and press the enter key. This will install apache in the folder /usr/local/apache. </li></ul><ul><li>You may chose to install in another directory. </li></ul>
  12. 12. Compiling Make Files <ul><li>After running the configure command you will need to compile the make files. </li></ul><ul><li>To compile the make file, from inside in the apache_1.3.12 directory, at the prompt, simply type: make </li></ul><ul><li>and press the enter key. </li></ul>
  13. 13. Running the Make Install <ul><li>Next you must run the make install. </li></ul><ul><li>While still in the directory apache_1.3.12, at the prompt, type: make install </li></ul><ul><li>and then press enter. </li></ul><ul><li>This will install the apache server to the directory defined in the configure command. </li></ul>
  14. 14. Editing the httpd.conf File <ul><li>In order to get the apache server started you must edit the httpd.conf file. The file is located in whatever directory you installed apache in. </li></ul><ul><li>Once in your apache install directory find the folder named conf. </li></ul><ul><li>Change into the conf folder and locate the file named httpd.conf. </li></ul><ul><li>Open the httpd.conf file with any file editor. </li></ul><ul><li>Next locate the line # ServerName <Name> and uncomment out this line by deleting the # symbol preceding ServerName. </li></ul><ul><li>Save the file and close it. </li></ul>
  15. 15. Starting, Stopping and Restarting Your Apache Server <ul><li>To start your Apache server you must either put the location of the directory, where your Apache server is installed, in you PATH environment variable or you must change into your Apache directory and at the prompt type: apachectl start and press return </li></ul><ul><li>If the path to your Apache install directory is already in your PATH environment variable, then you can type: apachectl start to start your apache Server from anywhere within your environment. </li></ul>
  16. 16. Starting, Stopping and Restarting Your Apache Server (cont.) <ul><li>To stop your Apache Server, from inside the directory where your Apache is installed, type: apachectl stop </li></ul><ul><li>and press enter. </li></ul><ul><li>To restart your Apache Server, from the directory where your Apache is installed, type: apachectl restart </li></ul><ul><li>and press enter. </li></ul>
  17. 17. Testing Your Apache Installation <ul><li>After you have installed and started your Apache server you can test to if everything is running OK by doing the following… </li></ul><ul><li>Start a browser application. </li></ul><ul><li>If you installed Apache as root, type in the address bar of your browser the name of your computer and press enter. </li></ul><ul><li>If you installed Apache as a user, type in the address bar the name of the computer followed by a colon and then 8080. For example…. </li></ul><ul><li>your_computer_name:8080. </li></ul><ul><li>8080 is the default port for user and 80 is the default port for root. </li></ul>
  18. 18. Testing Your Installation (cont.) <ul><li>If everything has gone as it should have you should see a page with the apache logo at the top explaining why you are seeing this page. This page gives you links to all the apache documentation which you should read. </li></ul><ul><li>If you would like to customize this index page it is called index.html.en in the htdocs directory located in the directory your Apache server is installed. </li></ul>(source: http://
  19. 19. Apache Installation is Finished! <ul><li>The basic installation of the Apache server is finished. </li></ul><ul><li>There is much more to an Apache server customization. You should then read the documentation provided with your release to become more familiar with your Apache setup. </li></ul>
  20. 20. Setting Up the Website <ul><li>Create the home directory for the website, we will use /usr/www/ganesan </li></ul><ul><li>Create 3 subdirectories under the site directory </li></ul><ul><ul><li>conf </li></ul></ul><ul><ul><li>htdocs </li></ul></ul><ul><ul><li>logs </li></ul></ul>
  21. 21. Setting Up the Website (con’t) <ul><li>You will find a subdirectory called conf under the directory where you installed Apache </li></ul><ul><ul><li>Copy 3 files (srm.conf-didst, access.conf-dist, http.conf-dist) from this directory into /usr/www/ganesan/conf </li></ul></ul><ul><ul><li>If you cannot find the 3 files, use the find command to find them </li></ul></ul>
  22. 22. Setting Up the Website (con’t) <ul><li>Rename the 3 files you just copied to drop the “-dist” portion of the name </li></ul><ul><li>Edit the httpd.conf file to specify </li></ul><ul><ul><li>the port number on which your web server responds </li></ul></ul><ul><ul><li>the user running the httpd daemon, etc… </li></ul></ul><ul><li>Specify the server name </li></ul><ul><ul><li>ServerName </li></ul></ul>
  23. 23. Setting Up the Website (con’t) <ul><li>Add a line that specifies the root directory for your website </li></ul><ul><ul><li>DocumentRoot /usr/www/ganesan/htdocs </li></ul></ul><ul><li>Edit the srm.conf file to set up the web home directory and any special internal command usage </li></ul><ul><li>Edit the access.conf file to set a basic set of access permissions </li></ul>
  24. 24. Setting Up the Website (con’t) <ul><li>In the htdocs directory create an HTML file for the server to read when it starts </li></ul><ul><ul><li>This can be any HTML file </li></ul></ul><ul><ul><li>The filename should be default.html </li></ul></ul><ul><li>Start the httpd daemon </li></ul><ul><ul><li>httpd –f /usr/www/ganesan/conf </li></ul></ul>
  25. 25. Setting Up the Website (con’t) <ul><li>Test the web server by starting a browser and specify the URL </li></ul><ul><li>If the system is working properly, you will see a screen with a list of files in the htdocs directory </li></ul>
  26. 26. Server Configuration
  27. 27. Server Configuration <ul><li>Make sure the ServerType directive is set to “standalone” </li></ul><ul><li>Check the Port device to make sure it is set to the TCP/IP port to which your Apache server listens </li></ul><ul><li>Set the User directive to either the user ID (UID) or the user name used for all web visitors </li></ul>
  28. 28. Server Configuration (con’t) <ul><li>Set the Group directive to either the group ID (GID) or the group name assigned to all web users </li></ul><ul><li>Modify the ServerAdmin directive to include the e-mail address of the administrator </li></ul><ul><li>Set the ServerRoot directive to the absolute path to the directory where all Apache resource and configuration files are stored </li></ul><ul><ul><li>/usr/apache/conf or /etc/httpd </li></ul></ul>
  29. 29. Server Configuration (con’t) <ul><li>Set the ServerName directive to the fully qualified domain name of your server </li></ul>
  30. 30. Starting and Stopping Apache
  31. 31. Starting and Stopping Apache <ul><li>If you are running Apache as a standalone server, you need to start and stop Apache manually </li></ul><ul><ul><li>Start with httpd –d rootdir –f configs </li></ul></ul><ul><ul><li>To stop Apache use ps to detect the httpd daemon’s PID and use the kill command to terminate the process </li></ul></ul>
  32. 32. A Note on Starting and Stopping Apache <ul><li>Later versions of Apache include a script that does the start and stop tasks for you </li></ul>
  33. 33. Chapter Apache Installation in Linux-Mandrake
  34. 34. Acknowledgment <ul><li>The following information has been obtained directly from </li></ul><ul><li>All credit it due to the above </li></ul>
  35. 35. Linux Unix Windows Linux: Where Unix meets Windows GUI based approach to Apache installation.
  36. 36. Apache Configuration Using KDE <ul><li>In this section, Apache will be configured using the available tools and utilities of the KDE desktop. This is not necessarily a recommended way to run a web server, but it does offer a convenient environment to begin learning the first steps of running a web server in the safety of an internal LAN. </li></ul>
  37. 37. Checking for Already Installed Apache
  38. 38. Using ktail to Monitor Installation <ul><li>Alt-F2 will open a mini-command line in KDE, and kdesu -c ktail will launch ktail as the root user. Ktail will be used throughout the following pages to monitor Apache's log files during configuration </li></ul>
  39. 39. Launching ktail to Monitor the Installation Alt F2 opens a mini command line
  40. 40. Providing root Password
  41. 41. Accessing the Service Activity
  42. 42. Activating the httpd Service
  43. 43. Starting Stopping and Restarting Apache
  44. 44. Monitoring Start, Stop and Restart
  45. 45. Accessing the Web
  46. 46. Accessing the Web Server Using Localhost
  47. 47. Gain Access as Super User to root
  48. 48. Root Folder(File)
  49. 49. Location of Apache Files
  50. 50. Bookmark the Location
  51. 51. Location od Web Files
  52. 52. Renamed Index.html
  53. 53. Loading Your Own Web <ul><li>A web can now be stored in this folder to become the website on the Apache server </li></ul><ul><li>Index.html will be the first file that would be accessed first </li></ul>
  54. 54. KDE File Manager as a Limited Web Browser
  55. 55. Accessing the Website from Other Machines Use IP Address
  56. 56. Location of Logs
  57. 57. Drag and Drop Logs into ktail for Viewing
  58. 58. Other Details in Error Log
  59. 59. Event Details <ul><li>Date and time of event </li></ul><ul><li>What type of event </li></ul><ul><li>The event itself </li></ul>
  60. 60. Other Details in Access Log
  61. 61. Other Details on Access Log <ul><li>• The machine's name or IP address that accessed the server </li></ul><ul><li>• Date and time of access • The file that was transferred • An access code and the number of bytes transferred • The server's name or IP address that was requested • The web browser that was used • And some info about the visitor's system </li></ul>
  62. 62. Location of conf Files A copy has been made of the conf files folder
  63. 63. Making a Copy of the Conf Files <ul><li>/etc/httpd/conf is where Apache's configuration files are located. You may want to first make a backup copy of the original configuration directory before making edits to the enclosed files. Ctrl-t opens a konsole in the current directory, and cp -r conf confOrigBackup recursively copies the folder & contents with a new name. </li></ul>
  64. 64. Locating Apache’s Main httpd.conf File
  65. 65. Editing httpd.conf Using Kedit
  66. 66. Disabling Some Kedit Options Before Saving Changes to httpd.conf
  67. 67. Section1: Modules
  68. 68. A Note on Modules <ul><li>This first section of Apache's configuration file deals with modules . Modules add extra capabilities to Apache that aren't normally included in its basic set of features. If you install Mandrake's RPM modules for Apache you most likely won't ever need to manually enter any module information yourself, as the required entries will automatically be added with the packages. </li></ul><ul><li>continued </li></ul>
  69. 69. php3 Module: An Example <ul><li>mod_php3 is a module that enables this popular scripting language to be used with Apache. If mod_php3 is installed on your system, you can test it by creating a simple test page as seen on the next page </li></ul>
  70. 70. Creating index.php3 for Testing of php3 Support
  71. 71. Testing for php3 Support
  72. 72. Success in Testing for php3 <ul><li>You can test Apache by loading the page into Netscape. If php3 wasn't enabled properly, a screen of raw text would appear instead of a normal looking web page as seen here. </li></ul>
  73. 73. A Note on Testing for php3 <ul><li>This is just a quick way to demonstrate if php3 is enabled on a server. php3 is a full-featured, HTML-embedded scripting language used for creating dynamically generated web pages. One common use of php3 is as a replacement for CGI scripts. Unfortunately this topic can't be covered in detail on these pages. For more info on php3, phpbuilder is a good starting point. </li></ul>
  74. 74. Location of Web Documents (Root)
  75. 75. Document Root <ul><li>The document root is where the web pages of the active website are kept </li></ul><ul><ul><li>Similar to the home directory of the www server in Windows </li></ul></ul>
  76. 76. Display of Directory Listing
  77. 77. Absence of index File <ul><li>A directory listing is displayed as shown in the previous slide in the absence of an index file </li></ul>
  78. 78. Activating Configuration Changes <ul><li>After every configuration change Apache must be restarted </li></ul><ul><li>It is usually a good practice to make one change at a time and then check ktail to ensure that the change had been made without any errors before proceeding to make the next change </li></ul>
  79. 79. Starting, Stopping and Restarting Apache <ul><li>Commands </li></ul><ul><ul><li>apachetl start, apachetl stop, apachetl restart </li></ul></ul><ul><li>GUI </li></ul><ul><ul><li>Apache may also be started, stopped and restarted through the control services GUI </li></ul></ul><ul><ul><ul><li>Access the httpd service for this purpose </li></ul></ul></ul>
  80. 80. Redirecting 404 and Other Error Messages
  81. 81. Viewing of Serve Status Other IP addresses may be specified for viewing of server status from other machines.
  82. 82. Display of Server Status From a different machine.
  83. 83. Server Type and Port Numbers
  84. 84. Note on Server Type and Port Numbers <ul><li>Standalone is recommended for server type </li></ul><ul><li>Information on port numbers can be found in /etc/services </li></ul><ul><li>Users do not have to enter a port number on the address if default port numbers are maintained </li></ul><ul><ul><li>Example is Port 80 used for www service </li></ul></ul>
  85. 85. Phantom User Nobody <ul><li>Apache runs as a phantom user known as nobody with very limited access </li></ul><ul><li>Anyone exploiting this name to gain access to Apache will severely be restricted from causing any damage </li></ul>
  86. 86. Phantom User
  87. 87. Location of Apache Configuration
  88. 88. Server Name
  89. 89. A Note on Server Name <ul><li>Server name is the one seen by the browsers in the filed “location name” </li></ul><ul><li>For hosting a name accessible over the Internet, the name must have been registered and it must have a DNS entry on a DNS sever </li></ul><ul><li>Server name need not relate to the machine’s host name </li></ul>
  90. 90. Access to Local Host Name
  91. 91. Adding a Host Name
  92. 92. The New Name
  93. 93. A Note on Changing Name <ul><li>In general, changing host names should be avoided </li></ul><ul><li>Certain services are configured based on the host name and they may not function properly after changing the name of the host </li></ul>
  94. 94. Permissions on Folders
  95. 95. Access Given to Folders Permission given to others.
  96. 96. Right Clicking on Folders to Give Permission
  97. 97. Changing Permissions <ul><li>Show entries and change into commands will give public to enter the folder and view its contents </li></ul>
  98. 98. Summary <ul><li>Windows users may still use some of the techniques learned to configure and operate Linux operations </li></ul><ul><li>However, some command line programming is still inevitable </li></ul><ul><li>In the long run, more GUI based operations is likely to be introduced in Linux </li></ul>
  99. 99. Giving Permission using the chmod Command
  100. 100. Virtual Hosting
  101. 101. Virtual Hosts <ul><li>A virtual host is a web server that resides on one domain but acts as if it was on another. For example, suppose you control and Instead of setting up 2 servers, you can set up a single machine that serves both domains. </li></ul><ul><li>Virtual hosting saves on machinery and allows for a lot of flexibility in setting up web servers </li></ul>
  102. 102. Setting Up Virtual Hosting <ul><li>If your network uses a name server for DNS, modify it so that the domain name points to your web server for each domain you’ll host </li></ul><ul><li>Use the ifconfig command to set up the IP address for each domain on your server </li></ul><ul><ul><li>ifconfig eth0:1 </li></ul></ul>
  103. 103. Setting Up Virtual Hosting (con’t) <ul><li>Add the route to the network configuration using the route command </li></ul><ul><ul><li>route add –host dev eth0:1 </li></ul></ul><ul><li>Edit the Apache httpd.conf file to set up virtual hosting </li></ul><ul><ul><li><VirtualHost> </li></ul></ul><ul><ul><li>DocumentRoot /usr/www/cis454/htdocs </li></ul></ul><ul><ul><li>TransferLog /usr/www/cis454/logs/access </li></ul></ul><ul><ul><li>ErrorLog /usr/www/cis454/logs/errors </li></ul></ul><ul><ul><li></VirtualHost> </li></ul></ul>
  104. 104. Setting Up Virtual Hosting (con’t) <ul><li>The previous step defines the virtual host for and specifies its DocumentRoot, since each virtual host will have different web directories </li></ul><ul><li>If more than one virtual host is defined, the entries are to be repeated for each </li></ul>
  105. 105. End of Module
  106. 106. Apache Web Server Resources <ul><li>The Apache Software Foundation </li></ul><ul><li>This is the official Apache web site where you can find Apache Web Server documentation, the latest release for download, installation and setup instructions and much more. </li></ul><ul><li> </li></ul>