A few months ago, I backed my first Kickstarter. For $29, I figured the sunk cost was minimal and I could probably figure out something useful to do with this:
PineA64+ (2 gigabyte model) stats:
- 1.2 GHz Quad-Core ARM Cortex A53 64-Bit Processor.
- Dual I/O expansion slots
- Dual Core Mali 400 MP2 Graphics card
- 2GB Memory
- Integrated Display engine with HDMI 1.4 output up to 4K
- 10/100/1000 Gigabit Ethernet Port
- Bluetooth 4.0 and 802.11BGN Wireless Module Port (Add on module optional)
(In addition to the case, I got both optional modules and a VGA adapter; the tab came to around $55 all together. If you don’t already have a micro USB charger of appropriate amperage and/or USB keyboards and HDMI cables, you might need to spend a bit more.)
After a few months of waiting, it showed up and I realized that I forgot to buy some microSD cards. Amazon Prime to the rescue, I now have five 16GB microSD cards. Now what?
I played around a little with the RemixOS from the Pine64.org wiki page, but I don’t really need another mediocre desktop. More useful by far would be a low-powered Linux server within my LAN that I wouldn’t feel bad about leaving running all of the time. I’ve been wanting to set up a dedicated Minecraft server for a while so I can play with the kids from anywhere in the world, so that was the obvious application.
This isn’t really a how-to or guide so much as an annotated checklist for my own reference. I used this excellent blog post as a reference for most of these steps. It’s a little older, but the instructions are still good. I only really changed things from personal preference (Debian vs. Ubuntu) and to use SpigotMC vs. the vanilla server.
This forum post led me to these Debian images on Pine64.pro. Use an imaging application to write the disk image to your microSD card. Conveniently, my laptop has a slot for this. Put the card in the Pine, plug in a keyboard and display, and add power. There’s only a bright red LED to indicate power and nothing to suggest anything else is happening. It may take several minutes to get any display on first boot, so be patient.
You have some tasks:
- Accounting: Initial root login/pass is debian/debian. Create an everyday user account and password, enable it for sudo, test it, and then demote and disable the debian user account.
- Expand the file system (to fill the SD card) I did this with gparted, but there’s a script built-in to do it from the command line, which I hadn’t realized because I don’t read instructions most of the time.
- Remote access: Enable and test ssh login, enable user account to remote in, and now you don’t need the keyboard/display any longer. It may be helpful to set your Pine’s IP to something static; I kept it on dynamic but told my router to always assign that particular MAC address to a particular IP, but you can also do it within the OS.
- Install some useful utils:
- screen or tmux: to switch between programs in one terminal (and let them keep going after you log out)
- ufw to set up simple firewall protection.
- If you intend to access it from outside your LAN, you will want these, too:
Install Minecraft server
I followed the blog post instructions to create a minecraft user and directory (/minecraft), also. The account is not ssh- or sudo-capable, so I log in with my regular account and su over if I need to use it directly.
I already had Java in the Debian build, so I just needed to install the Minecraft server. You can download and install the vanilla server from Minecraft.net, but I ran into some performance issues, even after allocating a full gig of memory. My two sons and I could connect and play on the LAN, but the other players teleport around like crazy as the server tries valiantly to keep up, and eventually (sometimes quickly) it would time out and crash.
I did a little digging and discovered a reference on the Pine64 forums to SpigotMC, a modded implementation of the server with lots of performance and feature hacks. For legal reasons, they don’t distribute the Java .jar directly, but you download a BuildTools.jar file in your server’s Minecraft directory, and build the server yourself. It takes a few minutes and requires git (which the Debian image I used already had).
I modified the blog post’s start.sh script accordingly to use the spigot.jar, and created a cron job to make it go at startup. For reference:
exec echo Spigot Minecraft server was started/restarted on ‘date’ >> /var/log/minecraft.log
screen -S minecraft -d -m java -Xms512M -Xmx1G -XX:MaxPermSize=128M -XX:+UseConcMarkSweepGC -jar spigot.jar nogui
So I can ssh in to the Pine, su minecraft, and then screen -r to reattach to the server console to see how things are going and generally mess with my kids while they play. I may switch from screen to tmux later (because I’ve been meaning to play with it for several years now).
I didn’t do anything crazy to the SpigotMC configuration. I changed the world to creative (my kids’ preferred mode), reduced the view distance a bit, and limited the simultaneous connections to 8. I haven’t bothered to configure a whitelist or anything for access control, but that’s easy to do.
Enable external access
There are a few pieces to this.
- In UFW rules, enable ports 22 (for ssh if you need it from outside) and 25565 (default Minecraft server port)
- In your router, enable port forwarding to the server IP address for those same ports
- Get a domain name. Since I have a dynamic IP from my ISP, I registered with a free dynamic DNS service and configured inadyn to check my IP every so often and update the service when/if it changes. I went with freedns.afraid.org (which provides hundreds of domain names to choose from) but there are lots of options.
If all is done in accordance with prophecy, you should be able to point your Minecraft client to your domain from elsewhere (without specifying a port or anything) and have it resolve and connect. Boom. You’re playing Minecraft on your Pine64.
The next thing I’ve been wrestling with is installing Forge and my kids’ favorite mod, CustomNPCs (which does a great deal more than just make custom NPCs). It is slightly more involved and irritating, and so far I’ve succeeded only in installing a version that works great on the server (apparently) but crashes on my client. [Edit: never going to happen, I don’t think. Forge and Spigot are mutually exclusive.] For mod play, I just copied the contents of /minecraft into a new subdirectory and modified the configurations there; I don’t want to mess around with the working basic configuration. Eventually, I may set up some scripts to automate switching between different server setups.
With all three of us playing at once, the server keeps up just fine without any lag or delays. I may add a USB hard drive and make it into a media server (with Plex?)–something our living room needs more than a Minecraft server, truth be told.
From reading horror stories via Twitter and the Pine64 subreddit, a bunch of people are having issues with their Pine64, assuming they even received one. Complaints about OS images not working, SD card issues, hardware problems of all types, etc. I am not exactly awesome at Linux, but it was pretty much “first-time go” all the way through. Maybe I just lucked out?