Jump to content

Howto: create your own linux home server using Debian

What do you mean with "the domain thingy"?

you know you can make a domian in windows server and i beleve you could also do that with samba 

If you tell a big enough lie and tell it frequently enough it will be believed.

-Adolf Hitler 

Link to comment
Share on other sites

Link to post
Share on other sites

you know you can make a domian in windows server and i beleve you could also do that with samba 

You mean like an LDAP server, so you can sign in to the server on any computer and have all your data presented to you?

 

Never tried to set that up as I have no need for it. Might do so next school free period. Thanks for the suggestion :)

Link to comment
Share on other sites

Link to post
Share on other sites

You mean like an LDAP server, so you can sign in to the server on any computer and have all your data presented to you?

 

Never tried to set that up as I have no need for it. Might do so next school free period. Thanks for the suggestion :)

yeah that probebly it but i tried that once on samba and it did not realy work :L 

If you tell a big enough lie and tell it frequently enough it will be believed.

-Adolf Hitler 

Link to comment
Share on other sites

Link to post
Share on other sites

Setting up Virtual Machines (Virtualbox + phpVirtualBox)
Setting up VM's in Debian is a breeze. I will show you how to install Virtualbox and how to create a new VM. Instead of using CLI for the VM setup process, I'll be using phpVirtualBox, a fancy web UI to manage your headless Virtualbox installation.
 
Installing the necessary packages
As per the official Debian installation guide, this is the command used to install Virtualbox on Wheezy:

sudo apt-get install linux-headers-$(uname -r|sed 's,[^-]*-[^-]*-,,') virtualbox

If you're not running Wheezy yet, check out the official documentation linked above about how to get Virtualbox 4.x running on your installation.
 
The command above will install the appropriate linux-headers and virtualbox at once.

 

If you have trouble installing the linux-headers package, be sure to check out this post.
 
Installing up phpVirtualBox
Because managing your VM's via CLI is way too much work, I use phpVirtualBox to manage my VM's. In order for this to work, you'll need a working web server capable of parsing PHP. If you didn't already, you can follow my instructions to get it set up in no time.
 
First thing to do is to download the necessary source files from SourceForge. If you're on a GUI, this ain't difficult. If you're not, this poses a bit of a challenge, though. SF doesn't really like simple downloads and uses redirects for everything, which makes wgetting not as trivial as it should be. Start by acquiring the direct download link for phpVirtualBox. In order to do that, go to http://sourceforge.net/projects/phpvirtualbox/, click the big green download button. It will show a page that counts down from five. Ignore the download pop up once the download is ready, instead right click 'direct link' and copy the URL location. With me, it gave:

http://downloads.sourceforge.net/project/phpvirtualbox/phpvirtualbox-4.2-8.zip?r=&ts=1386429922&use_mirror=netcologne

but for you it will be different.
 
Once you have that link, SSH into your server and execute

wget <insert link here>

and, of course, insert your link instead of just copy-pasting ;)
 
This will give you an awefully named file that starts with 'phpvirtualbox.zip', which we'll be moving and renaming by executing

mkdir /var/www/vboxmv <insert ugly name here> /var/www/vbox/phpvbox.zipcd /var/www/vbox

Now you just need to extract the zip and your 'installation' is complete.

unzip phpvbox.ziprm phpvbox.zip

After this, you should be able to go to http://192.168.1.150/vbox. It will ask you for your credentials, but don't try to fill those in yet, we still need to configure phpVirtualBox.
 
Configuring phpVirtualBox
Now that the website is working, we need to configure it so that you can log in. Start by creating a fresh config.php file:

cp config.php-example config.phpvim config.php

In this file, you'll need to enter a username and a password:

var $username = 'simon';var $password = 'PASSW0RD';

The credentials you set here must be the UNIX credentials of the user that runs vboxwebsrv, in this tutorial this will be your account for simplicity, but it might be best to make a seperate user account for that purpose.
After that, save and  exit the file. Consider setting the permissions so that only you and Apache can read it, as your password will be stored in plain text. The password you set here will only be used to log in to the phpVirtualBox website, it isn't tied to VirtualBox or your VM's in any way.
 
Starting vboxwebsrv
This will start vboxwebsrv, which is a web service of VirtualBox that phpVirtualBox talks to. The $location you can set in config.php of phpVirtualBox points to this service. This means it is possible to have VirtualBox running on one machine and your phpVirtualBox on a completely different machine. We won't be doing that here. Since this service will hook to our terminal when run directly, we will be running it inside a screen session.
Start screen:

screen -S vbox

Then, inside that screen, simply run

vboxwebsrv

You can detach by pressing Ctrl+a followed by d. You can reattach at any time with

screen -R vbox

 
Logging in to phpVirtualBox
You are now ready to log in to phpVirtualBox for the first time. Using your browser, go to http://192.168.1.150/vbox and log in with user admin, password admin.

post-519-0-97492500-1386443953_thumb.png
The greeting screen should look farily familiar if you've ever worked with VirtualBox on a machine with a GUI. The first thing we'll be doing is changing the default password! Go ahead and click on File > Preferences.
post-519-0-38766900-1386443964_thumb.png
Go to the tab Users. Here you can change the admin password and create other accounts as you see fit.
post-519-0-30698700-1386443970_thumb.png
 
After that, you can create your new virtual machines using the fancy buttons in the top bar. The only thing you MUST do in order to connect to your VM is setting up an external display. In order to do this, open the settings of your VM and go to the tab Display. In that tab, open the sub-tab "Remote Display". Click on "Enable Server" and choose a port (default is 3389, the default RDP port).
post-519-0-32407800-1386443977_thumb.png
 
Finally, start your VM and connect to it using your favorite RDP client. You can use the built in program "Remote Desktop Connection" on Windows machines.

 

 

Back to index

Edited by MG2R
Link to comment
Share on other sites

Link to post
Share on other sites

See, this is a good guide, and I like how you set it up (posting when you can, then linking to the post, and making the first post an index of all the posts, that's smart), but I look at all this and just go "I'm going to use FreeNAS." simply because ... I don't have time for all of this.

I mean, I understand for many other people, and I understand most of what you are explaining in these posts, but ... FreeNAS takes all this and just makes it easier with a GUI. Or you can configure it with a CLI. It offers both.

It has slight bugs and limitations. I'm not saying this is pointless, because it's not. I'm just saying, if you are gonna go this far, it would be easier to use FreeNAS where you get 95% of the application and 5% of the difficulty. 

Oh well. Good guide regardless. I like it. Good job.

† Christian Member †

For my pertinent links to guides, reviews, and anything similar, go here, and look under the spoiler labeled such. A brief history of Unix and it's relation to OS X by Builder.

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

<Valid concerns>

I read you comment and didn't want to answer you before I actually tried out FreeNAS (I have, it was 5 years ago and either it or I sucked, because I couldn't get it to work). So I fired up a VM on my desktop, but I'm actually failing to install FreeNAS :/

 

I'll get back to you, though! Patience is a virtue and all that jazz ;)

Link to comment
Share on other sites

Link to post
Share on other sites

I read you comment and didn't want to answer you before I actually tried out FreeNAS (I have, it was 5 years ago and either it or I sucked, because I couldn't get it to work). So I fired up a VM on my desktop, but I'm actually failing to install FreeNAS :/

 

I'll get back to you, though! Patience is a virtue and all that jazz ;)

I have a FreeNAS box running right now. It's based on FreeBSD and thusly is Linux based. 

It offers plugins to do a great many things (I'm currently installing one to stream media to various devices where the media is encoded on the fly to optimal settings for the resolution, bandwidth, and device limitations), and lets you install those automatically through the GUI (FreeNAS 9.1.1). I have it set up as my Bit Torrent machine too (so my general use PC isn't always having to be on). 

It is slightly daunting at first, but if you know anything about Linux, it's much easier to setup. Plus there are a large number of video guides for anything the general user would want to do. 

I know it's name is "FreeNAS", but it does much more than that and is easy to set up to do such things. Relative to Debian anyway. 

Again, this is a good guide, I just thought there is an easier solution if you want a home server based on Linux. Plus, FreeNAS offers ZFS (Zetabyte File System) which has a lot of cool features for data redundancy and integrity.

† Christian Member †

For my pertinent links to guides, reviews, and anything similar, go here, and look under the spoiler labeled such. A brief history of Unix and it's relation to OS X by Builder.

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

<FreeNAS is easier than Debian and more then NAS software>

First things first: BSD is NOT Linux based. BSD and Linux are both derived from the foundations laid by UNIX. More info here.

 

Secondly, got it working in a VM now. Apparantly I have the 32-bit version of VirtualBox on my desktop for some weird reason, so the 64-bit FreeNAS kernel couldn't start. First impression: it improved a LOT since I last fired it up (like 5 years ago).

 

Now, the reasons I don't use FreeNAS are simple:

  • I prefer CLI. Seriously, I like to do everything by hand, step by step. The less clicks, the better. I don't like the fact that if I click some stuff in the FreeNAS GUI, it does some stuff and I have no idea how it works. Yeah, doing things by hand can be a pain, but it is how I got to know most of what I know about computers.
  • I don't know BSD. I don't use BSD. I don't have the time to get to know BSD. I wish I had.
  • I know Linux (especially Debian), to a certain extent. I have been using Debian-based distros for the better part of a decade now. I feel comfortable working with them and I like the way the operate.

I agree with you that, for many people, this tutorial is over the top. A lot of people are way better of just running FreeNAS, click some stuff and be done with it.

I agree with you that FreeNAS is more than NAS software and it is powerful enough to do way more.

 

All of that said, I don't think FreeNAS is so much easier to set up than the installation I have here. If I wanted a system like mine running on FreeNAS, I would have to look everything up as well. Whether it be in text or video form, I would still be looking at tutorials before doing anything. Sure things like creating a windows share are easy to do without a tutorial on FreeNAS. Guess what? I can do that with my eyes closed on Debian.

I get that FreeNAS seems easier, because a lot of people have never worked with a CLI before. I was there once too. I figured it out on my own, using lots of guides. I have now, many years later, written this, which will (in my eyes) get anyone interested in computers capable of working with a CLI interface in half an hour.

 

I like to think of a vanilla Debian install (or ArchLinux, Solaris, FreeBSD, ...) as a source invaluable knowledge, useful in a tech job. Sure, anyone can click some buttons, but who knows how to work with a CLI? I know I do. It has gotten me my master's thesis, as I was the only applicant actually comfortable with Linux. For that alone, I think it is awesome to set up your system without the help of a GUI. And hey, if you want a GUI, Debian comes with that as well. You want a point-and-click web UI? Install webmin and you're good to go.

 

Again, I get what you're saying, but I think this tutorial definitely has a place. And I think that, for anyone willing to learn, Debian is a way more powerful and -above all- universal OS to learn than FreeNAS.

 

Also, as stated in previous comments, I like to document my work for later reference, so why not write it in a way everyone can understand?

Link to comment
Share on other sites

Link to post
Share on other sites

Wanna do it for me?

Main Rig: -FX8150 -32gb Kingston HyperX BLUE -120gb Kingston HyperX SSD -1TB WD Black -ASUS R9 270 DCUII OC -Corsair 300r -Full specs on Profile


Other Devices: -One Plus One 64gb Sandstone Black -Canon T5 -Moto G -Pebble Smartwatch -Nintendo 2DS -G27 Racing Wheel


#PlugYourStuff - 720penis - 1080penis - #KilledMyWife - #LinusButtPlug - #HashtagsAreALifestyle - CAR BOUGHT: 2010 Corolla

Link to comment
Share on other sites

Link to post
Share on other sites

<Valid Concerns>

I understand that and it's cool and everything. I was just pointing it out so it is known. 

I guess what makes FreeNAS better for new users, imo, is that there is a lower chance of screwing everything up and having to start over. One typo with the command prompt, depending on the command and you can be SOL. GUI's are safer in that way. It has the full option to use CLI if you wish. There's a Shell button on the menu where you can basically do everything you want.

Plus, I wouldn't say you'd have to Google everything for it. Many of the things are straight forward, like they are in Windows. Say I want to share something, it's gonna be under sharing. Or add storage. It's gonna be under storage. Setting up the Bittorent thing is slightly more complicated because you have to mount a storage point for the downloads to go to, but still. It's mostly straight forward.

Also, that thing about FreeBSD, all your commands you've listed in this guide, with the exception of apt-get, work in FreeNAS' shell. In fact, I use them to do stuff all the time.

If you just want a file server, that's easy. If you want a file server that you can SSH into, that's slightly more complicated, but still somewhat easy. 

One thing FreeNAS does is it carries all the packages and dependencies with it. So you don't really have to deal with that part.

I'll just use your words then. You keep saying this is a few hours of work to fully set up. Whereas, I could download FreeNAS, and set up a File Server, Bit Torrent client, and Streaming server in about 1.5 hours. 

† Christian Member †

For my pertinent links to guides, reviews, and anything similar, go here, and look under the spoiler labeled such. A brief history of Unix and it's relation to OS X by Builder.

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

Wanna do it for me?

What do you mean? Do I want to set your server up? What would be the fun in that? You would have no idea what is going on with your machine and you would always need me to fix something when it's broken.

 

I understand that and it's cool and everything. I was just pointing it out so it is known. 

I guess what makes FreeNAS better for new users, imo, is that there is a lower chance of screwing everything up and having to start over. One typo with the command prompt, depending on the command and you can be SOL. GUI's are safer in that way. It has the full option to use CLI if you wish. There's a Shell button on the menu where you can basically do everything you want.

Plus, I wouldn't say you'd have to Google everything for it. Many of the things are straight forward, like they are in Windows. Say I want to share something, it's gonna be under sharing. Or add storage. It's gonna be under storage. Setting up the Bittorent thing is slightly more complicated because you have to mount a storage point for the downloads to go to, but still. It's mostly straight forward.

Also, that thing about FreeBSD, all your commands you've listed in this guide, with the exception of apt-get, work in FreeNAS' shell. In fact, I use them to do stuff all the time.

If you just want a file server, that's easy. If you want a file server that you can SSH into, that's slightly more complicated, but still somewhat easy. 

One thing FreeNAS does is it carries all the packages and dependencies with it. So you don't really have to deal with that part.

I'll just use your words then. You keep saying this is a few hours of work to fully set up. Whereas, I could download FreeNAS, and set up a File Server, Bit Torrent client, and Streaming server in about 1.5 hours. 

Yes, the commands are similar, because FreeBAS and Linux are both derived from UNIX, where the basic commands all were 'invented'. How they work under the hood, though is a bit different.

 

The 'couple of hours work' I talk about is for a completely new Linux user that has never ever touched a CLI. Put someone like that in front of this tut and it will take them that long to complete it, simply because they will have to read a fair amount, because I like typing walls of text and explaining what they are actually doing. It will also take longer, because this tutorial covers a lot more topics than just filesharing and torrenting (actually, I never put in bittorrent, will fix that tonight).

I recently set up a file sharing, bittorrent and web server with SSH access and a static IP address at a LAN party in under a 1.5 hour (including OS installation, which takes longer on Debian vs. FreeNAS). That is because I know from the top of my head how it's done, because I have done it a lot. Put me in front of a FreeNAS box and you get a whole different story.

You need to keep in mind when you're quoting times like that, you need to consider that you will do something a lot faster than someone that has never ever touched whatever you're doing.

 

You could probably do this complete tutorial in 2 hours, if you just don't think and execute the commands one by one.

Link to comment
Share on other sites

Link to post
Share on other sites

... it would be easier to use FreeNAS where you get 95% of the application and 5% of the difficulty.

Windows + Virtualbox all the way baby!  :P

 

FreeNAS has come a long way since even a couple of years ago.  At that time (8.x with new interface), FreeNAS was too limited.  Great for iSCSI.  ZFS ok, but RAIDz2 was not properly working two years ago when I tried.  No native "alarm or active notification for array failures".. not RAID "migration" ability...  big PITA for managing.  To much limitations and commitment of hardware.  9.x looks better in specs... might try it out with my new drives.

 

 

I would still do a plain linux + Virtualbox install.  Snapshots for VM will save a beginner LOTS of time and frustration.  Beginner can also try different types of "media centers" too.

My Rigs (past and present)

Link to comment
Share on other sites

Link to post
Share on other sites

What do you mean? Do I want to set your server up? What would be the fun in that? You would have no idea what is going on with your machine and you would always need me to fix something when it's broken.

 

Well....

yeah....

 

Nevermind.

fckuk_this_thread_im_out_of_here_gif.gif

Main Rig: -FX8150 -32gb Kingston HyperX BLUE -120gb Kingston HyperX SSD -1TB WD Black -ASUS R9 270 DCUII OC -Corsair 300r -Full specs on Profile


Other Devices: -One Plus One 64gb Sandstone Black -Canon T5 -Moto G -Pebble Smartwatch -Nintendo 2DS -G27 Racing Wheel


#PlugYourStuff - 720penis - 1080penis - #KilledMyWife - #LinusButtPlug - #HashtagsAreALifestyle - CAR BOUGHT: 2010 Corolla

Link to comment
Share on other sites

Link to post
Share on other sites

Ugh, what happened to the Internet?

wasnt the internet alwase like this?? 

If you tell a big enough lie and tell it frequently enough it will be believed.

-Adolf Hitler 

Link to comment
Share on other sites

Link to post
Share on other sites

Also, is there a *security* benefit from using key pairs with SSH? I thought the system of using a key file to log in was just to not need to enter a password every time you connect. Or am I seeing this wrong?

there is a HUGE security benefit from using asymetric key authentication, and disabling password login.

Link to comment
Share on other sites

Link to post
Share on other sites

Ugh, what happened to the Internet?

I happened.

Main Rig: -FX8150 -32gb Kingston HyperX BLUE -120gb Kingston HyperX SSD -1TB WD Black -ASUS R9 270 DCUII OC -Corsair 300r -Full specs on Profile


Other Devices: -One Plus One 64gb Sandstone Black -Canon T5 -Moto G -Pebble Smartwatch -Nintendo 2DS -G27 Racing Wheel


#PlugYourStuff - 720penis - 1080penis - #KilledMyWife - #LinusButtPlug - #HashtagsAreALifestyle - CAR BOUGHT: 2010 Corolla

Link to comment
Share on other sites

Link to post
Share on other sites

there is a HUGE security benefit from using asymetric key authentication, and disabling password login.

Yes, so I have learned by now. The only problem with completely disabling password login is that you can't log in from systems you have never logged in with before, i.e. I can't work on my server when my laptop's battery is dead and I'm not at home.

Link to comment
Share on other sites

Link to post
Share on other sites

No, there was once a marvelous time, where people still used words instead of images to communicate.

 

 

didnt they say a picture says a 1000 words or something like that :D

If you tell a big enough lie and tell it frequently enough it will be believed.

-Adolf Hitler 

Link to comment
Share on other sites

Link to post
Share on other sites

I really like this "no-nonsense" approach when it comes to guides

Could you show how to use this server for a specific function?

I would like to be able to run a Minecraft server on a headless version of Debian

The best way to predict the future is to invent it

Link to comment
Share on other sites

Link to post
Share on other sites

I really like this "no-nonsense" approach when it comes to guides

Could you show how to use this server for a specific function?

I would like to be able to run a Minecraft server on a headless version of Debian

A minecraft server has been requested before. I am not an expert on this, altough I help managing the backend of a reasonable MC server hosted by a friend of mine. Consider MineCraft to still be on the agenda. I might, however, throw that in a completely seperate thread, as it is something that can get quite lengthy if done right.

Link to comment
Share on other sites

Link to post
Share on other sites

PPS: for those interested, you can find the build log of this server here

The link is broken and results in a 404.

Nice guide, though I'm very late to it.

Link to comment
Share on other sites

Link to post
Share on other sites

Windows + Virtualbox all the way baby!  :P

 

FreeNAS has come a long way since even a couple of years ago.  At that time (8.x with new interface), FreeNAS was too limited.  Great for iSCSI.  ZFS ok, but RAIDz2 was not properly working two years ago when I tried.  No native "alarm or active notification for array failures".. not RAID "migration" ability...  big PITA for managing.  To much limitations and commitment of hardware.  9.x looks better in specs... might try it out with my new drives.

 

 

I would still do a plain linux + Virtualbox install.  Snapshots for VM will save a beginner LOTS of time and frustration.  Beginner can also try different types of "media centers" too.

FreeNAS offers the ability to take snapshots of your volumes and export your  settings. The equivalent of a snapshot of the whole OS. 

† Christian Member †

For my pertinent links to guides, reviews, and anything similar, go here, and look under the spoiler labeled such. A brief history of Unix and it's relation to OS X by Builder.

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

OK, too much stuff to quote, but reading the most recent part of the discussion,

just a bit of blabla from me ;):

I, too, share MG2R's affinity for the CLI. Not because it's cool or CLI gurus are

the master race or anything like that (though it is cool, and I am by no means a

guru), but simply because you can get a much better idea of what the system is actually

doing than if you just click a GUI button. And, maybe even more importantly, if you

ever need to work on a system where you don't have a GUI, you will still know your

way around and won't just stare at the screen like a deer at headlights.

But indeed, as Vitalius has said, GUIs do have their benefits, and I would never tell

my mom to install Arch from scratch (though TBH, installing Arch is not actually that

difficult; tons of tutorials on youtube). And I have heard very good things aboud

FreeNAS (haven't tried it myself though).

As for the BSD vs. Linux thing: I played around with FreeBSD about a year ago and

had it running on my laptop for a few months. Setting it up was not that difficult

(though getting it to run on a ZFS root took some tinkering), but I found maintaining

it to be quite a bit of a larger hassle than Arch. Blabbering on about how a full

system upgrade is done won't really do much good for those unfamiliar with the process,

but suffice it to say, I found it to be a highly non-trivial matter as a beginner,

and I learned to value the advantages of a good package manager (yeah, I know, there

are quite a few who consider Arch's package manager to be broken/inadequate or whatever,

but personally I'm rather fond of it).

I quite liked the system itself, but then again, in daily use I couldn't really tell

much of a difference between FreeBSD and Arch, it was (and is) system maintenance

and configuration where they truly differ (well, that and the code base, of course).

Also, I have come to really like Arch's rolling release model TBH, which FreeBSD

does not have (and from reading up, doing a release upgrade can actually be a bit

of a hassle as well, though I've never done one personally, so I might of wrong

about that).

As a side note: I did some reading up when I played around with BSD, and it is my

understanding that the FreeBSD codebase is directly related to UNIX (and the only

reason FreeBSD isn't actually a certified UNIX is because it would be too expensive

or something like that), whereas the GNU/Linux OS is a re-implementation of UNIX'

behavior and tools, but written from scratch (that was the whole point as far as

I know, making sure that the GNU project's codebase was not tainted by the copyright

issues plagueing the BSD codebase in the 80's and early 90's).

In the end I'd say picking the right solution is much more about picking what best

suits your preferences, skills and interests, than which solution is truly and definitely

technically superior. There are many ways go get a good server running either on Linux

or something BSD-related, this guide is for those who would like to run a specific

setup. Anyone is free to run FreeNAS (hehe) or Arch, Gentoo or w/e, it's just that

this is not the guide for that (obviously :rolleyes: ).

Anyway, this concludes today's essay session... :lol:

BUILD LOGS: HELIOS - Latest Update: 2015-SEP-06 ::: ZEUS - BOTW 2013-JUN-28 ::: APOLLO - Complete: 2014-MAY-10
OTHER STUFF: Cable Lacing Tutorial ::: What Is ZFS? ::: mincss Primer ::: LSI RAID Card Flashing Tutorial
FORUM INFO: Community Standards ::: The Moderating Team ::: 10TB+ Storage Showoff Topic

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×