Wednesday, December 23, 2015

Installing Damn Small Linux as a Server Environment

This will probably be one of many Damn Small Linux things I post because I enjoy working with DSL because of its small size and small footprint. Some computers just can't handle much else. I know, I know, why don't I get better hardware? Because I like making old stuff do new stuff. It's a hobby of mine. 

This tutorial assumes you're in need of the LAMP Stack (Linux, Apache, MySQL, and PHP). I'm going to be doing this in a Virtual Machine (512MB of RAM), but it should work on any physical hardware you have.

The first step is to download the ISO. You can get the official version from the DSL Website. It hasn't been updated in a while, so at the time of writing, 4.4.10 is the last stable release. It shouldn't take too long to download, being as it is only 50MB in size. Next, either burn it or mount it to a virtual machine and start the computer. Press enter at the boot screen to start loading the Live CD image.

Once the GUI has loaded, close out of the web browser and click anywhere on the desktop to get the menu. There, you'll want to go to Apps > Tools > Install to HDD. A terminal will come up asking you some questions. Choose which partition you wish to install to (if you're using a blank hard disk use fdisk to create a partition table as described here). Answer the questions to install DSL to the hard drive (generally yes to everything and G for GRUB) and let it reboot. If the CD Drive doesn't eject itself, then eject the disk to ensure it boots from the hard drive.

Once booted, it'll ask you to set the passwords for the root and dsl users. It says between 5 and 8 characters, but I put in a 18 character password and it worked. I then logged in as root and it asked me to configure the GUI. These options are a matter of personal preference and depends on machine capabilities.

If you don't want the GUI to start at all, you must go into the home directory and edit ".bash_profile" and comment out the "startx" line. I only did this for my root user. I kept the dsl user the same. I added an account with my name that didn't have a gui on it, though.

Next, just to get over an annoyance of mine, we're going to disable fsck on root on boot. I know this has its disadvantages, but if your server goes down without unmounting the disk, then it won't boot back up again because it won't pass the disk checker. You can do this by changing the last 1 on the first line of /etc/fstab to a 0. I also reduced the time it took GRUB to automatically select the first menu option. You can do this by modifying the "timeout 15" line to any number of seconds you want grub to wait. I went with 2. Be sure to do a "shutdown -r now" for grub to save the changes.
Editing fstab
Now that we've set up the system, let's start getting some useful software on here!

We want the LAMP stack, right? So that's what we'll get. The LAMP stack.

First off, DSL doesn't come with APT. This is bad, because it's the best package manager in the world (maybe I'm just saying that because I've never used yum before.) Unfortunately, the MyDSL repository has sorta restructured itself, so for the APT install script to work, you need to change the repository location. Edit "/opt/.dslrc" so that the repository location is correct. The correct repo location is http://distro.ibiblio.org/damnsmall/.

Now that that's all ready to go, run "dpkg-restore"  and watch it install the package manager and "apt-get". It'll automatically populate your source list with debian repository locations and update the package lists.

Next, we're going to install XAMPP. It includes the whole LAMP stack. We get a working, albeit outdated, version from SourceForge. Untar this in your opt directory and run /opt/lampp/lampp start. The FTP Server will probably fail to start because of the outdated Standard C Library. To fix it, open your /etc/apt/sources.list and change "woody" to "sarge" temporarily. That way we can get a newer version of libc6. After you do that, go ahead and update the package lists and apt-get install libc6 to update the library. You can change it back to "woody" afterwards if you want.

Run the start command again and the FTP server should work. You can verify that everything is listening by checking netstat -an | grep listen -i.

You can see here that everything is good to go. Now you can use this just as a regular LAMP stack! I haven't changed or installed anything extra. My XAMPP version, 1.6, has PHP 5.2.1, so it should run most of the stuff you're going to need. If you need something newer, you may be able to upgrade it. You can also configure it to start on boot too.

That's it. I don't know what I'm going to do next, but it'll probably be much easier to do it on a much more recent version of Linux. What can I say, I'm a masochist.

No comments:

Post a Comment