What You Will Learn:
- The Minimum System Requirements for converting a PC to a Linux Server
- How to install Ubuntu and Application Services
- Setting a static IP address for your server
- Sharing your files publicly
- Port forwarding and static hostnames
When your old PC has given up the ghost, or you’ve finally succumbed to the allure of newer technology, where does the old beast go?
If you’re anything like me, it might find a permanent resting place in the attic, or stashed in a corner somewhere out of harm’s way... at least until I harvest it for spares or get rid permanently. But it doesn’t have to be like this.
Your old PC is the Linux server you never knew you had. And it’s easy to convert your old hardware, so it’s up to the challenge. Here’s how.
Minimum System Requirements
Before you can get your Linux server up and running, you’re firstly going to need to check the spec. Linux is equipped to run on even the most sluggish of old equipment, so this isn’t usually a problem if you’re converting an old PC from within the last 10 years or so, but it’s essential to check you’ve got the basics before getting started.
For the sake of this tutorial, we’re going to be installing Ubuntu 17.10 - the alluringly named ‘Artful Aardvark.'
According to the minimum system requirements spec, you’re going to need at least 256MB of RAM, as well as a minimum of around 10GB of space to accommodate the software itself.
One of the beauties of working with Ubuntu is that it carries support for a range of hardware, and you can reference the Linux Compatibility list to check out whether your current setup is supported.
At this stage, it’s also worth mentioning that you need to find somewhere to store your old PC-cum-server - preferably somewhere cool and ventilated if you’re hoping to run it around the clock.
Once you’re satisfied the Minimum System Requirements are covered, it’s time to get on with the job of installing Ubuntu.
Step 1: Installation
This step is pretty straightforward. Head over to Ubuntu’s Daily Build to get your hands on the latest version of the software. Download the relevant ISO file, and burn it to a CD or DVD. You’ll use this to boot up your old computer and run the Ubuntu platform.
If your old computer does not have a CD/DVD drive, you can see how to make a bootable Ubuntu from USB stick here.
You may need to change the BIOS settings on your computer to boot from a disk or press a particular key when loading up your old computer to enable booting directly from the CD. Once you’ve rebooted and loaded up the installation file, it’s time to begin the process of the actual installation.
Choose the following options:
- Download Updates While Installing
- Install 3rd Party Software
- Erase and Use the Entire Disk
It’s worth noting that this last option will scrub your old PC, including your previous operating system, so it’s important to be certain you’re sure you want to do this before barging in a scrubbing your old system clean.
The remaining settings are largely up to you, depending on your preferences, but I’d always avoid choosing to encrypt the Home folder. Other than that, you can fly through the remaining stages of the installation as you would with any other operating system.
Once you’re done, you’re going to want to reboot your PC. And voila - installation done, the first hurdle cleared. That wasn’t so bad, was it?
Before you dash off into the sunset with your new Linux PC, be sure to install any updates - like you would on a new install of Windows. System > Administration > Update Manager > Install Updates will do the trick.
Step 2: Installing Application Services
So you’ve successfully installed Ubuntu. But before you can move on to enjoying your new server, you’re going to want to install application services.
There is a myriad of options here, but for the sake of simplicity, we’re going to keep things to the most commonly used combination of services: PHP, MySQL, and Apache.
The Ubuntu Software Center is your friend - it can be accessed via System > Administration > Synaptic Package Manager.
Search for the package names that correspond to these services, and install them all. Apply all changes when requested to complete the installation process. You’ll be asked for a root password for MySQL, but the process is pretty painless, and you’re ready to go without rebooting once they have installed.
At this stage in the process, you can now check to see whether everything is working with your new server. Obviously, there are no files there yet that you can reference, but it’s still possible to verify everything has worked as intended.
Open up Firefox on the server and type in “http://127.0.0.1/”. If it works, the browser will tell you so, with a subtle, reassuring ‘It Works!’ message.
If it hasn’t worked, you’ve probably missed something out along the way. Go back to the start of this tutorial and run through the steps again - you’ve maybe missed a minor detail along the way.
Congratulations - your server is now fully up and running. Next, it’s time to get into the nuts and bolts of your new server, and how you can upload files to it.
Step 3: Setting Your Static IP Address
Now that your server is setup, it’s time to whip it into shape, ready for the world at large to take a look.
You need to know your server’s local IP address because you’ll need this to reference later when you’re ready to set up your files. You can find this out in the DHCP Protocol, which is located in the window labeled ‘Network Information.'
Right click on your connection and choose ‘Connection Information.' This will show you a new window where you’ll find all the relevant info you need - your IP address, broadcast address, DNS server, etc. Make a note of all these relevant numbers, because you’ll need to reference them again in about 30 seconds time.
Essentially you want to give your connection a static, rather than dynamic, IP address. This involves editing the defaults. On the same menu as before, right click and choose Edit Connections.
Choose your connection and proceed to edit the settings. On the IPv4 tab, under the field labeled ‘Method,' you’re going to want to choose Manual (instead of Automatic). Enter the information you wrote down for your connection settings in the fields provided.
The key difference here is the IP address field. Keep the bulk of the address the same as before, but change the last group of numbers to something high, under 254, and not currently in use by anything else on your network. This will become your server’s static IP address, so you don’t want to choose something that is already assigned to another device. If in doubt, plump for 250 - this would mean your IP address would look something like 192.168.0.250.
Step 4: Sharing Your Files
This is the quickest and most straightforward way of communicating with your server, ideal for quickly uploading files. A word of warning though - the steps you’re about to follow do open up your server to the big bad world, so it’s best to use this on a private network only, or in circumstances where you’re sure no-one else can connect to your server.
Go to Applications > Accessories > Terminal and enter:
$ sudo chmod 777 /var/www
This will allow us to open up the permissions on the web folder, which will be essential when it comes to uploading files. You’ll be asked for your password before you can change these permissions.
Head to Places > Computer and go to File System > /var/. On the www folder, right click and choose Sharing Options, where you can tick the box labeled ‘Share this Folder.' I recommend you set this up with a password for maximum security when prompted, but it’s up to you.
Be sure also to check the ‘Allow others to create and delete files’ option, which makes it possible to write to the folder from within the shared directory directly.
You can now view your files at your static IP address, followed by /www - it should look something like http://192.168.0.250/www and should match the files you’re able to access by just typing the IP address alone into your address bar.
Step 5: Port Forwarding and Static Hostnames
Still with me? You’re doing great. We’re nearly over the hump with this, with just a couple of steps to go before your old PC is fully converted into its new life.
Long story short, you need to specify the appropriate port forwarding options so visitors can ultimately reach your hosted files (like a website), rather than your network individually. Port forward is pretty straightforward - most web servers use port 80 by convention, and you can specify this within your router settings without difficulty.
Access ‘Applications’ or ‘Port Forwarding’ from your router’s control panel, and forward the TCP Port 80 to the static IP address we set up for our server back at the start of the process. You did write that down, didn’t you?
If you’re stuck, dig out your router’s operating manual - this will tell you how to access the router’s admin section, and should also be helpful in setting up the appropriate port forwarding.
At this stage, you might also want to set up a Static Hostname, in place of the dynamic IP you’ve most probably got on your home connection. DynDNS is a good option here, which you can use to firm up your connection, in place of running through your home router. Configure the IP address to match the static IP of your server, set the port number to 80, and you should be good to go.
You should now be completely set-up, and able to visit your website or files hosted on your new server.
Wrapping It Up
So there you have it - there’s life in the old dog yet! Before you throw away that old PC, why not try converting it into a Linux server. Even ancient hardware deserves a second chance, right?
While the process might seem pretty technical to the uninitiated, it’s pretty straightforward, and once you’ve done it the first time, you’ll be eyeing up other machines to do it all again.