DEV Community

Cover image for This is how I turned my old laptop into a server.
Jayesh Waghmare
Jayesh Waghmare

Posted on

This is how I turned my old laptop into a server.

I had a working old laptop and was itching to do something with it. And then I decided to turn it into a personal home server. This post will also work on any machine, you just need a monitor,keyboard,ethernet cable and an USB port.
Let’s start!

1. Choosing an Operating System

When we hear about servers one thing that comes in our mind is Linux.Some of them do run windows but I’d personally go with Linux. Because it’s fast, has a whole community and is open source( an I’ve been using Linux for past 1 year )
Before choosing an operating system I’d like to share my machine’s specification :
4 GB RAM,Intel core 2 duo processor, 512 GB HDD.

Which Flavor of Linux to choose from?
Many people are confused while migrating from windows or mac OS to Linux platform.
This is because Linux itself has many flavors but most of them are based on
1.Debian
2.Arch
3.Red Hat
So which one to go with?
I’ve Tried all three of them and for beginners the most recommended system is any Debian based OS ( Ubuntu, Kali, Debian , Lubuntu, ParrotOS,Mint)
Most of the servers work on RHEL(Red Hat Enterprise Linux) and its flavors such as CentOS or Fedora.

Why didn't I go with CentOS?
CentOS is based on RHEL which is quite tricky for beginners also my system is old and has low end hardware. That is the reason why I selected Ubuntu server for my machine.

2. Downloading Ubuntu Server 20.04 and making a live bootable USB

Download the ubuntu server from the following link
After downloading it, ensure you have an empty usb device to make it bootable.
If you are using windows download rufus software and run it.
Google if you have any problems while making bootable usb with rufus as it is pretty easy.
For Linux Users download any usb Image writer tool and you are good to go.

3. Booting into the USB and setting up the Server.

Make sure that your files are moved to another computer as we are using the whole space for our server. We are going to erase the entire disk for the same purpose.

Plug in the live bootable usb and start the machine. Press F12 to go to boot options. Select the USB option and click enter.
Use arrow keys and the enter key to select options.

After Few seconds there will be an option to choose your language.

Welcome Screen

Welcome
Select your language (English) and click enter.

Keyboard Configuration

Select Keyboard type English US and click enter.

(Now here comes the tricky part.)

Network Connections

Network Config

If you have plugged in your ethernet cable from your wifi Router you don’t really have to worry a lot. The installer will automatically detect the DHCP settings from the router and you just have to click enter. But if you don’t have any ethernet cable you have to go through a series of package installations only to connect to internet.

Configure Proxy

If your system requires any http proxy to connect to the internet enter the proxy address otherwise, just click on Done.

Guided Storage Configurations

Guided Storage config
As mentioned earlier we are going to utilize the entire HDD space for our home server and that's why select Use and Entire Disk option and click on done.

Storage Configuration

Alt Text
Your Hard disk space will be now divided into two partitions: one for the operating system itself and the other for GRUB Bootloader.
Review your settings and click on done.

Profile Setup

Install
Enter your name , Your Server’s name(this name will be visible to other devices) , Your username and password. Click on done.

SSH setup

Featured
Select on Install OpenSSH server because that’s how you will connect to your server inside a private network.

Featured Server Snaps

ssh
Select any desirable feature for your server, I selected none because We will install them manually as per future requirements.

Installing System

Profile
Now you have to wait for a few minutes for your system to install. After Installation is complete the prompt will ask you to remove your USB device and reboot. Follow the reboot process and the system will automatically boot up. And You will see a terminal like this

There you go ! you have turned your old laptop into a personal home server.

4. Changing the root password

Type the following command
sudo -i
It will ask for your password.
After entering your password you will be logged in as root with # sign
Type the command
passwd
Type suitable root password twice and you have changed your root password
Type exit to exit as root
Type su to log in as root

5. Connecting Your server via Wi-Fi.

Assuming you still have your ethernet wire plugged in, Install the following packages
rfkill , wireless-tools , net-tools and wpasupplicant
With following commands
sudo apt install rfkill wireless-tools net-tools wpasupplicant
After installing them go through the following link for detailed explanation to connect to your WiFi

After a reboot plug out the ethernet cable run the following command
ifconfig
and view the private ip address.

Now from another computer
If you are using windows download Putty or if you are Linux or MacOS user run the command
ssh username@ip_addr
Enter your password
Voila! You have just accessed your system inside your private network.
login
*** you will see a welcome screen like this***

6. Installing Webmin

Webmin
Webmin is a web-based interface for sysadmins. Using any modern web browser, you can setup user accounts, Apache, file sharing and much more. Webmin removes the need to manually edit Unix configuration files like /etc/passwd, and lets you manage a system from the console or remotely.
Follow this guide to install webmin.

Cool Things to do with this home server.

  1. Store Backup of your files
  2. Install a LAMP server to run websites.
  3. Install SMTP server to send mails.
  4. Use it as a database backup server.
  5. Test your Apps on this server before deploying them.
  6. Create a private git repository server.
  7. Save your videos and music and stream them over the web.
  8. For machine learning enthusiast save your training data on this server and train your model so that there is less stress on your working machine(It requires high end server)
  9. Use it as a ftp server.
  10. Install nginx to run and test web apps.
  11. Download and install OwnCloud to maintain your files.

On this server I save my web projects (LAMP stack). I also use it to backup my database and website from the public server by setting up a cron job.I saved a lot of movies and steam them by just writing a small php script :)

--Thank you!--

Latest comments (62)

Collapse
 
kumard3 profile image
Kumar Deepanshu

how can i connect to my home server remotely like form a different city while it is connected to internet ?

Collapse
 
hiendinhngoc profile image
Hiến Đinh Ngọc

Nice post. I have a question. In my case I have an old thinkpad x230, intel core i5, 8gb ram and 256 ssd, is it reasonable to make it as server for multiple apps like rails, react-native, mysql, redis, etc?

Collapse
 
imben1109 profile image
Ben

Do your notebook support remote wake up such as wake up on lan?

Collapse
 
safventure11000 profile image
Saf11000

nice article! 👏 i will try this.

Collapse
 
jayesh_w profile image
Jayesh Waghmare

Thanks a lot Saf!

Collapse
 
anubhav501 profile image
anubhav501

Hi Jayesh,

My old laptop has 2GB ram and Pentium Processor, would I be able to turn that into the server? is there going to any performance issue?

Collapse
 
definitelynotroot profile image
NOT_ROOT

'CentOS is based on RHEL which is quite tricky for beginners also my
system is old and has low end hardware. That is the reason why I
selected Ubuntu server for my machine.'

Centos seems to be better optimised and it would work better than the ubuntu server or just as well as Ubuntu. A different (better because of many tutorials are based on the ubuntu) package system can be a better explanation.

Anyway, nice, more please.

Collapse
 
akostadinov profile image
Aleksandar Kostadinov

I thought I will find a guide how to get that cooling properly in the laptop.

Collapse
 
dskrad profile image
david

May I ask how you stream your movie collection with a small PHP script? Do you stream via simple webpage, or can you chromecast? Thanks.

Collapse
 
jayesh_w profile image
Jayesh Waghmare

I steam via simple webpage. it just takes the path of the movie and lets me stream it . simple

Collapse
 
sudeepgumaste profile image
Sudeep Gumaste

Loved it. Thank You.
And thanks again for introducing me to webmin. I was configuring a server at my uni before the lockdown and without webmin It's a very time consuming process. I can't wait to try this when lockdown gets lifted :)

Collapse
 
hvarday profile image
Harshal Varday

Great Article, simple and precise instructions.

If I were to purchase throwaway hardware for my personal private server. What would you guys recommend?

Purpose - Stream movies, store personal data, setup torrent download jobs

I was wondering if something like RaspberryPi and a extra HDD or similar storage device for additional storage?

Collapse
 
tardisgallifrey profile image
Dave

This is cool. I see some things have changed over the years in setting up Ubuntu Server. I think Ubuntu was at 10.04 when I built my home server on an old laptop. The screen barely worked. I operated it all by SSH. Kept it running for quite a few years and it taught me a lot about Linux and servers.

Collapse
 
beskiriyan profile image
Riyan Beski

Can anyone tell me how to connect the server from different network?

Collapse
 
jayesh_w profile image
Jayesh Waghmare

Port Forwading.

Collapse
 
furyuri profile image
Uri Frazier • Edited

I was just trying to do this over the weekend, and hit some roadblocks, so I was very happy to see this as one of the links in the DEV newsletter. I would very much appreciate some help:

First: I setup an old version of Ubuntu Server, because the small amount of research I did showed that 15.10 would be compatible with my old Macbook. Here's where I found that: help.ubuntu.com/community/MacBook2...

Because I'm using a much older version of Ubuntu, it's not as easy to set the IP address and I have to write this "code" from scratch. Here are some instructions (below), but they require me to know what my IP address, netmask address, gateway address (?), and DNS server information are. Can I choose my own static IP address? I don't know what a netmask, or gateway are. I don't know what my DNS server address is. I feel like I have to learn everything about TCP/IP to even get started. Please help!

michael.mckinnon.id.au/2016/05/05/...

Second: You mentioned not port forwarding your server and just using it inside a private network. How do I do this? This is exactly what I want to do. I just want a "private server", but am not sure if this would just be a WAN? I want to practice using/managing a server...

Thanks!

Uri

Collapse
 
jayesh_w profile image
Jayesh Waghmare

Hey Uri configuring a static ip address is easy if you do it from your router rather than your server. what you need is the mac address of your machine. type ifconfig or log in into your router and check DHCP client list. After that select DHCP address reservation and select your suitable address. ( i chose 192.168.0.110)
When mentioned about private network that means all devices connected to my router (above dhcp clients) can only access my server. with address 192.168.0.110. Only LAN.

Collapse
 
furyuri profile image
Uri Frazier • Edited

Thanks Jayesh!

I was also able to get a very detailed explanation from a co-worker who is kind of an expert in networking. I appreciate you following up with me!

Collapse
 
locness3 profile image
locness3

Nice! I also recommend people to check out YunoHost, a distro made for self-hosting stuff. After setting up a domain, port forwarding and such, you can install stuff with a few clicks ;) There are packages for Nextcloud, Wordpress, Mastodon, and more ;)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.