maybe it's not as accurate, but on a lot of systems where wget is already installed one can do with a lot less hassle:
wget -O /dev/null http://speedtest-ams2.digitalocean.com/100mb.test
Nota bene:
- change the datacenter to a closer one when appropriate.
- Unit is MB/s, rather than Mb/s, which is more common for this kind of test