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:

su –l

zypper in apache2 apache2-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:

rcapache2 start

chkconfig –a apache2

w3m localhost ( use q to quit the browser )

 

 

 

 

The default website should simply display “It works!”
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:

mkdir –p /install/11-4

 

Then with the DVD mounted we will copy its contents into the 11-4 directory

rsync –arv /media/openSUSE-DVD-i586-Build0024/ /install/11-4

 

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.

Apache on OpenSUSE

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.


Apache on OpenSUSE

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.

Apache on OpenSUSE

 

  • Alias /opensuse11-4 /install/11-4/ : This is saying that we are creating a new alias, we will enter the url: http://ourserver/opensuse11-4/ and we will be redirected to the file-system directory /install/11-4

  • <Directory /install/11-4/> : This open the properties for the actual directory that we are pointing to with the alias

  • Options +Indexes : This add an additonal option to the deafults set by the webserver for this directory. The Indexes option allows for directories without index.html pages. The server will give a directory listing instead. We need this for the installation server

  • Order allow,deny : this is a normal setting for a directory however strange. We deny every network except those in our allow list. The allow list follows and allows all.

  • Allow from all : As mentioned above this is our allow list and we “allow all” networks. We could set something like Allow from 172.17.0.0./16 to restrict it the network that my server is on

  • </Directory> : We close the directory properties.


Now that we have the configuration in-place we need to restart the apache server and test

 

p>rcapache2 restart
w3m localhost/opensuse11-4/


 

Apache on OpenSUSE

We should see this, remember the Indexes options allows for the directory listing if no index.html file exits:

Apache on OpenSUSE

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.

Apache on OpenSUSE

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.

Apache on OpenSUSE

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.