March 2016 update: after reading FreeBSD - A Lesson in Poor Defaults, I don't think I'll be using FreeBSD again. Next time my server at home goes out, and I'm on vacation, I'll use whatever "cloud" provider lets me run OpenBSD, even if it costs a little more and requires setting up a new account.
Since I use at least three machines regularly throughout the course of the day, I find it useful to have a remote server where I can centralize a lot of my work. Much of my computing, then, is done on an Intel Atom machine running OpenBSD. It serves my website, stores my backups, holds the innumerable text lists I use to obsessively manage my life, and runs the IRC, RSS, todo, and calendaring programs I check overly often. But twice during my current vacation I lost my connection to this machine. The first time was due to a connection problem back home, but this second time was because I accidentally rebooted the machine (a big no-no when your disk is encrypted and you need to enter a password before the machine can even boot).
During both outages, I've created FreeBSD virtual machines over at Digital Ocean (Digital Ocean calls these "droplets"). The total cost for running a droplet with 512 MB of RAM and 20 GB of SSD storage for 15 days should be something like $2.50. Not bad. I'm also pleased with the relative ease of set-up, both in terms of the Digital Ocean web interface and FreeBSD itself.
I'm going to include my set-up notes from my second time around just for future reference. Because chances are my home server will go down again someday.
You'll need to provide an SSH key during the creation of your droplet; this will be used to login with the default freebsd user. So
ssh-keygen -t rsaand
cat ~/.ssh/id_rsa.pub. (We're going to make a new RSA key here instead of using my existing id25519 key because I don't think DigitalOcean's web interface supports the latter; but we can use the id25519 key later, once the machine is set up.) Paste the output of that second command into the "Add SSH Key" box when creating the Droplet.
Get the IP address from Digital Ocean's web interface and connect to your new instance via SSH:
ssh email@example.com. It also may be necessary to do something like
ssh -i ~/.ssh/id_rsa firstname.lastname@example.org. I don't know how ssh picks between multiple keys.
From here on all commands apply to the remote machine. Run
sudo passwdto set up a root user password. You can now use
su -to switch to root if you prefer not using sudo.
sudo freebsd-update fetch && sudo freebsd-update installand then
sudo reboot. But apparently there's a bug with FreeBSD that prevents an upgraded machine from successfully rebooting (wtf?), so you'll have to power off/power on again using the Digital Ocean web interface.
Adding a user and setting up SSH
sudo adduserto set up a new user. When prompted for the login group, choose wheel.
If you have an ssh keypair that you normally use, rather than the one we created at the beginning of these steps, add the public key portion to your new user's ~/.ssh/authorized_keys file. Then make sure the permissions for that file are set right:
chmod go-rw ~/.ssh/authorized_keys. (If you don't have the pubkey for a private key, you can recreate it using ssh-keygen, e.g.,
ssh-keygen -f id_ed25519 -y).
In /etc/ssh/sshd_config change from yes to no the line about permitting password authentication. Then run
sudo service sshd reload. From here on, you should be able to connect to your droplet with something as simple as
Delete the freebsd user:
sudo rmuser freebsd.
Third party software and other nice things:
sudo pkg update.
sudo pkg install mksh tmux irssi hiawatha newsbeuteror whatever, depending on what software you need.
To use mksh instead of the default shell, run
chsh -s /usr/local/bin/mksh. And while we're setting up our shell: to stop the tips that appear every time you start a new shell, delete from ~/.profile the line that reads
if [ -x /usr/games/fortune ] ; then /usr/games/fortune freebsd-tips ; fi. It's also worth trimming the overly long /etc/motd file that is displayed on every login.
To use the hiawatha webserver, place your website files in /usr/local/www/hiawatha and then add hiawatha_enable="YES" to rc.conf and run
sudo service hiawatha start.