Monday, April 6, 2015

Set Up That Server You Always Wanted To

You've probably read about servers, and if you've never run one before, thought it sounds like a cool thing to do. You also may have a spare PowerPC Mac lying around doing nothing, which is why this post is about you (yes, I can see you). I have an old Sawtooth that I just can't quit—they're terrific machines—and I wanted to write a post on how I set it up as a headless file/bittorrent server that's so simple anyone can do it.

The first consideration is the hardware. Electricity consumption is one reason, and hard drive space is another. If you're lucky enough to have a Sawtooth, they offer the best balance of the two. Mac Minis consume the least power but may have limited hard drive space. A laptop with say a broken screen would also be a low-power alternative. Sawtooths use about 50 watts at idle in their basic configuration, and subsequent Power Macs used a bit more until G5s came along idling at 150 watts. So a G5 is a bit impractical for our purposes.

So now that you got the hardware, what do you do with it? You could set up a music server, a print server, or a backup server among other things. I wanted a bittorrent server because I'm on a private tracker for classic films and need to seed a bunch of films long-term without taking up space on my Powerbook. I also wanted something I could sync backups to via Unison. Finally I wanted to sleep the computer at night, so I'll be doing this on OS X and not Linux.

Before you go completely headless, you'll want to set up a few things on your server with a monitor attached. First, give it a static IP address because you'll have to forward ports to it and you don't want your router intermittently changing the server's address. To do this, go into Network Preferences, and under the TCP/IP tab choose "Configure IPv4:" "Manually". Then fill in an IP address your router hasn't already assigned as well as your router address. You can see an example below:


You'll also want to install a VNC server which will let you control your headless Mac from your other computers. VNC stands for Virtual Network Computing, and in practical terms it means you can display your server's desktop on any other computer with a VNC client. So this server business doesn't have to be all SSH commands and terminal outputs. It can be point and click just like any desktop.

OS X's Preferences has something smilar to VNC called Apple Remote Desktop that's compatible with VNC clients, but people complain it's slow and I also don't see any SSH options, so it's not secure. A pure VNC server has a remote login option so your sessions will be secured through SSH. The best server for PowerPC is Vine Server (OSXvnc). There's a slightly updated version at this TestPlant page, and manuals, too.

So once you've installed that and any other software you want to operate, like a bittorrent client, you're all set to go headless.

The next step is to forward ports on your router so it knows which computer to send all the traffic. In your router's administration, forward port 22 to your server's IP address as TCP only. Port 22 is for SSH. For VNC, forward ports 5900 to 5909, also TCP only, to your server's IP address. I've also forwarded a port for my bittorrent client, Transmission (the same port number you set in Transmission's preferences).

Finally it's time to download a VNC client, and the one and only choice is Chicken (formerly Chicken of the Sea VNC). Other clients may be just as good, but none can match its dock icon, a chicken popping out of a tuna can. If you already have Tenfourbird, TenFourFox, and Cyberduck, this will look right at home among them. Don't forget to check Chicken's SSH tunneling option and that Chicken's SSH host is not just the IP address but username@IP address, like dan@192.168.1.160. Also, you should already know to have a strong password, but I'll reiterate it anyway. Especially with port 22 open, you should have a strong password.

Now when you click connect you should see the server's desktop on your client desktop.


(the password is actually longer than that graphical string indicates)

As for putting your new server to sleep on occasion, you can set Energy Saver preferences on some Macs to have the power button sleep the computer, but if your Mac is in a hard-to-reach location there's another alternative. It's called Wake-On-LAN*, and it's a simple packet that sleeps and wakes your computer over the network. There's a WOL utility conveniently called WakeOnLan that works on Tiger through Snow Leopard but reportedly not on Lion. I read there are also several iOS apps for this. I also read, though I haven't tried this, that you can forward port 4343 and sleep/wake your computer from outside your network, assuming you know your network's IP address. In either case, you must check "Wake for Ethernet network administrator access" in your server's Energy Saver preferences.

*I believe this only works on ethernet-connected servers in Tiger and Leopard. Wake-On-Wireless was enabled in Snow Leopard.

Speaking of using servers from outside your network, you can control Transmission remotely as well, but I won't go into that here. Skip over to OS X Daily for more on that.

If you want to do all this on Linux, the good news is there are graphical VNC clients. The bad news is I don't know of any graphical server programs, so you have to set it up through the command line. Also, setting up a static IP address requires editing configuration files, so it's a little more involved. Though hopefully not insurmountable.

That's all, folks!

5 comments:

  1. A perfect guide to using a headless Mac. I have been doing such things for years myself an reap the benefits daily from headless systems. I have both a 1.0GHz Sawtooth and 1.25GHz Mac mini I use headless.

    This is why you're the man, Dan. The greatest resource the PowerPC community has. I could write the same type of thing, and have, but I couldn't relay things to the novice users nearly as well as you.

    You appeal to drivers and passengers. ie. you bring more of a human quality than I do. I hope that helps you understand my recent praise of you on PowerPC Liberation.

    ReplyDelete
  2. In Debian you can have the default Gnome VNC server, that is vino. To set it up :
    # vino-preferences
    And to start it :
    # /usr/lib/vino/vino-server

    I use a MacMiniG4 1.25 as a server too. Running 10.5. Mainly for music and backup things, with a big external usb drive :)

    ReplyDelete
  3. Hey this is really fun -- I just linked my Quicksilver and Powerbook over local wifi within minutes !!! :)

    ReplyDelete
  4. I think you meant Chicken of the VNC... :-)

    ReplyDelete
    Replies
    1. Right! I've corrected it with the < strike > tag.

      Delete