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
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
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
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
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
Enter your name , Your Server’s name(this name will be visible to other devices) , Your username and password. Click on done.
SSH setup
Select on Install OpenSSH server because that’s how you will connect to your server inside a private network.
Featured Server Snaps
Select any desirable feature for your server, I selected none because We will install them manually as per future requirements.
Installing System
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.
*** you will see a welcome screen like this***
6. Installing 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.
- Store Backup of your files
- Install a LAMP server to run websites.
- Install SMTP server to send mails.
- Use it as a database backup server.
- Test your Apps on this server before deploying them.
- Create a private git repository server.
- Save your videos and music and stream them over the web.
- 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)
- Use it as a ftp server.
- Install nginx to run and test web apps.
- 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!--
Top comments (62)
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 .
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
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.
Cool! I found this very interesting, but is it possible to access the server from outside the home?
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.
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.
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 ;)
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 :)
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.
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 :)
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!
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!
Same thought in here also ...!!!
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?
The root password ?
Can you explain me. How to connect to my server from other networks.
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.
No the password to connect with the server
Be more specific...which service password are talking about?
Webaccess ? Owncloud? Webadmin? Which user are you using with ?
If I try to connect with my server with my root password it says permission denied. What to do?
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?
Thanks. But I figured out my problem and now I'm able to connect
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.
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.
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?
I have got to do this.
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:
Oh, Koel looks very swish.
Some comments may only be visible to logged-in visitors. Sign in to view all comments.