DEV Community

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

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

Jayesh Waghmare on May 16, 2020

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 ...
Collapse
 
cristaldo profile image
Rafael Cristaldo • Edited

Nice one! I have done this process many times. But I don't agree with your argument Flavor choice. Ubuntu server is great but centos is smaller than Ubuntu to run into a fewer hardware system laptop like yours.
Another advantage that I consider in a webserver working into the internet border Is that centos come with firewalld and selinux. It's more appropriate to run webserver with more security layers.
Open the port to the internet is open the port to intrusions and transfor your server in a new target and because of this you have to protect your data changing default ports; like 22 to 2222; make redirect with your ISP router; make firewall rules to filter access in and outbound; use fail to ban like a ddos service, etc. Centos is faster, secure and use less space, process and memory.
Nextcloud project is better and more updated than owncloud. I don't recommend using webadmin.
You can install the no-ip service on Linux directly, works like a charm.
Don't use LAMP, install the services you need like MySQL or Postegresql changing the default ports because your server is going to be hosted in a dmz zone. Install Apache or nginx for webserver services and configure.
Take care when opening a door into your private network to the whole internet and don't hesitate with security .

Collapse
 
jayesh_w profile image
Jayesh Waghmare

Thanks for suggestions. Regarding CentOS , it is used in public servers since I'm not going public as well as I'm quite familiar with ubuntu and debian I stick to that. Will try to use CentOS once i'm bored with this one lol.
I got the recommendation to use nextcloud will try with that one.
When I mentioned LAMP I didn't knew it was a package. whenever I try to make an http server I install packages manually(mariaDB, php , Apache, phpmyadmin)
Anyways Thankyou for your valuable suggestions will look forward to change ports of ssh,ftp , database server

Collapse
 
mlambie profile image
Matt Lambie

Back in the "old days" when Ubuntu launched, one of the goals of the project was to increase compatibility with laptop hardware. For an older laptop I'd choose Ubuntu.

Collapse
 
randomlylelo profile image
Leo

Cool! I found this very interesting, but is it possible to access the server from outside the home?

Collapse
 
jayesh_w profile image
Jayesh Waghmare

Your need to forward the ports. give static ip to the server in the private network. Use DDNS if your service provider provides you with dynamic ip. Also you need to check out DMZ and all that stuff.

Collapse
 
cristaldo profile image
Rafael Cristaldo

You tell us that your server is not in public zone. But when you say to use port forward, DMZ and DDNS we are convicted that YES, the server is on a DMZ Zone, opened to the Internet access. http is port 80 tcp (DDNS), and the worst if you setup your IP Address server in the DMZ config space at your Router, you definitely put your server on the internet border. Just my tip!
It is confusing many people here.

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 ;)

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
 
isaacdejesus profile image
Isaac Reyes

Quick question: are you using a static IP or dynamic? Because I tried this before because I wanted to run a webserver and the internet told me a few things. One of them is that you need to pay your isp extra for a static IP address. And that running a server from home is not safe because you can get hacked.

Collapse
 
jayesh_w profile image
Jayesh Waghmare • Edited

I use dynamic IP. Using a static ip for server is recommended but you can use ddns services which is provided by no-ip. They take care of the dynamic ip. And I've not port forwarded my server to public network just using it inside private network. So no hackers in the house :)

Collapse
 
ccmks profile image
ccmks • Edited

You can buy Cloud Static IP from here:
ebay.com/itm/Rent-Cloud-Static-Pub...

It is very useful to get static IP without your ISP assigned to you especially when you need to host something behind 4G LTE Network. The Cloud Static IP works virtually on all kinds of internet service.

I bought one of this and they works great on my home server! The support is great too! I don't have to worry about the dynamic DNS anymore nor changing the public IP when I change my ISP!

Collapse
 
nassimspace profile image
Nassim Abdellaoui • Edited

You could use something like LocalTunnel or go through Cloudflare with a script; You can find tons of Cloudflare Dynamic DNS updater scripts on Github!

Collapse
 
swaroopchirayinkil profile image
Swaroop

Same thought in here also ...!!!

Collapse
 
beskiriyan profile image
Riyan Beski

I'm done with the process. But when I try to connect to the server. It's says the password is wrong. How to change the server password?

Collapse
 
cristaldo profile image
Rafael Cristaldo

The root password ?

Collapse
 
beskiriyan profile image
Riyan Beski

Can you explain me. How to connect to my server from other networks.

Thread Thread
 
cristaldo profile image
Rafael Cristaldo

When you say "From other networks" I guess you are saying "Connect to your server through the Internet".
You have a server at home and want to connect to it from anywhere. You have to configure port forwarding into your ISP Router/Modem.
For example:
1) At your server configure SSH service listening 2222 port in the file /etc/ssh/sshd_config. Restart the ssh service
If you have a firewall you have to configure this port to be allowed with TCP protocol

2) At your Router/Modem ISP appliance, you have to login into it and look for "Forwarding ports"
configure all incomming connection to the 2225/tcp port TO be redirect to your Server IP:2222/tcp...ex: 192.168.10.15 port 2222 (SSH)
Remember to configure your IP Address as a static mode.

If you use no-ip, it's simple to remember your domain name. So you just have to try to connect
ssh user@domainname.no-ip -p 2225
The Router will redirect inside your server.
There are many good documents on the internet showing this kind of setup.

Collapse
 
beskiriyan profile image
Riyan Beski

No the password to connect with the server

Thread Thread
 
cristaldo profile image
Rafael Cristaldo

Be more specific...which service password are talking about?
Webaccess ? Owncloud? Webadmin? Which user are you using with ?

Thread Thread
 
beskiriyan profile image
Riyan Beski

If I try to connect with my server with my root password it says permission denied. What to do?

Thread Thread
 
cristaldo profile image
Rafael Cristaldo

As I ask you, Is your root password ?
What kind of access are you trying to do?
For example, ssh?
Can you access your server with ssh using root password ?
Can you access your server via console with the root user and password?
You can login from console but not from ssh connection?

Thread Thread
 
beskiriyan profile image
Riyan Beski

Thanks. But I figured out my problem and now I'm able to connect

Thread Thread
 
cristaldo profile image
Rafael Cristaldo

We just need to understand if you forgot your root password OR you only don't have permission to login via ssh.
If the problem is only when trying to login via ssh, it's easy to solve from sshd config file.
If you forgot the root password, you have to broke it by booting from grub with edit option (E) in the kernel line writing in the end of the line init=/bin/bash and doing chroot on root partition to be able to change your root password.
There are many posts on internet showing how to proceed with this.

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
 
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
 
v6 profile image
🦄N B🛡

I have got to do this.

Collapse
 
vaviloff profile image
Vaviloff

Nice writeup, Jayesh!

I would also add Docker to the list of technologies to practice!

Another million (or so) other ideas on what run on such a server I found at the Selfhosted reddit. Some notable mentions:

  • YDL-UI GUI for youtube-dl to conveniently download videos from Youtube
  • Koel - a beautiful personal audio library
  • Ubooquity - a personal comic library
  • rTorrent+RuTorrent - basically a web version of uTorrent
Collapse
 
moopet profile image
Ben Sinclair

Oh, Koel looks very swish.

Collapse
 
trasherdk profile image
TrasherDK

I stopped reading after "I’ve been using Linux for past 1 year".

Collapse
 
drmontaperto profile image
drmontaperto

The only point you proved was the COMPLETELY obvious, that your a fucking little shit-bag that needs to sit down, shut up, and wait to be told what to do. You see little boy, it's guys like you that haul our garbage. You troll sites like these, no doubt furiously jerking an angry little boner in the hopes of stumbling across some hard working, humble, engineer that you trash, and with that act, perhaps torture your defective pre-frontal cortex into shitting out some self esteem. The nights must be truly terrifying for people like you. Alone in the dark, laying there with the knowledge that this is as good as it's ever gonna be. You'll NEVER be the next..... The next ANYTHING, because those jobs go to people who know they don't know everything. Those jobs go to the guys that figure out a way to learn something from everyone. Even if it's to learn that they don't EVER want to be a know it all little SHIT. The reason you have no friends, ZERO chances at a promotion, and coworkers who laugh at you behind your back and wouldn't recommend you for a job answering the help desk at NAMBLA is really the same reason your still shooting your jizz into a tube sock. Until you figure out it's not what you get out of this world, but what you put INTO it that matters, you will remain a pathetic little loser. If that's just too much to wrap your tiny little intellect around, he's the correlate. "Nobody likes a know it all, and nobody doesn't live here" still nothing?? I'll make it even easier." If you don't have anything nice to say, then keep your fucking mouth shut before somebody makes speaking at all a distant memory. Asshole...

Collapse
 
trasherdk profile image
TrasherDK

Holy shit! I hope you feel better now that you got that shit off your chest.

Collapse
 
moopet profile image
Ben Sinclair

Why's that?

Collapse
 
trasherdk profile image
TrasherDK

With one year experience, I don't expect any in depth knowledge or sound advice.
Your suggestion of installing webmin proves my point.

Thread Thread
 
cristaldo profile image
Rafael Cristaldo

hahahahahah... you're so mad.
He is learning, I have made my points too. But don't say that man.

Thread Thread
 
moopet profile image
Ben Sinclair

Sometimes people have a year of experience with something and know it better than others who have ten.

Collapse
 
randomlyalex profile image
randomlyalex

Not sure about recommending webmin =\

And generally look towards nextcloud over owncloud if you're recommending self hosted cloud file sharing... :)

Collapse
 
jayesh_w profile image
Jayesh Waghmare • Edited

i will look forward to use nextcloud as it was provided as an option in featured server snaps during installation. Thanks for the advice ... :)

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
 
jayesh_w profile image
Jayesh Waghmare

yes puppy OS works like charm on old machine. I have read that the entire operating system can be loaded in main memory

Collapse
 
akostadinov profile image
Aleksandar Kostadinov

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

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
 
cmiranda profile image
Cris 👨🏻‍💻

Nice guide. Thank you! 😁

Collapse
 
jayesh_w profile image
Jayesh Waghmare

Welcome Cris !

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
 
safventure11000 profile image
Saf11000

nice article! 👏 i will try this.

Collapse
 
jayesh_w profile image
Jayesh Waghmare

Thanks a lot Saf!

Collapse
 
aortizoj15 profile image
Alexis Ortiz Ojeda

Set up my desktop as a server and it is the best feeling when I can log into my server from any computer in the world and pick up in my code right where I left off! Thanks for the article Jayesh!

Collapse
 
jayesh_w profile image
Jayesh Waghmare

Welcome Alexis!

Collapse
 
wemomax profile image
Welington Mothé de Oliveira

Utilize o OpenMediaVault, simplesmente o melhor.

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
 
plaken profile image
PlaKen

I have an old, really old laptop which cannot even run a 64-bit OS. Would that pose any particular issues with any of the services I need to run (other than testing 64-bit builds)?
Thanks.

Collapse
 
nodetraffic profile image
nodetraffic

Thanks for your post! It was very useful for me

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
 
degardy501 profile image
degardy501

This is how I got myself a plex server. I went Ubuntu 16.04 as I wanted a GUI. I need to try out webmin though

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
 
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
 
imben1109 profile image
Ben

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