Monday, October 26, 2009

linuxmancy level up

That's right, I am now a level 2 Linuxmancer. I got level 1 when I got pissed off at how Ubuntu tries to hide everything from you.

So for a while I've wanted to rid my server of its aging unsupported Ubuntu install. It took a while to get to the point where I could reformat and install just a server configuration on it. This was due to me needing to find a way to get ~75GB of data that I cared about deeply out of my home directory (analogous to My Documents on Windows, it's where you store all your stuff. Because you don't have write permissions for the rest of the filesystem. Because this isn't Windows). Eventually I manually scp'd over and deleted enough of the large files (anime, mostly) that I had enough free disk space to archive the remaining files into one 27GB .tar.gz file that I could scp over to my desktop and be done with it.

The primary reason that I wanted to reinstall was that it was in fact a desktop configuration that was being used as a server, so it had a lot of graphical crap (X, GDM, xfce, graphical applications, etc.) installed. Those things were running in the background and cluttering up my RAM and hard drive while not actually being useful.

The secondary reason was that the version of Ubuntu I had installed (Feisty Fawn) no longer has package repositories available, meaning I couldn't install anything or upgrade existing packages. This needed to be fixed, because I kind of want to have access to security and feature updates.

The first problem I encountered was actually with the 27GB .tar.gz file. I was trying to extract it using IZarc, which is the normal archiving program I use for pretty much everything. I figured it was going to take a while so I set it off and started playing Guitar Hero to pass the time. A few songs later I notice it's done, so I browse to the directory and there's nothing there.

After investigating a little I discovered a fatal flaw in IZarc: it extracts files to a temporary directory on your C drive and then transfers them to where you actually told it to extract them to, instead of just extracting them where you told it to. In most normal cases this wouldn't be an issue, but due to my setup, it was. My C drive is only 20 GB, and only about 9 or so are free. So with its flawed method of extracting files I couldn't do it. If it would move (it is a move operation, not a copy, right? This is mostly directed at IZarc's developer(s).) after every file it would work, but it seems to want to transfer after the entire operation is done. It errored after a while and transferred what it had extracted, but it clearly wouldn't do.

So I downloaded and installed 7-Zip. Thankfully, it extracts directly to where you told it to extract instead of this "temp directory on your C drive and then transfer after we're done" crap. So I lit it off and played some more Guitar Hero. Eventually I FCed a couple more songs and as a bonus I had all those juicy files to sort through. I've done some of it but I keep putting it off.

Anyway, with the files backed up and accessible, it became time to reformat my server and get it going again. With this came a change in Linux distribution, to Arch Linux. See, the neat thing about it is that it's fairly user friendly, but puts you in full control over everything. It assumes you know what you're doing, but has really good documentation so you can easily see how to do something. Unlike Ubuntu, which assumes you know nothing and tries to hide all the inner workings of everything.

So I've spent the last few hours installing and configuring my server, and I did way more stuff (and learned way more about how this Linux stuff works) than I'd ever have done if I was using a recent Ubuntu. Thankfully, Arch Linux has a wiki full of documentation, so it's pretty easy to see what you need to do so you can do what you want to do.

The first thing, that I always encounter after a virgin install of Arch Linux (I've been playing around with it in VirtualBox, but this is my first system-native install of it) is that I can't access the internet. I always grief about this trying stupid things that don't work and then I facepalm and realize there's one simple thing in /etc/rc.conf you have to change for it to work (setting up the default route to your gateway, for anyone who's so inclined and wants to know). If only I'd remember this one stupid setting, I'd save myself a lot of time.

So with the internet accessible, it became time to update. The thing about Arch Linux is, it operates on a rolling release. Whatever install disc you have is basically just a snapshot of everything that's current when they make the install disc. So the older your install disc is, the older the packages are on it, and the more stuff you need to update after installing it. The awesome thing about a rolling release is once you install it, you never need to worry about distribution upgrades or any of that junk like on Ubuntu. You just keep updating your packages to their most recent versions. Even if another install disc is released, if your packages are updated you've got what's on that disc (and a whole lot more, the disc images are only 300MB or so and don't include everything).

The gist of that previous paragraph is: this initial mass-update takes quite a while.

So I chatted on IRC and watched some YouTube videos and stuff. Went back to it, and it had finished. If I'd started up Guitar Hero, I'd have played for so long that I'd have gone to sleep and forgotten entirely. Anyway.

The next thing about Arch Linux is that it installs only the bare minimum amount of stuff necessary to get you a working system, and then it's up to you to install anything extra. Which is exactly what I want. Ubuntu and other distros clog your system's arteries with so much stuff it's amazing your computer doesn't have a heart attack after the install finishes. So anyway I take my bare-bones text mode only install and start adding stuff. The first thing is ssh, which I neglected to add in the install process. Here's the next thing that Ubuntu insulates you from: having to configure what daemons are allowed to use network connections. It's a fairly simple edit to /etc/hosts.allow in Arch Linux.

Now that I can ssh in, the rest of the setup can happen remotely, via my desktop and the awesome Windows SSH client PuTTY.

I'm not going to intricately timeline the rest of this, so I'll tell you where I stand right now and explain a couple random things along the way. In addition to everything else I've mentioned (and a few other things like htop and fortune), I have Apache (web server), PHP (server-side scripting language), and MySQL (relational database) set up and linked together and all that good stuff. So my web server can serve dynamically-generated web pages constructed with information from a database. Good stuff.

Then I went through the hell of installing and configuring phpMyAdmin so I could add users and databases and stuff to MySQL easily. I think that the developers for phpMyAdmin deliberately make it as hard to get to a working configuration as possible.

First you have to copy a config file from one directory to another and edit your web server's config to include the contents of that file. Then you need to edit a .htaccess file (its name is just .htaccess, the leading dot hides a file from view on *nix filesystems) to comment out a deny from all that prevents you from accessing it. Then you have to make a directory called config in its directory, set its permissions so the web server can write files in it, and go to its setup URL in your web browser. If you're lucky, that will work and after you finish setting everything there will be a config.inc.php sitting in that config directory. If not (as was the case for me), you tell it to show you what it would be writing to that directory if it was playing nicely and then copy/paste it to where the config file it generates is supposed to go. Then you have to remove the config directory so won't nag you about it later. Next, it has a file with a bunch of SQL you have to run on your server. That's easy enough, start up the command line client and import it. Then you install some modules/extensions/whatever for PHP that it needs to give you full functionality. Only now are you done, and only now can you sit back, relax, and write a blog post about your experience.

So yeah. Arch Linux is awesome. IZarc would be good if not for that fatal flaw.

fortune -o
fortune -o
fortune -o
fortune -o
fortune -o

No comments:

Post a Comment

I moderate comments because when Blogger originally implemented a spam filter it wouldn't work without comment moderation enabled. So if your comment doesn't show up right away, that would be why.