Installing Apache on OpenSUSE |
Desktop - OpenSUSE |
What we will look at 1. Installing the Apache Web Server on openSUSE 2. Configuring Apache with a virtual directory alias 3. Testing an installation across the network
We can install the Apache Server by using the YaST Plugin, yast2-http-server. This is simple and installs the Server then takes us straight into the configuration. We would, though, have to install the plugin in the first place and then the configuration allows me only a fraction of what can be done from the command line. There is also a YaST module that will set up and installation server for you but you would not learn too much using it. So, for the benefit of learning and deeper understanding, we will take the manual approach and install and configure the server from the command line. We will need the apache server and the example pages:
The su command will give us root privileges and then we use zypper install (in) to add the packages apache2 and apache2-example-pages. This will, in fact, install more packages than just the two mentioned, the others are all dependencies. The example pages will give us a welcome page for our site. As a quick test we can start the web server, set it to auto-start and use the command line browser, w3m, to view the site:
The default website should simply display “It works!” Now if you can see the page above then you can pat yourself on the back and take a well earned coffee break.
Configuring Apache with a virtual directory alias Now we need to add the openSUSE install DVD to our server and then make it available to Apache. First we will create a directory structure to hold the DVD and perhaps others at a later time:
Then with the DVD mounted we will copy its contents into the 11-4 directory
I use rsync as it can be reliably restarted if required or run again to double check all files were copied in full. Your DVD label in the media directory may differ from the example here. The directory /install we now wish to make available to the apache webserver. The webpages are normally stored in /srv/www/htdocs. As we have not put the install files there we need to setup a virtual directory to point the webserver to this using an alias. To set this up we first must understand a little about the configuration files in openSUSE for Apache. They are found in /etc/apache2. The main configuration file is /etc/apache2/httpd.conf. Some Linux distributions use just this file with all configurations in the one file. openSUSE splits the configurations in to many smaller, more manageable files. Essentially the httpd.conf has nothing but “include” statements. The good thing about this is that we just need to go the /etc/apache2/conf.d directory and create a new file that has .conf as its extension. As we can see from the graphic, on openSUSE, the apache configuration is made from many files not just the httpd.conf. The conf.d directory is empty by default and include your own optional configurations such as directory alias as that we need, the vhosts.d directory will be for virtual hosts if needed on your system. We will create a file in /etc/apache2/conf.d called install.conf. It has to be .conf. Of course you will need to use a test editor. I use “vi” but you may prefer kate or gedit if you are not used to command line editors. The file will look like this and I wil explain the contents.
We should see this, remember the Indexes options allows for the directory listing if no index.html file exits: Testing an installation across the network Now the real testing must begin. We would like to install another machine with openSUSE using this installation source. We should have DHCP up and running from previous BeginLinux articles in this series. If you haven’t please refer back to the correct article to get you started with DHCP on openSUSE. We will boot from the installation DVD because currently as we have not set-up PXE boot, another article to follow will cover PXE. Booting from the installation DVD is required to give us connectivity to the Installation Server. Once connected to the server the DVD can be ejected and moved to another machine if required. When we are presented with the first boot screen from the DVD we select the installation option BUT before we hit enter we add the following boot options: install=http://172.17.1.1/opensuse11-4/ (replace with your server ip or name). There is a menu you can access by using the F4 key but there is less to type this way and with so little input anyway, why would we want a menu? It is there should you want you use it. Now the installation will start. If we hit ESC just after we having entered for the install we can see the background tasks loading the installation. We will see drivers loading, a DHCP request and then the install files loading from the network. The installation will then run as normal and this installation source is retained on the system so any additional software can be obtained from this server rather than the DVD or external sources. So well done, we now have an installation server and know a little about the configuration of Apache, the world’s most used web server. One of the reasons for not using the menu when we typed in the path to the installation server is that we need to know what to type if we are to automate this through a network boot, PXE, which we shall look at in another article. We will pass these boot option to the installation program as we did here but without the user input, menu or otherwise so check back to www.Beginlinux.com soon for updates. |