# What's the best setup for a starter webhost?



## wisdown (Nov 30, 2013)

Hey guys,

First thing I need say English isn't my native language, so I hope you guys can understand me.

Actually I have an PC with this hardware:

Core 2 Quad Extreme [link=http://ark.intel.com/products/34444/Intel-Core2-Extreme-Processor-QX9770-12M-Cache-3_20-GHz-1600-MHz-FSB#infosectionmemoryspecifications]QX9770[/link] 3,2 GHz
16 GB DDR2 non ECC (Generic brand)
three HDs SATA 2 [link=http://www.wdc.com/wdproducts/library/SpecSheet/ENG/2879-701229.pdf]WD10EARS[/link] (Yes *I* know the Green line of HD's aren't good to servers, this is the worst purchase of my life, but *I*'m broke and have no money to exchange it now.)
[link=http://www.asus.com/Motherboards/P5Q_Deluxe/]Asus P5Q Deluxe[/link]
So basically it is an old workstation where *I*'m trying make a server for selling some host service until I can grab money to buy a real server.

I'm using this PC with a Windows 2008 R2 host to emulate seven Virtual PCs in VMware on this setup:

Firewall PFsense (amazing imo) - FreeBSD (4 GB RAM dedicated)
DNS Server 1 - Debian (512 MB RAM dedicated)
DNS Server 2 - Debian (512 MB RAM dedicated)
Database Server for MySQL with MariaDB snapin - Debian (2 GB RAM dedicated)
Varnish Cache Server - Debian (2 GB RAM dedicated)
Apache - Debian (2 GB RAM dedicated)
Mailserver Dovecot - Debian (1 GB RAM dedicated)
I am using [link=http://ispconfig.org/]ISPConfig[/link] to manage all the servers.

Until July 2013. The OS Host is Windows 2008 R2. I was using Debian 6 without problems. It was with three personal domains for testing, I was getting good ranks in [link=http://developers.google.com/speed/pagespeed/insights/]pageinsight[/link] and I was believing it was ready to sell a host service.

After July 2013 I saw the new Debian 7 version and did the distribution upgrade. So the upgrade gave me a lot of errors (for example Dovecot configuration files changed a lot), and after having fixed most of then, the three websites now are very slow, at [link=http://developers.google.com/speed/pagespeed/insights/]pageinsight[/link] *I*'m now getting a warning about server response time where it says the load average is taking 1400 ms (this never happened on Debian 6). So it seems *I* screw up everything and in the next month *I* have plans to format the PC.

After December 2013 I have a plan to use [link=https://www.vmware.com/products/vsphere/]VMware vSphere 5.5[/link]. Then *I* want to get into BSD world, and it is at this point where *I*'m looking for get some advice from you guys.

The first problem *I* saw is I don't have the [link=http://ispconfig.org/]ISPConfig[/link] support, *I* found a similar admin called [link=http://www.zpanelcp.com/]zPannelCP[/link]. But, this panel seems to only work with all in one box, and *I* like a multiple/dedicated server structure. For now, *I*'m ignoring this, *I*'m not going to pay for [link=http://www.parallels.com/products/plesk/]Plesk[/link] or [link=http://cpanel.net/]Cpanel[/link], *I* already have tried those, and they didn't work for me since my ISP doesn't let me set the valid IP on the NIC, *I* need to forward my static IP using the pfSense firewall to local IPs. I had a look on the [link=http://www.webmin.com/]webmin[/link] also, but, it seems that to get unlimited domains *I* will need to pay for a license to each server.

If someone have any hint from free server admins, please feel free to say I will check it.

Back to the setup of servers, my question is about what *I* should use? Reading about FreeBSD and DragonFly BSD, my first guess is doing this:

Firewall pfSense (amazing IMO) - FreeBSD (4 GB RAM dedicated)
DNS Server 1 - FreeBSD (512 MB RAM dedicated)
DNS Server 2 - FreeBSD (512 MB RAM dedicated)
Database Server for MySQL with MariaDB snapin - DragonFly (2 GB RAM dedicated)
Varnish Cache Server - DragonFly (2 GB RAM dedicated)
Apache - DragonFly (2 GB RAM dedicated)
Mailserver Dovecot - FreeBSD (1 GB RAM dedicated)
I have read about how DragonFly BSD can handle databases and webservers better under stress , this is why in the first moment *I*'m willing to use it as a webserver/database server.

So, what hints can you guys give to my limited setup? The goal is to try hosting maximum small websites/blogs in this limited box until I get enough money to buy a Xeon server. I have no knowledge on BSD world yet. I can't spend a lot of time fixing the things, *I* can spend time learning something to set up and wish to spend minimal time on updates or small fixes (I was getting this on Debian 6, after the upgrade to Debian 7 this became an nightmare). I can change the previous memory dedicated setup. Can I trust on DragonFly BSD updates like FreeBSD updates? I mean is there a chance that tomorrow DragonFly BSD says they are going to stop their development and then *I* have will lost all time/work setting up the webserver and database server? Will the compatibility using ports let me have Apache, PHP and mostly Linux applications (Dovecot, BIND9, etc.) running pretty well?

Thanks in advice!

PS.: I dind't find any DragonFly BSD forum, just mailing lists, so, if it isn't allowed to ask about DragonFly BSD here, please ignore the DragonFly BSD questions.


----------



## sossego (Nov 30, 2013)

*Re: Whats the best setup for an starter webhost?*

4.4 BSD derived with CLang as the compiler. Your GCC has become too patchy and is showing a lot of holes.


----------



## wisdown (Nov 30, 2013)

*Re: Whats the best setup for an starter webhost?*



			
				sossego said:
			
		

> 4.4 BSD derived with CLang as the compiler. Your GCC has become too patchy and is showing a lot of holes.



The lastest stable version isn't FreeBSD 9.2? Or in my specific scenario the FreeBSD 9.2 will be so heavy and *I* need go to 4.4?


----------



## sossego (Nov 30, 2013)

*Re: Whats the best setup for an starter webhost?*

No. You understood what I meant. The latest is 11.0 for testing and 10.0 for production. CLang isn't fully enabled for everything. As I stated, a lot of GCC type code is patchy and with holes. You're going to need quad core for quick building and at least a dual core for ports. It's going to be best to run Linux emulation within a jailed setup. It is also much safer. The problem of everyone being automatically entered into su's user group doesn't exist unless you create it. Encyclopedia Dramatica much?


----------



## wisdown (Nov 30, 2013)

*Re: Whats the best setup for an starter webhost?*

So this means *I* will have poor performance running FreeBSD and DragonFly BSD?

In VMware *I* can set it up to use the four cores per virtual machine, but the recommendation is to keep only one core, because this increases overall performance allowing the timeslice share from the processor time between virtual machines be better. For example:

_Four virtual machines with one core each requesting the processor:_
The first three virtual machines are served at the same time (i.e. same tick). ASAP there at least two free cores. The fourth virtual machine will be served, the current request ends, goes to next request in the queue or enters the wait state.

_Four virtual machines with four cores each requesting the processor:_
The first virtual machine will be served with one tick (the hardware has only four cores), the request ends, goes to the next one in the queue. The second virtual machine will be served with one tick (the hardware has only four cores), the request ends, goes to the next in the queue. The third virtual machine will be served with one tick (the hardware has only four cores), the request ends, goes to the next in the queue. The fourth virtual machine will be served with one tick (the hardware has only four cores), the request ends, goes to the next request in the queue or enters the wait state.

_Four virtual machines with two cores each requesting the processor:_
The first and second virtual machine will be served with one tick (the hardware has only four cores), the request ends, goes to the next in the queue. The third and fourth virtual machine will be served with one tick (the hardware has only four cores), the request ends, goes to the next request in the queue or enters the wait state.

This is why VMware says to use the minimal number of cores per each virtual machine.

By the way, on Debian I'm using Jailkit with this: [link=http://olivier.sessink.nl/jailkit/]Jailkit[/link]. Reading about FreeBSD it seems there is a similar default feature included right? Could you please gimme give me some link for reading more about the FreeBSD default Jails?

And about the previous setup, what you think? Should I change the RAM of the virtual nachines?

I have no idea when I should put everyone in su's user group, usually I haven't set it up, the default webadmins take care of which group every user will run with minimal privilege. But I will do some research on the [link=http://www.zpanelcp.com/]zPanelCP[/link] forum to get accurate information about this.


----------



## sossego (Nov 30, 2013)

*Re: Whats the best setup for an starter webhost?*

Try bare metal if you are going to run the system. Virtualization is lacking in many respects. <--My opinion.


----------



## wisdown (Nov 30, 2013)

*Re: Whats the best setup for an starter webhost?*

For now I can't spend money on a new system, the desired goal is to use the current hardware and grab some money to buy real server hardware, with ECC memory, SATA 3 or FreeNAS, etc. Do you think I should stay on Linux because of my hardware limitation? I mean like try CentOS?


----------



## sossego (Nov 30, 2013)

*Re: Whats the best setup for an starter webhost?*

If you want to use the machine, why not just run it natively? It should work.  Get an old piece that is no more than four years old and install it on that.  What you need is a feel for the system on real and not virtualized hardware. See what works the best for each system and use them in tandem with each other.


----------



## wisdown (Nov 30, 2013)

Because natively I will need to set up everything on one server. And in virtual I can get multiples servers, I can if necessary copy the DNS virtual machine to another old PC for example.

I can also do snapshots on every server before setting something or updating something, and in case of an error I will be able to restore the server. Having multiple servers, usually bugs/conflicts occur with only one program, for example Dovecot, then in this scenario I just need get the mailserver down and try to fix it (other servers will be online), or restore the snapshot and try to fix it another time.

All in one box doesn't give me those alternatives, having all stuff natively if something gets broken after an update or wrong setup most of the time I will have everything down: mail/webserver/DNS server/etc.

Another point is: after I get money to buy an real server, I will just need to copy the virtual machines, since everything would be running fine (the part I said before about spending much time on a correct setup and in the future saving time on maintenance).

I won't be needing to:

 Install everything again.
Set it all up again.
Migrate clients.
Solving the problems from the setup.
Etc.


----------



## sossego (Nov 30, 2013)

FreeBSD as the base with two jailed instances of Linux. Use ZFS as referenced to in the tutorials for Debian. Search for building a kernel - Linux, that is - and you will find a link for CentOS on FreeBSD.


----------



## wisdown (Nov 30, 2013)

sossego said:
			
		

> FreeBSD as the base with two jailed instances of Linux. Use ZFS as referenced to in the tutorials for Debian. Search for building a kernel - Linux, that is - and you will find a link for CentOS on FreeBSD.



Thanks for the hints, *I* think *I* found the links from your description: [link=https://wiki.freebsd.org/Image/Linux/CentOS55]FreeBSD Wiki[/link]. If this is correct, it could not work for me because of the limitations:


> *Known Limitations*
> 
> _    Apache (httpd) will not run in the jail unless the installed apr wass built without epoll support (which is not true of the CentOS RPM). I built a new RPM on a (real) 32-bit CentOS machine after renaming /usr/include/sys/epoll.h (the configure script does the right thing when it doesn't find it).
> 
> ...


I will need to compile stuff like the APC Apache module and others. This way, it seems like [link=https://www.vmware.com/products/vsphere/]VMWare vSphere 5.5[/link] still is the best solution for me.


----------



## sossego (Nov 30, 2013)

You can use qemu or VirtualBox and run CentOS there. The advantage to qemu is that the qcow files can be transferred if you copy to media-rw or FAT formatted type. I'm surprised that you did not consider this option earlier.


----------



## wisdown (Nov 30, 2013)

I will give [link=http://wiki.qemu.org/Main_Page]qemu[/link] a try, I have heard about it years ago and all old benchmark and reviews said it wasn't ready for a production environment because of bugs, slow perfomance, etc. Reading a bit now, it seems that nowadays the performance can be better than VMware and become more solid.

VirtualBox I already did many tries, and there seems to be a bug on my PC or when use it working with three NICs (WAN/DMZ/LAN), sometimes there are huge lag spikes increasing the latency. Sometimes the entire network becomes unstable (example: nothing in the DMZ NIC works).

Do you think I need to change the previous dedicated RAM setup, or is it enough for every server (for use in qemu)?


----------



## sossego (Dec 1, 2013)

Find out what services you can run from and within a jail. 
Dedicate a reasonable but not ridiculous amount of memory to the jails. I think the base will always equal 256M 256 MB minimum for a smooth performance on any architecture.
That which is left over can be ran in qemu. You have the option of picking a processor class and using Xen or kqemu for virtualization performance. Bummer is that it only will emulate for the native architecture - amd64/x86_64 i386 on i386.
Base jail 1, jail 2 and qemu + kqemu/Xen/or even VirtualBox if you want.

All will work for you.


----------

