
Wednesday, 2nd April 2008 at 10:37am
We all know that Linux should be pronounced "lin (as in linen)-ux", thanks to the Wikipedia article on it, but the Debian wiki article isn't so kind.
I was at a friend's house the other day and he said "day-be-en". I've always said it as "deb-ee-en". How do you say it?
Sunday, 24th February 2008 at 07:21pm
We added a user before to use for ourselves, but I never really went into how to change your password or delete a user, or a lot of other things you can do.
To change your full username, use chfn -f newusername. You can change the other information you added too, just do a manual lookup to get them (man chfn).
You can change your password by using the passwd command. You'll have to put your old password in first, unless you're root, and then your new one.
You can also delete a user, using deluser usertodelete. Obviously, don't go deleting your own user.
Friday, 22nd February 2008 at 12:31am
If you're using mail functions on PHP after just installing it, you won't get any error message, even though the mail won't get sent yet. Don't worry, we'll fix that now.
Debian comes with Exim4 which is a mail server with a bunch of features. By default it's set to only send emails locally (to other users on your system). If you tried to send any emails to external users at the moment, you'll see something like "** www-data@debian R=nonlocal: Mailing to remote domains not supported" in your error logs.
We just need to reconfigure your Exim4 options, which you can do by typing the command "dpkg-reconfigure exim4-config". Then you'll get a screen, which you'll have to answer a few options. A lot of them are easy but they can be a bit off putting.
I don't think there's much reason to split configuration files (comment if I'm wrong). Your system mail name should be your URL, including the subdomain if that's where you've pointed your VPS. For instance, mine is "trinity.allroundnews.co.uk", so all email addresses will be 'user@trinity.allroundnews.co.uk'. Let the 'listener daemon' listen to all IPs, by just leaving it blank. Say no to 'Dial-on-Demand'. The 'Root and postmaster mail recipient' is basically the user that you want mail to 'root@trinity.allroundnews.co.uk' to be redirected to (since you shouldn't stay logged in as root). So for me, that's just 'shamess'.
If you've tried to send any mail so far, you'll want to remove it from the queue (sorry if it was important). Do that by getting up the mail queue (using the mailq command). Then you can remove mail by using the command Exim -Mrm <message id>. You can put as many message ID's in the list as you like, space separated. The message ID is the weird string that looks something like ’1JOJBI-0000ag-IH'. Yup, you have to type that.
I'll talk about actually reading mail later, but at least now you can send mail with PHP!
Thursday, 14th February 2008 at 05:42pm
I want to learn about file permissions. Yes, you heard me. I want to learn. I don't actually know much about them yet. Why am I doing an article about them if I don't know what they do, you might ask. And I'd have to reply, "good question. I don't really have an appropriate answer." Onwards?
Unix is a multiuser based operation system, like I mentioned before, so there has to be a way that it controls which files a user can look at. That's done with permissions. At the moment, your /var/www/ is going to be owned by www-user which is a user that Apache made when you installed it. Unless you log in as root, or that user you won't be able to edit or add files in there at the moment. Lets learn how to change that.
First, head to your into your /var/ directory, and then show the files with their data, (if you don't know how to do that, then you should read through a few of the posts I've tagged for commands.)
drwxr-xr-x 4 root www-user 1.0K Feb 12 22:38 www
You'll have something like that for your /www/ directory. The "drwxrwxr-x" is what we're interested in, since that tells us the permissions. The first letter tells us that it's a directory, then the rest are in blocks of three; the first block is for users, then groups, then others.
r means that they can read from that file or directory, the w means they can write to it, and the x is to execute it.
What I did was "chgrp -R shamess /var/www/" and that changed the group so that I was in it (the -R switch was to make all the files and directories inside it change too). Then I needed to give the group permission to edit the files; chmod g+w /var/www.
And that was it. Now you can edit files in your /www/ directory without having to be root.
There's a more detailed article on permission types and how they work over at FreeOS; Understanding Linux file permissions.
Wednesday, 13th February 2008 at 12:50pm
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.
Wednesday, 13th February 2008 at 02:04am
Now we have our virtual server and Redwood were nice enough to install Debian for us (because I've idea how). You wanna rush in a get going; I was literally bouncing around the house when I got my "your server is up and running!" email from them.
Of course, at the moment you've no idea how to connect to the server. The first thing you'll need then is PuTTY, if you're on a Windows machine like I am. So far, I've only found the need for the standard "putty.exe" so that's all I've got. It's a tiny application, and it's probably worth sticking it on a pen drive so you can take it with you everywhere, for those times when you just have to check on your baby <3
When you start it up you'll be given a huge list of daunting options. Don't worry though, if I'm completely honest, I've not looked at most of them after my quick glance when I first excitedly installed it. All you really need to do to get going is to fill in your IP address or host name (I've put in my VPS's IP address; type that in your URL and you'll get back to the homepage for Trinity). It should already be default on port 22, since that's the default for SSH.
Then click "save" so that you don't have to keep typing your IP address every time you want to log in. There's nothing wrong with leaving your IP address public (you probably know you can get to it through DNS look ups anyway). Then press open.
Then you'll be presented with a black screen. Give it a second (depending on how fast your server is, and how fast your local internet connection is) and it'll ask you to log in. At the moment you'll need to log in as root. "Root" is the administrator account of a linux server, it can do absolutely anything in the system. Next you can type your password. Nope, nothing's showing up. Trust me though, it's being typed. Instead of putting stars in place of your letters, it just won't show them up. Press enter and you'll get to see the start up/message of the day thing.
It's best never to play around as root; so far as I've learnt, not even experienced linux users do that. It's too easy to delete something that's far too important (unlike Windows, there's nothing to stop you just deleting Debian critical files). To counter that, you have to set up a new user. To do that type "adduser username", obviously replace username with the user name you want to set up.
The username has to be in ascii, and all lowercase.
Then it'll ask you some random details. Most of it you can just skip (by pressing enter). Debian was created with multiple users in mind, so having that random contact information for each user made things easier when you're trying to find out who broke something.
Play around as your new user – I called mine "shamess" – for a while. You can find a good FAQ and section for people new to unix servers, with some basic functions at LinuxHelp.net.
Tuesday, 12th February 2008 at 12:28am
I decided I wanted get my own server so that I could run it completely; I've had shared hosting in the past but asking for my host if he could do something for me, because I didn't have access was getting old. Running your own server lets you do whatever you want.
If you want to run your own server entirely, you have three options.
First, you can build your own server. Unless you have that spare parts lying around, it may cost you a lot to make it. It's basically just a computer. You won't need to have a flashy graphics or sound card, really so if you are building your own server, don't bother getting those. There's nothing wrong with just running Apache from your own computer, but you'll have to have it on all the time and have a permanent internet connection. Your ISP might not like that you're using them as your route to the Internet though! I do know that Virgin Media don't mind you doing that.
I'm not using this option because I don't feel like managing the hardware myself. And my mum would get pissed when our 2Meg connection slowed to a crawl.
Another option is a dedicated server. Basically the same as above, but a company is looking after the hardware and they have a much faster internet connection than you'll have at home. Downside of this is that they cost around £60 a month. You get lots of hard drive space and it's really fast generally.
I didn't bothered with that because... well, mostly because I'm poor. Also because I've no idea how to manage a server. Getting something as professional as that would be silly, if I was just going to break it eventually.
So, the option I went with was a virtual server. Exactly the same as a dedicated server, except you don't get as much hard drive space or memory because it's shared with other people on the same server. Nonetheless, you have complete control over everything that happens in your "partition".
At the moment, I'm paying $10 a month (£5.14) for a server has a kinda low spec, from Redwood Virtual. It's okay for what I need it for; playing around and learning the ropes. I guess we'll see what happens if this blog ever starts getting traffic, (heaven forbid one of my articles get Dugg.)
The LVS came with Debian. I had the option of picking the distribution; Etch, Lenny, or Sid. At this point, I knew nothing about Debian, so I ran to Wikipedia to find out what they were on about. The Debian article told me that Sid was an unstable version, so I'm not entirely sure why Redwood would be offering it. Etch is the current and stable version of Debian, and Lenny is the next version that's going to be released, though it's still in an "experimental stage", which I guess means that it's in beta. I went with Etch in the end, since I know that's going to work as expected.