APC article: How to Build a Home/Small Business Web Server in no Time

JeevesBond's picture

He has: 3,956 posts

Joined: Jun 2002

This article goes through a quick and easy process for building a home or small business web server. The finished server will have Web server software, PHP, Perl, Ruby, MySQL, PostgreSQL, quotas, e-mail server software, anti-spam and anti-virus software, and a lot more good stuff. To top it off it will have a Web based GUI to control it all. Read on to learn how.

http://www.apaddedcell.com/building-home-small-business-web-server-fast

This topic is for discussion and questions about the article.

a Padded Cell our articles site!

pr0gr4mm3r's picture

He has: 1,502 posts

Joined: Sep 2006

Is there a reason why you went with Debian? I have always had to use Fedora Core or CentOS because cPanel will only support those. Never heard of VirtualMin, I will have to check that out.

Greg K's picture

He has: 2,145 posts

Joined: Nov 2003

Great article!

Going to grab a spare computer from storage this weekend and give it a try.

-Greg

pr0gr4mm3r's picture

He has: 1,502 posts

Joined: Sep 2006

Just tried this tutorial on a VMWare image. It reminds me a lot about Webmin, which is what I use for my home server. That install script took like 10 minutes, compared to several hours going through other tutorials.

JeevesBond's picture

He has: 3,956 posts

Joined: Jun 2002

Is there a reason why you went with Debian?

When I started out on the article that was all Virtualmin supported, they've added CentOS and Fedora since then (started this article months ago, but never got the time to finish it!)

Also, at heart, I'm a Debian zealot. What is this CentOS you speak of? That's not the Debian way of doing things!

/me Starts flamethrower for yet another daft distro war. Laughing out loud

I have always had to use Fedora Core or CentOS because cPanel will only support those.

This makes sense, and is why I pitched the article at people building a home/small business server. It probably isn't right for a hosting company (customers demand cPanel/Plesk don't they?)

It reminds me a lot about Webmin, which is what I use for my home server. That install script took like 10 minutes, compared to several hours going through other tutorials.

Virtualmin includes Webmin, the link is on the top left (in case anyone missed it).

Frankly, Virtualmin/Webmin are pretty confusing and ugly interfaces. It's the installer and the functionality that are fantastic. As you said pr0gr4mm3r, it's ~10 minutes to get all the software a Web developer needs. Smiling

Greg K: glad you liked it, thanks for the compliments!

a Padded Cell our articles site!

pr0gr4mm3r's picture

He has: 1,502 posts

Joined: Sep 2006

It probably isn't right for a hosting company (customers demand cPanel/Plesk don't they?)

Yup, so I am pretty much tied to it for the time being.

Frankly, Virtualmin/Webmin are pretty confusing and ugly interfaces. It's the installer and the functionality that are fantastic.

Still beats editing config files though. Wink

Greg K's picture

He has: 2,145 posts

Joined: Nov 2003

Well, here it is, a month later and I finally got to give this article a try.

I must say, all went very smooth, directions are right on on their descriptions and screen shots.

I did two servers, one was an AMD K6-2 450mhz system with 512 ram. For a basic testing server, it wasn't too bad other than some installs taking a while and just about very page in Virtualmin was painfully slow. Once I got through it, had a nice little test server to play with.

Of course, this had me wanting a more realistic server. So I hopped on craigslist, and scored an excellent deal. A mom selling her daughter's desktop computer because it had a virus and she got a laptop.... $50 for complete computer system (HP 3.0ghz Celeron, 40gig drive, cd burner/dvd-rom, 256megs of ram, monitor, keyboard and mouse. And came with recovery partition (that worked).

So I swapped out the HD for another 40g (looking to use a true server soon, so wanted to keep the windows recovery to give this system to someone for Christmas), added in a 512stick i had laying around, and now I'm the proud owner of a web server, that actually has a live domain name tied to it and it available for the world!

A note for those looking to go this route, I have a regular Motorola wireless router, and it has the settings to auto tie into DynDNS's service, and easily allowed me to map out the vitrual servers.

I set them up giving each their own IP address on my system, the server itself was 192.168.38.20, so for the virtual servers, I used .21, .22 & .23.

Now with my router, as it is just me working on the server, I have SSH and FTP for my domain name to use the regular server IP, but HTTP goes to 21. Instead of getting other domains for my "sample servers", I just mapped out the ports. ie:

http://www.domain.com/ -> Virtual server on .21
http://www.domain.com:2080 -> Main server on .20
http://www.domain.com:2180 -> Virtual server on .21
http://www.domain.com:2280 -> Virtual server on .22
http://www.domain.com:2380 -> Virtual server on .23

there may be other ways (ie. actaully setting up a virtual server for domain.com and another for beta1.domain.com etc. just haven't gotten that far. DynDNS will forward *.domain.com to my IP address, so can probably do that.

Anyhow, again great article, Very fast and simple for a beginner to play with.

-Greg

JeevesBond's picture

He has: 3,956 posts

Joined: Jun 2002

Nice one Greg, am really glad it worked for you! Smiling

it wasn't too bad other than some installs taking a while and just about very page in Virtualmin was painfully slow.

Have you tried turning some of the services off, particularly the anti-virus? Virtualmin installs everything but thekitchensink-server. Smiling

a Padded Cell our articles site!

Greg K's picture

He has: 2,145 posts

Joined: Nov 2003

Well as it is now on a decent server, works plenty fine.

The downside was a friends computer running win 2000 had something happen to it, so that IE wouldn't display any pages, and firefox would not even load. The system was running way slow.

So I turned around and sold her the $50 system I just purchased, and in exchange for setting it up for her, I got to also have her old system minus the hard drive, which is a 1.5ghz system with 512 ram, and that is still plenty fast enough for my needs of a server.

So all in all I have followed the guide about 4 times, and thing I could do it without the guide now LOL.

I loved that ti did recognize a USB drive when plugged in, and was able to share that with home systems, however it did it as read only (possibly due to being NTFS). I did find a nice script that would go through and find what /dev/sd## was your usb drive and auto mount it when plugged in. (if you just leave it plugged in all the time, it appears to be the same every time you boot though)

Setting up the share was easy, just also added samba. i think that was it:

apt-get install samba smbclient swat

then at that point can go to http://www.domain.com:901 and administer samba

Maybe that would make a good APC article, setting up samba for use in a home / office environment. I had in the past even played with using samba for user authentication for windows system so you could go to any computer in an office and log in with same settings, and even if you want have the roaming desktop (my files, desktop, etc, forget the actual name for it).

-Greg

Greg K's picture

He has: 2,145 posts

Joined: Nov 2003

Ok, last night I went to actually start using my web server, and came across something I had never seen before.

I FTP'd into the server using the user/name password for Virtual web server to change the "default" home page. When I saved the file though, it didn't write the file, but instead made the already existing file be a zero byte file.

I did a shell login with the same user/password, and was able to change it there.

Then I tried uploading a bunch of pictures to the server. Using FTP, got the same results, it would create a filename on the server, but fail to actually upload them, leaving a zero byte file for each.

I made sure that the directory was owned by the user/group of the person logged in and had the correct permissions, but still no luck.

I have gotten permission errors before where it it wouldn't let me create the file at all, but have never seen where it created the filename but not let the file actually upload. The only thing I can think of is some type of quota system set up.

Anyone have ideas where to look, this is the first time I'm using the VirtualMin thing, let along actual virtual servers, so I'm not sure where to look.

Thanks.

-Greg

pr0gr4mm3r's picture

He has: 1,502 posts

Joined: Sep 2006

I wonder if passive mode isn't working on the ftp connection. Have you tried disabling it? Firewalls will block the passive ports if not configured correctly. May also want to try some transfers in both binary and text mode.

If you were able to so it in a shell, then quota limits shouldn't be an issue.

JeevesBond's picture

He has: 3,956 posts

Joined: Jun 2002

Thanks for the article suggestion by the way, Greg. I may well follow up on that. Smiling

Greg K's picture

He has: 2,145 posts

Joined: Nov 2003

Well I'm going to try re-doing the server tongiht, for some reason, on top of the FTP issues, now the server shows that mySQL and FTP both are stopped and will not restart. The only thing I had done was the updates listed in WebAdmin.

-Greg

JeevesBond's picture

He has: 3,956 posts

Joined: Jun 2002

Greg: you might want to look at your system logs (less /var/log/apt/term.log and less /var/log/syslog in particular), there may be some clues as to what went wrong. Also try running dpkg --configure -a, it sounds like some package is misconfigured.

Hopefully you won't need to re-install, just fix the packages and start the affected services. Smiling

a Padded Cell our articles site!

They have: 32 posts

Joined: Dec 2008

Nice! Great article!

They have: 2 posts

Joined: Apr 2009

Thanks for the article, however I'm having a problem. I'm trying to run a webserver on an old dell laptop, and i've never seen a webserver nor ran linux before so I might be biting off more than I can chew, but we'll see. FYI I just tried loading Ubuntu and Ubuntu Server but neither worked: Ubuntu - do to my lack of experience with apt-get, configs, make installs and synaptics. Ubuntu Server - due to uncompatibility with my CPU.

Back to the article. I've loaded Debian on the laptop but I'm stuck at the Virtualmin section. After the wget command it has problems resolving software.virtualmin.com is this still the correct address? virtualmin.com doesnt look to be free software. Is there another set of admin tools that come with PHP MySQL that I should use?

Im not even sure that this set up works with installing on a laptop. Is this only for a virtual environment? any suggestions?

Greg K's picture

He has: 2,145 posts

Joined: Nov 2003

I just set up a server using this article last week. I'll be doing it again tonight due to that server had a flakey NIC in it, so going with a trusted 3com Smiling

-Greg

They have: 121 posts

Joined: Dec 2008

Surely there is a way to configure new hardware without re-installation?

Cheers,
Shaggy.

Greg K's picture

He has: 2,145 posts

Joined: Nov 2003

Well I'm also swapping around some hard drives, so was just as easy to re-install.

They have: 2 posts

Joined: Apr 2009

Let me know if it works Greg, I'll try it again tonight as well. Any idea on why the command:

is telling me unable to resolve server. I am writing it on one line with the returns as spaces. The instructions say to copy and paste it in, but im doing it on another computer.

Greg K's picture

He has: 2,145 posts

Joined: Nov 2003

Unable to resolve server sounds like your the DNS isn't working. (perhaps your ISP's DNS server acting up).

Try editing your /etc/hosts file and add the following line:

70.86.4.226 software.virtualmin.com

This will tell the system where to find software.virtualmin.com and not require a DNS lookup.

I got home late tonight, so not going to do the setup, waiting till this weekend to buy some SCSI drives for my server if I can find some locally.

-Greg

They have: 121 posts

Joined: Dec 2008

SCSI/SAS drives for a home server? Whoa!

Cheers,
Shaggy.

They have: 121 posts

Joined: Dec 2008

Also check the file /etc/resolv.conf
It should list the nameservers the machine should consult for DNS queries.
It should look like

nameserver 1.2.3.4
nameserver 4.5.6.7

where 1.2.3.4 and 4.5.6.7 are reachable, and answer DNS queries for you.

You 'kids' and you're crazy admin consoles! Laughing out loud

Cheers,
Shaggy

Greg K's picture

He has: 2,145 posts

Joined: Nov 2003

Well finally got around to redoing my server. Followed the guide and worked fine.

-Greg

Greg K's picture

He has: 2,145 posts

Joined: Nov 2003

Added note for if you are using the server for a site that has a domain through something like dyndns.org

If the server will be getting the dynamic IP address itself, not going through a router, you can use ddclient:

apt-get install ddclient

Prompts you for the info to set the config file for you.

Also with it getting a dynamic IP address, once you set up the first virtual server, go edit the config for it:

nano /etc/apache2/sites-available/DOMAIN.conf

At the top there will the a line that shows yoru current IP address, change it to:

<VirtualHost *:80>

Now, also edit the last line of the apache main config:

nano /etc/apache2/apache2.conf

The very last line will contain the ip address, change this as well to show the following:

# Include the virtual host configurations:
Include /etc/apache2/sites-enabled/
NameVirtualHost *:80

Once you do this, when you set up a new virtual server in VirtualMin, even though it will show the actual ip address in the bottom most section, it will create *:80 in the new config file.

Tip, apparently, Apache will match the IP address BEFORE virtual server names, as even though they were all set up, the first server ahd the actual IP address, and no matter what domain I went to, it took me to the one with the actual IP address.

-Greg

Greg K's picture

He has: 2,145 posts

Joined: Nov 2003

More notes... MySQL remote access:

By default on this install, mySQL is set to only allow connections from 127.0.0.1

So I did searches on how to set this up. Most top google results come up with the option to use "skip-networking" in the conf. This didn't work. Then I found a comment in the conf file (/etc/mysql/my.conf ):

# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 127.0.0.1

I was like, DUH! so I added this line as well:

bind-address = 192.168.39.20

I have two NIC's installed, eth0 uses a dynamic address and gets handled with DynDNS, and eth1 is a static ip into my home network, which is the one I used so it is only accessible from home.

Anyhow, after a restart of mySQL, this is up and running. I wanted to share this here as like I said, none of the searches I did came up with this.

-Greg

mstardom's picture

They have: 3 posts

Joined: Dec 2009

JeevesBond wrote:

This article goes through a quick and easy process for building a home or small business web server. The finished server will have Web server software, PHP, Perl, Ruby, MySQL, PostgreSQL, quotas, e-mail server software, anti-spam and anti-virus software, and a lot more good stuff. To top it off it will have a Web based GUI to control it all. Read on to learn how.

http://www.apaddedcell.com/building-home-small-business-web-server-fast

This topic is for discussion and questions about the article.


This article is very helpful. Now I will be able to host my own website. It cost so much for hosting services, so by having your own server a lot of money can be saved.

Submit Your News Articles or Opinion Articles to www.mstardom.com
Its Free and Easy. Promote your website to the world for years to come. Post your marketing articles on the Mstardom Blog at www.mstardom.com/blog/main
Post your helpful tips in the Mstardom Forum at www.mstardom.com/forum

mstardom's picture

They have: 3 posts

Joined: Dec 2009

I have been looking for a Forum like this for a long time. I have always wanted to learn the ins and outs of webmastering, and I think I am in the write place.

Submit Your News Articles or Opinion Articles to www.mstardom.com
Its Free and Easy. Promote your website to the world for years to come. Post your marketing articles on the Mstardom Blog at www.mstardom.com/blog/main
Post your helpful tips in the Mstardom Forum at www.mstardom.com/forum

They have: 4 posts

Joined: Mar 2011

Tried this tutorial in a VMWare image. Reminds me of Webmin, which is what I use for my server. Script installation took about 10 minutes, compared with several hours going through other tutorials.

They have: 4 posts

Joined: Jul 2011

ust tried this tutorial a VMWare picture. It reminds me a lot about Webmin, which is what I use for my server. Script Installation took about0 minutes, compared with several hours going through tutorials.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.