Ready to Start Your Career?

How To Set Up Your Own Media And File Server At Home Easily

B.J. Dinesh Kumar's profile image

By: B.J. Dinesh Kumar

May 28, 2020

I think everyone has heard the word SERVER, at least once in their lifetime. Since every one of us is in lockdown, I decided, "why not start my home server to store and access my music or files?"

So we are going to learn how to set up our very own server for free. We are going to learn how to install and use SSH2, Remote Desktop, UPNP/DLNA server, SAMBA Shares (Windows file-sharing), VPN server, The Transmission bit-torrent server, and Subsonic.


  • A PC or a laptop
  • Some experience with ubuntu

Let's start. First, we need to install ubuntu on our system. Install the latest version and, once the installation is complete, always check for updates for new packages.

SSH2 Installation:

Secure Shell (SSH) is a cryptographic network protocol for operating network services securely over an unsecured network by using a client-server architecture. The process of setting it up is very easy. Simply follow the steps below:

  • Open terminal
  • Type:

sudo su

(this gives us root access)

  • To install the package type sudo apt-get install ssh.
  • Let us secure the daemon by editing the configuration.
  • Type

gedit /etc/ssh/sshd_config

(to open up the config file)

  • Find PermitRootLogin and set it to no
  • Add a line below that variable and type: AllowUsers (username) where (username) represents your Ubuntu account’s username.
  • Type:

service ssh restart

(to restart the ssh)

  • That's it for setting up the ssh.

Remote Desktop Setup:

Remote Desktop uses a simple GUI to enable. The downside is that you must use TightVNC or some other VNC viewer for Windows, if that is your OS of choice, to Remote from. But, if you want to have an RDP compliant server running (meaning want to use Windows' native Remote Desktop client to connect to the server), complete the following steps:

  • Open Terminal.
  • Type:

sudo su

  • To install the software package type:

sudo apt-get install xrdp

  • Forward the external WAN port 3389 to the LAN IP address for the server.
  • For RDP: Make sure to forward any port to the server's internal port 3389. I use 3401 external port forwarded to the server's LAN IP at port 3389.
  • For Ubuntu's built-in VNC: Make sure to forward port 5900 to the machine. If you want to use JAVA viewer to access the Remote Desktop, you must also forward port 5800.

SAMBA( CIFS-Utils for a newer version of ubuntu) Server Setting Up:

Installing and configuring data-sharing which functions with Windows file-sharing. We will set up a shared system, whereby all LAN computers can navigate, access, and modify the shares. You may wish to do something further to secure SAMBA if your LAN environment isn't "home" use.

  • Open up Terminal.
  • Type:

sudo su

  • To install the software package, type:

sudo apt-get install samba smbfs

  • Edit the configuration file.


mv /etc/samba/smb.conf


gedit /etc/samba/smb.conf

  • Do the below changes to your config file:
workgroup = HOME #(Set this to your Windows workgroup)
netbios = HOME #(Set this to your Windows workgroup)
security = share
[Shared Drive] #(Set this to the name you want the shared folder to have)
comment = entire shared drive #(Comments about the shared folder)
path = /mnt/storage2/ #(Path to the shared folder or mount-point of harddrive)
read only = no
guest ok = yes
writable = yes

VPN Setup:

We are going to set up a PPTP VPN, which is supported by Microsoft and Android.

  • Open Terminal.
  • Type:

sudo su

  • To install the software package


apt-get install pptpd

  • To edit the configuration file


gedit /etc/pptpd.conf

  • Compare the below and make the necessary changes and remove or add a hash (Do not change the IP address):
#TAG: ppp
#Path to the pppd program, default '/usr/sbin/pppd' on Linux
#ppp /usr/sbin/pppd
#TAG: option
#Specifies the location of the PPP options file.
#By default PPP looks in '/etc/ppp/options'
option /etc/ppp/pptpd-options
#TAG: debug
#Turns on (more) debugging to syslog
# TAG: stimeout
# Specifies timeout (in seconds) on starting ctrl connection
# stimeout 10
# TAG: noipparam
# Suppress the passing of the client's IP address to PPP, which is
# done by default otherwise.
# noipparam
# TAG: logwtmp
# Use wtmp(5) to record client connections and disconnections.
# TAG: bcrelay <if>
# Turns on a broadcast relay to clients from interface <if>
bcrelay eth0
# TAG: localip
# TAG: remoteip
# Specifies the local and remote IP address ranges.
# Any addresses work as long as the local machine takes care of the
# routing. But if you want to use MS-Windows networking, you should
# use IP addresses out of the LAN address space and use the proxyarp
# option in the pppd options file, or run bcrelay.
# You can specify single IP addresses seperated by commas or you can
# specify ranges or both. For example:
# 1. No spaces are permitted between commas or within addresses.
# 2. If you give more IP addresses than MAX_CONNECTIONS, it will
# start at the beginning of the list and go until it gets
# MAX_CONNECTIONS IPs. Others will be ignored.
# 3. No shortcuts in ranges! i.e. 234-8 does not mean 234 to 238,
# you must type 234-238 if you mean this.
# 4. If you give a single localIP, that's ok - all local IPs will
# be set to the given one. You MUST still give at least one remote
# IP for each simultaneous client.
# (Recommended)
# or

  • Type:

gedit /etc/ppp/chap-secrets

Make the necessary changes:

# Secrets for authentication using CHAP
# client server secret IP addresses
username pptpd password *
  • Restart:

/etc/init.d/pptpd restart

  • Create a new document in /etc/init.d/


touch /etc/init.d/ipv4pptpd
  • Edit the document


gedit /etc/init.d/ipv4pptpd

  • Insert the following text:

# Provides: IPV4PPTPD
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start daemon at boot time
# Description: Enable service provided by daemon.
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

- Save, and exit. - To update,

update-rc.d ipv4pptpd defaults
- Type the below command to start the new routing tables:

sh /etc/init.d/ipv4pptpd

Setting Up uPNP DLNA MEDIA Server: Mediatomb

MediaTomb is an open source UPnP mediaServer with a nice user interface. You can also use gerbera in the newer version of Ubuntu.

  • Open Terminal.
  • Type:

sudo su

  • To install the software package


sudo apt-get install mediatomb

  • Edit the config.xml to set up your username, disable username requirements, add transcoders, and to enable Playstation3 requirements for playback.

This can be done with:

gedit /etc/mediatomb/config.xml

  • http://localhost:49152/ to access the web interface. ( If you are not able to view the web interface, enable UI and account to yes in the config file)

Setting up bit-torrent Server: transmission

  • Open Terminal.
  • Type:

sudo su

  • To install the software package


sudo apt-get install transmission-daemon

  • We cannot modify the settings with this process running, so we must stop the process first.


/etc/init.d/transmission-daemon stop


service transmission-daemon stop

  • Modify the settings of the settings.json to fit your needs. Make sure to use the CORRECT paths for your setup. You have to change your password and username also. Use,


sudo nano /var/lib/transmission-daemon/info/settings.json



Web-based Media Server:

We are going to use Subsonic for this. Subsonic streams almost all video and audio files through a flash-player on a web interface. A small donation to the developers allows you to have access to apps for Android and iProducts. This means native streaming to them as well. Let's get into how to set up Subsonic.

  • Subsonic media server is written in Java, so you need to install Java runtime environment to run it. You can install openjdk 8 with the following command:

sudo apt install openjdk-8-jre

  • If you have previously installed Oracle Java 8, then there's no need to install OpenJDK. Next, download Subsonic deb package with the following command, which downloads version 6.1.5. You can check out the latest version on the Subsonic download page. If a newer version is available, simply replace 6.1.5 with the new version number.


wget /download/subsonic-6.1.5.deb
  • Install it with dpkg


sudo dpkg -i subsonic-6.1.5.deb

  • Once it's installed, the Subsonic daemon will automatically start.


systemctl status subsonic

  • Sample output:
subsonic.service - LSB: Subsonic daemon
   Loaded: loaded (/etc/init.d/subsonic; bad; vendor preset: enabled)
   Active: active (running) since Fri 2017-03-24 08:03:27 EDT; 7min ago
      Docs: man:systemd-sysv-generator(8)
   CGroup: /system.slice/subsonic.service
              └─3316 java -Xmx150m -

  • If it's not running, then you can manually start it


sudo systemctl start subsonic

  • And to enable auto-start at system boot time.


sudo systemctl enable subsonic

  • By default, Subsonic listens on, which means it accepts requests from the local network and the Internet.
  • If you installed Subsonic on a local Ubuntu computer, then type in the following address in a browser to visit the Subsonic web interface.



  • If you installed Subsonic on an Internet-facing Ubuntu server, then type in the following address in a browser to visit Subsonic web interface.



  • The default username and password are admin. After login, you should go to Settings > Users to change the admin password.
  • Also, add media folders in the settings page and click the Save button. Note that the folder must be accessible to the user Subsonic is running as. After the folder is added, click the "Scan media folder now" button, and you will be able to listen to music on the Index page.
Schedule Demo