1. Trang chủ
  2. » Công Nghệ Thông Tin

Networking: A Beginner’s Guide Fifth Edition- P77 pdf

5 164 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 5
Dung lượng 134,51 KB

Nội dung

362 Networking: A Beginner’s Guide 3. Unzip the gz file using the following command (substitute the actual filename of the file you downloaded): gunzip filename.tar.gz 4. Untar the resulting .tar file with the following command (substituting the ac- tual filename found in the directory after performing step 3; you can use the ls command to see its name): tar -xvf filename.tar 5. The tar command in step 4 creates a directory that has the same name as the name and version portion of the tar file. Change to that directory, as follows (change the command to match your downloaded version): cd /httpd-2.2.3 6. Run the Apache configuration script by entering the following command (it will take only a few seconds to run): ./configure 7. Now you need to prepare the binaries by compiling them. This takes two com- mands, each of which might take several minutes to complete: Make make install 8. At this point, Apache is installed but not yet running. To start Apache, execute the following command from any directory: /usr/local/apache/bin/apachectl start To test your Apache installation, you can use the ps command to verify that the daemons are running: ps -e |more The ps command will display all running processes. Because the preceding command pipes the output of ps -e through the more command, you might need to press the spacebar a number of times to see all of the running processes. In the output, you should see one or more copies of a process called httpd, which is the Apache daemon. You might see many of these processes, because Apache usually starts a number of them, depending on the computer on which you have installed Apache, but this is perfectly normal. After you’ve verified that Apache has started, you can also test it using a web browser. Enter either of the following web addresses: http://127.0.0.1 http://localhost 363 Chapter 22: Setting Up a Linux Web Server with Apache Both of these commands access any running web server on the computer on which they are used. (Remember that the address 127.0.0.1 is always shorthand for the local computer, as is the name localhost.) You should also be able to access the page from another computer. Assuming that the computer on which you installed Apache has an IP address of 209.200.155.49, the following web address should bring up the page: http://209.200.155.49 If you cannot access the page from a remote computer, but can on the local computer, you should check basic IP connectivity using the PING command and typical network troubleshooting techniques. It’s also possible that you have a firewall running on the machine with Apache on it, and the firewall is preventing access. Administering Apache Web Server You will need to perform a number of basic administrative tasks on an Apache server, not the least of which is publishing a web site onto your newly installed Apache web server. This section briefly describes basic administrative tasks. Stopping and Starting Apache You use a script file called apachectl to start and stop the server. For a default Fedora installation, the apachectl file is located in the /usr/sbin directory and takes three main parameters: start, stop, and restart. For example, the following command will restart the server: /usr/sbin/apachectl restart Changing the Apache Configuration As mentioned earlier in this chapter, Apache is essentially controlled through text-based configuration files, the main one of which is called httpd.conf. The httpd.conf file is located in the /etc/httpd/conf/ directory. The httpd.conf file works through the use of plain-text directives contained in the file, along with the associated settings. For example, the following directive defines where Apache is installed: ServerRoot "/etc/httpd" If you wanted to move the Apache installation to a different directory on your Linux computer, you could certainly do so, but you would want to be careful to change the ServerRoot setting before attempting to restart Apache in its new location. NOTE For any changes to the httpd.conf file to take effect, you must restart Apache using the apachectl restart command. 364 Networking: A Beginner’s Guide The httpd.conf file is divided into three main sections: N Global environment N Main server configuration N Virtual hosts Each of these sections contains a large number of directives that control how Apache works. When learning about Apache, you should spend some time studying the contents of the httpd.conf file and reading the extensive comments included in the file. You should also look up the various directives in the online Apache documentation (http://httpd.apache.org/docs/), to get more information than provided by the comments in the httpd.conf file. Publishing Web Pages By default (for Apache version 2), the main web site published by Apache is located in the /var/www/html directory, and this directory is blank. Once you are ready to publish a complete web site, you can place the files into /var/ www/html with the home page stored as index.html. The easiest way to do this is to connect to the computer running Apache by using the FTP program, and then upload the web site’s files, either directly to the /var/www/html directory or to a temporary directory on the server’s hard disk. Once in the temporary directory, you can move them to the correct location on the server itself using the mv or cp commands (these, among a number of other useful Linux/UNIX commands, are covered in Chapter 21). Chapter Summary Most networking professionals will need to set up and maintain a web server in the course of their work. All server platforms have web servers available for them. An excellent web server that is available for just about all platforms is the Apache web server. As you saw in this chapter, Apache is easy to install, administer, and get up and running. If you have followed the instructions in the previous chapters and have set up Fedora Linux on a test system, I recommend that you also follow the steps in this chapter and set up and run Apache. Then add some files for a simple web site to it and browse the web server first from the computer on which it’s running, and then from another computer on the network. This chapter was intended to get you started with the Apache web server. If this is an area in which you wish to gain greater expertise, you will find more details in resources devoted to Apache server. Two books in this area that might interest you are Apache Server 2.0: A Beginner’s Guide, by Kate Wrightson (McGraw-Hill/Professional, 2001) and Apache Server 2.0: The Complete Reference, by Ryan Bloom (McGraw-Hill/Professional, 2002). 365 Chapter 23 Introduction to Virtualization 366 Networking: A Beginner’s Guide O ne of the most exciting areas to develop in networking over the past several years is virtualization, which is a method of creating multiple virtual machines on a single computer. These virtual machines operate as if they were running on their own computer, and the computer’s actual resources—its processor, hard disk space, network connection, and other hardware—are virtualized so that they can be shared among the various virtual machines. This chapter introduces virtualization. It discusses some of the main benefits of virtualization, and then provides of an overview of Microsoft’s and VMware’s virtualization offerings. To get you started, the chapter walks you through a VMware Server installation, along with the setup of an Ubuntu Linux virtual machine. Benefits of Virtualization The ability to virtualize computers can pay rich dividends. The following are some of the chief benefits of virtualization: N More efficient use of server resources As noted in previous chapters, dedicating one server application per computer is the most reliable way to provide the services, and it’s more maintainable as well. However, you often will have server applications that don’t use that many server resources. For instance, you may have a web server that is used by 30 to 40 people within your organization on an occasional basis. With virtualization, however, you can run multiple virtual machines—all completely independent from one another—on a single server and more efficiently utilize the server’s resources. N Ability to run multiple operating systems on a single computer With virtualization, there is a host operating system, which is the operating system installed on the computer itself, and guest operating systems, which are the operating systems installed within each virtual machine. So you can, for instance, have a Windows Server 2008 host operating system installed on a computer, and then run operating systems like Windows XP, Ubuntu Linux, Windows Vista, or Sun Solaris within the virtual machines themselves. Or you can have Linux installed on a computer, and then have a variety of Linux and Windows operating systems running within virtual machines. You can even have no host operating system, and instead install what is called a hypervisor, which is a bare-bones operating system that just supports virtual machines. N Ease of moving virtual machines You can easily move virtual machines from one virtual server to another, in order to better manage and balance resources like disk space, RAM, and processor utilization. N Reduced power requirements You can reduce the energy required to run your IT infrastructure. By consolidating servers, your power requirements are reduced. . directory: /usr/local/apache/bin/apachectl start To test your Apache installation, you can use the ps command to verify that the daemons are running: ps -e |more The ps command will display all running. installed Apache web server. This section briefly describes basic administrative tasks. Stopping and Starting Apache You use a script file called apachectl to start and stop the server. For a. default Fedora installation, the apachectl file is located in the /usr/sbin directory and takes three main parameters: start, stop, and restart. For example, the following command will restart

Ngày đăng: 05/07/2014, 04:20