Home Server?

vbimport

#1

I’m thinking of trying to start my own server at home. Nothing too serious. Can anybody recommend a good inexpensive program to use. I’m assuming Windows Server 2003 is a good one, but any others? Also, some tutorials on how to go about it?


#2

I use Apache2triad for my home server it’s all open source and most of it is arguably the best you can get. Both sites give info on how to get it going
Apache2triad sourceforge
Apache2triad @ Hotscripts


#3

apache is easy to get started with - and free. its the most popular web server in the world as well, and works well with mysql.


#4

Can anybody recommend a good inexpensive program to use. I’m assuming Windows Server 2003 is a good one, but any others?

Uhm… huh? :wink:
If you want a “server” at least give *BSD/*unix a fair chance.
btw, Apache doesn’t interact with MySQL in general.
//Danne


#5

btw, where did he say it interacts?


#6

He didn’t, ckin2001 did on the other hand.
//Danne


#7

no ckin2001 said nothing about interaction


#8

apache is easy to get started with - and free. its the most popular web server in the world as well, and works well with mysql.
//Danne


#9

Lets not all jump to concluding what buscuitboy’s needs are (ie: mysql)

@buscuitboy
What are you primary needs for this server, you say “basic” does this mean ftp server, http server, anything invloving programming, to what extend is basic???

Answers to these questions will help us help you in your guidance further.

Offhand suggestion, get a Linksys 54mbps router an duse the LINUX hack. Great for experience, and gives you basic and some advanced features. Not sure how well it works with prgramming languages or mysql though.


#10

I’d say that a router is a very bad idea, if you fuckup it may end up unrecoverable.
//Danne


#11

apache doesnt work well with mysql? im gonna tell my webserver. granted that php needs to be installed/configured - but who runs mysql without php? anyone? bueller?

bsd/unix is an operating system, not a server - and attempts to use it as one without the proper tools will fail.

//chris


#12

FYI there’s a lot you can do with MySQL without PHP (you can use Perl or another lang for instance) so no, it’s not obvious that Apache means Apache and PHP. :slight_smile:
//Danne


#13

Like xtacydima said: what does this server need to be used for? There are so many appliances for a server :).

I’ve got a server as well. For the time being, I use it for:

  • ftp server
  • vmware server (runs two VMs, controlled through VNC and SSH)
  • file server
  • database server
  • web server
  • X server

These are just a few appliances of a server. When choosing the OS you are about to use, first consider what you’ll do with the server. Also, consider the hardware it will be running on.

Linux servers don’t require as fast hardware as Windows servers do (you can run Windows 2003 server on a P2 as well, but the performance will be lower). On the other hand, for the unexperienced, Windows servers are usually easier to configure (but if you’re used to Linux, that’ll be the faster solution).

Most people tend to use a server for file and printer sharing. If it’s just for personal use, both Windows and Linux are fine. You could even use Windows 2000 (for instance) as a file/printer server; it doesn’t require any server OS.

If you have special wishes like AD/LDAP or whatsoever, it’ really worth to look into the differences of the OSs and their abilities.

For typical AMP servers (Apache MySQL and PHP) I’d recommend Linux, as it’s way easier to set it up on Linux than it’s on Windows.


#14

well that’s why i suggested Apache2Triad it has everything ftp, mail the lot and its not that big a deal to set up for a beginner


#15

How about SOL ?
I plan to use it on a P2 system in the near future.


#16

What about Abyss Web Server it’s very easy to set up only takes about 19 minutes from start to finish, and it’s as good as any other on the market. :slight_smile:




#17

If anyone is interesting I can post a little howto on installing FreeBSD and setting it up as a router/gateway/shaper(QoS) etc.
//Danne


#18

Yes please :slight_smile: if you don’t mind doing it, I have been thinking of taking it for a spin on a spare PC to see how it compeers with some of the others.


#19

Not that I will be doing that, but I think it would be a quite interesting thing to read. So if you have the time and you want to do this, I/we would be very pleased!


#20

Installing FreeBSD 5.3 and configurating pf, ALTQ, dhcp

Disclaimer: Screw ups are your own fault, don’t blame me, your pet or your neighbour. Also, if you plan to not read the documentation and links that I refer to don’t even bother trying this.

Requirements:[ul]
[li] CD-R or CD-RW disc (floppies will also do but reguires either an connection or a CD-R/RW disc).
[/li][li] Internet connection, non PPPoE and PPPoA (I wont cover those)
[/li]Note: USB modems will not be covered!
[li] Switch or DSL/Cable Gateway/Router (use only the LAN ports)
[/li][li] 2 network cables, one goes to the modem/outlet.
[/li][li] Basic UNIX knowledge and TCP/IP knowledge[/ul]
[/li]Computer requirements:[ul]
[li] Two supported NICs, link
[/li]Note: Realtek NICs are strongly recommended to be replaced due to performance issues (sucky hardware design). Netgear FA311 is for instance a great choice that’s cheap and widely spread.
For now ALTQ is only supported by the following drivers: bfe, em, fxp, em, lnc, de, rl, sis and xl so if your NIC uses another driver you can’t use ALTQ.
[li] A HDD that’s 2Gb or larger (dual boot will not be covered)
[/li][li] 32Mb RAM, (64Mb or more recommended)
[/li][li] Perferably a CPU equal to a Pentium or better
[/li][li] A monitor is needed for installation but you’ll do fine without it after installation.
[/li][li] A keyboard, a mouse wont be used at all[/ul]
[/li]Installation:

1. Locate a mirror using this link that’s close to you and grab the miniinst iso-file (and floppies if your computer can’t boot off a cd).
The needed files can be found using the following paths on a mirror:
/pub/FreeBSD/releases/i386/5.3-RELEASE/floppies/boot.flp - Boot floppy #1
/pub/FreeBSD/releases/i386/5.3-RELEASE/floppies/kern1.flp - Boot floopy #2
/pub/FreeBSD/releases/i386/5.3-RELEASE/floppies/kern2.flp - Boot floopy #2
/pub/FreeBSD/releases/i386/5.3-RELEASE/tools/fdimage.exe - Writing utility for floppy images
/pub/FreeBSD/ISO-IMAGES-i386/5.3/5.3-RELEASE-i386-miniinst.iso - Installation CD

2. Start the installation by booting up using either the floppies or installation disc. For more information regarding installation refer the handbook chapter 2.

2.1 You will now be prompted if you want to use ACPI or not (along with other boot options which we wont use right now) and since it’s poorly implented into BIOSes and old computers doesn’t supported at all it’s better to go with option 2 which disables it.

2.2 Once the installer has booted up it’ll ask what type of installation you want to run and in this case standard installation is suitable.

2.3 When fdisk appears delete all existing partitions (if any) and create one that uses the whole drive for FreeBSD. Don’t forget to set it bootable before quiting fdisk.

2.4 Select standard MBR (Master Boot Record) when prompted.

2.5 Time to create slices, if you have a small drive (2-3Gb) make a swap slice that’s 128Mb and assign the rest of the remaining space to / (filesystem). This isn’t exactly ideal but since it’s a bit cramped you really can’t do anything about it.
If you have a larger drive it’s recommended to make a few more slices. Swap should be about two times as large as amout of RAM.
/ 128M
/var 256-512M
/usr remaining space
Refer to the handbook for more information, chapter 2.5.5

2.6 We wont run X (graphical GUI) and neither do we want the source since we’ll grab the newest later on so go with a plain user installation with binares and docs only (option 8).

2.7 Same goes with ports collection, we’ll also grab it later to get the newest collection available.

2.8 Installation media, if you used the floppies and didn’t make a cd go with FTP and select a mirror near you otherwise select the CD since it’s faster and all you need is already on it.

2.8.1 If you selected FTP you’ll be promted to setup a Network Interface and it’s pretty straight forward. Most have no IPv6 and unless you have a static IP address your connection is using DHCP. Once it has detected your ISP’s DHCP server the installer will ask you to verify the settings or input if you have a static IP address.

2.9 Confirm that you know what you’re doing otherwise the installer wont continue.

2.10 Once binaries and docs are installed you are now asked to setup a Network Interface unless you selected FTP as installation source and now it’s a good time to do that if you haven’t. Don’t worry about the second NIC, well set it up afterwards.

2.11 Since the installer doesn’t have the ability to read minds it’ll ask what you want to run and here’s a recommendation (based on my preferences) what you should answer. You can change it afterwards if you don’t agree anyways.

Do you want this machine to function as a network gateway? - Yes
It’ll ask if you want to enable SSH (I forgot to write down the question) and I highly recommend you to do so.
Do you want to configure inetd and the network services that it provides? - Yes
Do you want to have anonymous FTP access to this machine? - No
Do you want to configure this machine as an NFS server? - No
Do you want to configure this machine as an NFS client? - No

2.12 Setup keymap and keyboard layout.
The majority of users will be fine using IBM 850 (option 3) and using a local keyboard layout.

2.13 Set what time zone you’re in and how it’s set.

2.14 Some more questions regarding software and hardware.
Would you like to enable Linux binary compatibility? - No (You wont need it and if it’s needed FreeBSD is going to install it for you)
Is there are PS/2, serial or bus mouse connected? (forgot to write down the exact question again) - No
ACPI was disabled during boot, would you like to disable permanently? (See previous comment) - Yes
The FreeBSD package collection is a collection of hundreds of ready-to-run applications, from text editors to games to WEB servers and more. Would you like to browse the collection now? - No

2.15 Would you like to add any initial user accounts to the system? Adding at least one account for yourself at this stage is suggested since working as the “root” user is dangerous (it is easy to do things which will make the entire system unusable). - Yes
Fill in Login ID, Password, Full Name and set member groups to wheel.

2.16 Set root (admin) password, as with everything else I’d suggest that you set a hard password and not something obvious like the name of your pet.

2.17 Visit the general configuration menu for a chance to set any last options? - No

2.18 - Exit the installation
Congrats, you’ve now installed a fully fledged version of FreeBSD. =)

Download source code and ports

1. Login as root

2. Install the update/download software as a package (pre-compiled binary) by typing

pkg_add ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-5.3-release/All/cvsup-without-gui-16.1h.tbz"

3. Copy the needed configuration files to /etc

cp /usr/share/examples/cvsup/ports-supfile /etc && cp /usr/share/examples/cvsup/stable-supfile /etc

4. Edit (using either edit or vi) the ports-supfile (in /etc) and set a cvsup mirror. You can find a list of available ones here
This is the line that you should change:
*default host=CHANGE_THIS.FreeBSD.org

5. Edit the stable-supfile (in /etc) and change the cvsup mirror as mentioned above and change the release tag so you get the newest version of 5.3 with security patches applied (if any).
The release tag line that you should change:
*default release=cvs tag=RELENG_4 to *default release=cvs tag=RELENG_5_3

6. Start downloading by typing:

cvsup /etc/stable-supfile && cvsup /etc/ports-supfile

This will take a while you probably want to take a snack or a cup of coffee.

To learn more about the ports and package system I suggest that you read chapter 4 in the handbook which you can find here: here

Optimizing and building world and kernel

Since we are already going to recompile to include all recent security patches we might as well optimize as much as possible to gain performance.

  1. Edit /etc/make.conf and insert the following lines
CPUTYPE=i586/mmx
CFLAGS= -O -pipe
COPTFLAGS= -O -pipe
NO_FORTRAN= true
NO_I4B= true
NO_LPR= true
NO_X= true
NOGAMES= true
NOPROFILE= true
USA_RESIDENT= yes

Don’t forget to change the CPUTYPE value according to what CPU you have.

#       (AMD CPUs)      athlon-mp athlon-xp athlon-4 athlon-tbird athlon k6-3
#                       k6-2 k6 k5
#       (Intel CPUs)    p4 p3 p2 i686 i586/mmx i586 i486 i386

Those who are familiar with GCC will probably notice that I’m using only -O instead of -O2 or even -O3 but there’s a good reason mainly because it brakes applications.
Penitum 4 users are adwised to use p3 instead of p4 due to buggy binary generation.

2. Time to build world (base), this actually takes quite some time (roughly 9 hours on a P166MMX with 64Mb RAM, 6 hours on a P2 266Mhz 192Mb RAM) so I suggest that you do this while you’re asleep.
To start building simply type:

cd /usr/src && make buildworld

3. Once buildworld has completed it’s time to add pf to the kernel and ALTQ (if your network cards were supported (ifconfig to display NICs) otherwise skip that part).
We are going to use the generic kernel config as a template and we don’t to mess it up so copy it instead. You should by know come up with a name for the computer. No special characters and perferably 8 characters or less.

cd /usr/src/sys/i386/conf && cp GENERIC MYNAME

4. Edit MYNAME and do the following changes:
A few lines down you’ll see three lines that says:
“ident GENERIC”
Change GENERIC so it has the same name as the file.
A few more lines down you’ll see this line:
options INET6 #IPv6 communications protocols
After that line you can insert the follow lines to enable ALTQ (skip this part if your NIC isn’t supported).

options HZ=1000
options ALTQ
options	ALTQ_CBQ	# Class Bases Queueing
options	ALTQ_RED	# Random Early Drop
options	ALTQ_RIO	# RED In/Out
options	ALTQ_HFSC	# Hierarchical Packet Scheduler
options	ALTQ_CDNR	# Traffic conditioner
options	ALTQ_PRIQ	# Prioirity Queueing

If you card supports device polling (only dc, fxp, em, ixgb, nge, re, rl, sis, ste, vge and vr) be sure to include kernel support.

options DEVICE_POLLING

Futher down you’ll see this line:
device apic # I/O APIC
After this one you can add the following lines to add pf:

device pf
device pflog
device pfsync

Now you’re all set!

Just for the record (advanced users only), you can strip the kernel even more by removing scsi drivers, unused network drivers, firewire etc but there isn’t much to gain and you’ll most likely end up with a bad kernel if you don’t know what you’re doing.

5. Compile and install kernel and it’s done by two commands (just to be safe).

cd /usr/src && make buildkernel KERNCONF=MYNAME
make installkernel KERNCONF=MYNAME

If buildkernel fails you have most likely done something wrong and I suggest that you go back and check for possible errors.

6. Remember that we compiled world (base) a while ago? Now it’s time to install it. Reboot by simply typing reboot or shutdown -r now and go into single mode using the boot menu.

7. Mount appropriate filesystems and install buildworld

mount -p / && mount -a && swapon -a
cd /usr/src && make installworld

8. Take backup of /etc and run mergemaster

cp -Rp /etc /etc.old
mergemaster

Don’t overwrite any files that you’ve done changes in with mergemaster =)

9. All done, reboot and start as usual (option 1 at boot menu).

Configure and enable a buch of things…

1. Logon as root

2. Write your own ruleset for pf (firewall) and ALTQ (shaper).
A basic ruleset including NAT can be found here, http://www.pyret.net/files/pf-basic.conf and should be saved at /usr/local/etc/pf.conf.
Remember to change the variables External och Internal to match your system.
You can find more information regarding pf here: OpenBSD’s PF FAQ, Solarflux (sample rulesets) and man 4 pf

3. Edit rc.conf and add the following lines so pf gets enabled during boot.

pf_enable="YES"
pf_logd="YES"
pf_rules="/usr/local/etc/pf.conf"

4. While you’re at it you might aswell configure your network interfaces, you’ll find at least one if these lines in rc.conf so all you have to do is to add the rest and alter them accordingly to your system.

network_interfaces="sis0 sis1 lo0"
ifconfig_sis0="DHCP"
ifconfig_sis1="inet 192.168.1.1 netmask 255.255.255.0"
ifconfig_lo0="inet 127.0.0.1"

5. Edit /etc/sysconf.conf to enable packet forwarding (routing) between interfaces and device polling. Ignore the line regarding device polling if your network interfaces supports it.

kern.polling.enable=1
net.inet.ip.forwarding=1
net.inet.ip.random_id=1

6. Enable ftp-proxy, even if this is optional I highly suggest you do so to avoid nasty ftp issues.
Edit /etc/inetd.conf and uncomment the last line regarding ftp-proxy and save.
Uncomment the line regarding ftp-proxy in /usr/local/etc/pf.conf .

7. Recompile and optimize Perl (optional).
Find out what version of Perl is installed, uninstall that package and install Perl using ports.


pkg_info |grep perl
pkg_delete <name of package>
Example: pkg_delete perl-5.8.5_1
cd /usr/ports/lang/perl5.8 && make install clean

8. Setup a DHCP Server (Network plug 'n play)
Install ISC’s DHCP Server using ports.

cd /usr/ports/net/isc-dhcp3-server && make install clean

Edit /etc/rc.conf to able rc.conf by adding the following lines:

dhcpd_enable="YES"
dhcpd_flags=""
dhcpd_conf="/usr/local/etc/dhcpd.conf"
dhcpd_ifaces="sis1"

Remember to change dhcpd_ifaces to your internal interface.
Edit /usr/local/etc/dhcpd.conf and include the following sample lines:

# Default settings
default-lease-time 86400;
max-lease-time 86400;
option domain-name "athome";
option domain-name-servers 130.237.72.200, 195.54.155.2;
authoritative;
ddns-update-style none;

# LAN
subnet 192.168.1.0 netmask 255.255.255.0 {
option routers 192.168.1.1;
option broadcast-address 192.168.1.255;
range 192.168.1.33 192.168.1.254;
}

Read the man pages for customization.

9. Reboot, and RTFM (seriously do it). http://www.freebsd.org/handbook
//Danne