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.

1 comments

Wednesday, 13th February 2008 at 12:50pm

Some simple commands for Debian

I thought I should make a post so that I have something to check back to when I've forgotten some commands for stuff. Everything here is pretty basic, really and you should make an effort to remember them.

These commands are all case sensitive, as far as I've worked out.

cd – this changes the directory you're in. If you're logged in as your user (which you should be) then just typing the command will take you back to your home directory. At the moment that will be pretty empty. If you put a directory as a parameter after you write "cd", you'll go to that directory. For example, if you type "cd /etc/" you'll get taken to the /etc/ directory.

Terminology note for Windows users: Stop calling them "folders". You'll get laughed at. They're "directories" on Linux.

ls – (that's "L", but lower case, of course) this outputs all the things that are in the directory you're in. It doesn't output them very pretty, so instead you can do "ls -lh" and that will output the same thing, but each file is on its own line and you'll get some data about it. If you want to check what's in a directory you're not currently in, you can just add the directory path at the end.

su – sometimes you'll be in a situation where you need to be logged in as root. But I've already told you not to be in root all the time, and you should stick with that. "su" stands for "switch user". Just typing that command on its own will allow you to act as root for a little while. You'll be requested for root's password though. You can switch to other user's too, by putting their username after the command.

Remember, when you've finished, come back out of root by typing "exit".

nano – the default text editor on Debian (etch at least) is "nano". You can get to it by typing "nano", and you'll have a blank text editor. It's pretty low feature so don't expect to be cutting and pasting a lot at the moment. You can edit a file by putting its path after the command.

Don't go editing  things you don't understand though!

I'll add more later, but for now I've been using that linux help site I linked to earlier.

1 comments

Read some previous entries