Playing with Debian

Wednesday, 13th February 2008 at 09:49pm

Installing Apache2 (and other packages follow the same technique!)

The first thing I did when I had time was try to install Apache. When I say try, I do mean try. I'd been using my Debian for just a few minutes and so quickly realised I didn't know where to start. I quickly ran to the Apache homepage but that wasn't too much help. In the end I managed to find a Debian using friend, who I now owe a lot of delicious cake.

You'll need to be logged in as root to do most of this.

First thing first was to update our catalogue of packages. If your host is like Redwood then you won't even have a catalogue just yet. Either way, you do the same thing. "apt-get update" which will do what we need.

Terminology note for Windows users: "Packages" is just another name for program, as far as I can tell. So is "libraries" and possibly "binaries".

The update may take a little while so give it a chance. By "a little while" I mean that in respect to a server, which is pretty damn quick for us. Once it's complete, you'll be told. Then make sure that all the things that are already on your LVS are up-to-date, using "apt-get upgrade". Since I was using etch, it was already stable and so all that was upgraded was security things. It may ask you to restart your server, but you won't have to close PuTTY or anything. If it doesn't do it itself, type "reboot". PuTTY will give you an error about losing the connection and the title for the program will change to "PuTTY (inactive)". Right click it in the start bar, and start a new session.

Once that has been done, you can search for Apache. You can do that by typing "apt-cache search apache".  That will search through the catalogue and find all the packages with the word Apache in its name or description. There's a lot there, and we really don't need most of them. To narrow down your search you can add a pipe. So now your command will look like this:

apt-cache search apache | grep ^apache

In case you don't know, that pipe is the key next to shift. What it does is take the output from the first function, and give it to the second. grep is a regular expression function that only returns things that match what you've given.

You'll get a shorter but still long list. Depending on what you're used to, you're looking for "apache" or "apache2". I'd recommend apache2.

To get it, you can type "apt-get install apache2" and that'll start the download. It'll also say something to the effect of "Apache needs other packages to run, install them now?" Type 'y' for yes, and it'll do those too.

If you go to your IP address now, or your domain name if you've set one up, you'll see the "Apache is configured properly" screen. Smile for a bit at your own brilliance, remembering how damn hard that was to do whilst using a Windows machine.

The default directory for your web pages to go is "/var/www/". At the moment, only root will be able to edit files in there, but I'll talk about how to change that later. The httpd.conf you're used to is located in "/etc/apache2/", but it isn't really used any more – I'll look into why later. Pretty much the same file is now stored in the apache2.conf file, and in the 000-default file of /sites-enabled/ directory. You can edit either of them with nano.

Comments

Your name: Your URL:

Body:

User comments

Andrew McKay says:

'Packages' and 'binaries' are fairly interchangeable. Technically 'binaries' are the executables (stuff that in windows would have a .exe on the end) whilst packages are exactly what they sound like - a package containing something. A 'binary package' will contain the program executables plus anything else the program needs to run (but not dependencies, of course) whilst a 'source package' will contain the uncompiled source code to allow you to change stuff and to compile it yourself. Libraries are slightly different. They're akin to .dll files in windows. They contain a bunch of programming functions which can be used by different programs to accomplish common tasks.

Read some previous entries