Install Redmine onto Raspberry Pi 2 (this is the tutorial you want!)

(UPDATE: I needed Redmine >=3.0 for a plugin, so I ended up re-doing this for version 3 of Redmine, which is a more complicated process. I wrote instructions for Redmine version 3 onto the Raspberry Pi 2, but they’re not quite as detailed as the ones here. But if you’re able to follow these instructions, you should be able to follow along for 3.0. It’s just a bit more complex because you have to build packages.)

(COMMENTS: I suggest you take a look below at the comments to this post if you run into anything unexpected, like an error. There is a lot of feedback for various issues some folks ran into.)

After scouring the internet, I’ve created the go-to tutorial for installing Redmine onto the Raspberry Pi 2 without assuming you are a Linux guru and without pages and pages of steps. This assumes you have a Raspberry Pi 2 and a freshly imaged SD card that has never booted. If you’ve already booted, that’s fine, you should be able to pick up around step 12 (I would recommend an SD image backup first!).

I’m using Raspbian 2015-02-16 in this tutorial. Yes, this is 27 steps, but it holds your hand and it zips by. Plus, the first half is initial Pi setup and backup.

  1. Before even booting your Pi, download Adafruit Pi Finder. This is a cross-platform utility that allows you to get started with your Pi without having to hook it to a TV and use a keyboard. It will discover it, tell you the IP, and get you connected without any display or keyboard attached to the Pi. Just make sure it’s connected via wire to your network.
  2. I suggest you image your SD card with Win32DiskImager.
  3. Insert your SD card, plug in the wired ethernet cable, and finally plug in the power supply. Let it go to town booting and doing it’s first time thing. Note that you don’t need it hooked to a screen or keyboard, you just need to let it run for a minute or two until the activity light dies down.
  4. Open PiBootstrap.exe.
  5. Click Find my Pi
  6. It will take a minute or two to search your network–be patient.
  7. If you have more than one Pi, you will need to make sure you edit the correct one, but I expect in most cases you will just have the one. Enter the SSH credentials you want to use and a hostname. I chose piredmine for my hostname. For this install, leave “Install the WebIDE?” unchecked.
  8. Click “Bootstrap!”
  9. The tool will connect, an SSH Terminal window will open, and go to town downloading and installing stuff. Let it run.
  10. Run sudo raspi-config and expand the filesystem to fill the SD card.
  11. Optional: Shutdown, eject your SD card from the Pi, and make a backup on your regular machine using the same Win32DiskImager utility. This way, if things go wrong, you can rollback to this point easily. Put it back in your Pi when it’s done.

    Otherwise: Reboot.
  12. Now to actually install stuff!
  13. (At this point, it may be easier to sudo su to become root rather than prefix all your commands with sudo. It’s up to you, though!)
  14. Execute sudo apt-get install apache2 mysql-server and wait. You’ll be prompted to enter a password for the MySQL root user. Remember to make it secure. Wait some more.
  15. Next execute sudo apt-get install redmine redmine-mysql and wait. You’ll be prompted about configuring the redmine/instances/default package with a lengthy text blurb advising you to select Yes. Select Yes, then select mysql. Now enter the MySQL root user password from earlier. For the next password prompt, you can leave it blank for a random password or enter whatever you like. This one shouldn’t ever be important for you to know because you know the root password. I left mine blank for random.
  16. You’ll see a message that “This may take awhile.” It is not kidding. Go do something else for 5 or 10 minutes.
    “This may take a while.” Yes, yes it will.

    It will give you false hope that it is done, but it’s not. Keep waiting.

  17. Finally it’s done, and we are nearly so. Execute one last install: sudo apt-get install libapache2-mod-passenger  This one will be quick. A little configuration and we’ll be good to go.
  18. Execute: sudo ln -s /usr/share/redmine/public /var/www/redmine  This will make your URL “http://youservername/redmine”
  19. sudo chown -R www-data:www-data /var/www/redmine
  20. sudo su  (need to become root for this next one)
  21. echo "RailsBaseURI /redmine" > /etc/apache2/sites-available/redmine.conf [Thanks Daniel]
  22. exit (to exit root)
  23. sudo a2ensite redmine
  24. sudo /etc/init.d/apache2 reload
  25. sudo /etc/init.d/apache2 restart
  26. Done! Surf to http://piredmine.local/redmine and wait for the initial loading process (this is a one-time wait). The default Redmine login is admin / admin
  27. You may need to make additional changes to your apache configuration if you’re running on a domain name, or to use plugins, but this was the hard part. Pat yourself on the back and eat some chocolate.

References:

Redmine Install Guide that insists on using experimentals respositories
A “write-up” that works if you have guru level knowledge and a few pre-reqs already installed
Installing Redmine Backlogs on Debian
(Backlogs is a plugin — I’ve never used it)

Inkscape Laser Engraver Bug

If you’ve tried to use the modified Inkscape laser engraver plugin mentioned in this blog post about building an engraver, you may have run into an error trying to do the export. It’s something like “AttributeError: ‘module’ object has no attribute ‘unittouu’” or “unittouu not part of inkex module“. Here’s the fix.

The bug is on line 3080 of laserengraver.py and broke due to an Inkscape change. Old line:

doc_height = inkex.unittouu(self.document.getroot().get('height'))

New line:

doc_height = self.unittouu(self.document.getroot().xpath('@height', namespaces=inkex.NSS)[0])

Be sure to have the exact same number of spaces/tabs on this line. In Python, whitespace is important, so you can’t mix and match spaces and tabs, and all code blocks must have the same whitespace alignment.

Problem solved!

Arduino Stepper Motor Controller

This is quite a deviation for me. Instead of talking web or games programming, this is a quick post about the Arduino and a stepper motor controller. I ordered the stepper motor and controller combo pack (“DC 5V 4-Phase 5-Wire Step Motor + Driver Board Test Module for Arduino”) from MiniInTheBox.com. I then pulled up the Adafruit tutorial for their stepper motor and controller, but it turns out the IC is different. Further, they’re expecting a raw IC on a breadboard while the one from MiniInTheBox comes with the IC on a board. Fortunately, it’s really easy to work around.

It turns out that the stepper motor seems to function fine if you use the Adafruit sample code and hook up the outputs 9-12 in sequence on the controller. So 9 goes to “1N1”, 10 goes to “1N2”, etc. Then run the Adafruit provided code, enter a number like 200 (or 2000 like I did in the video) and watch it turn! Cool! Here’s video proof, with pictures below showing the hookup.