On CentOS 6.x this is super easy to install since Python 2.6.x is already installed (Yum dependency).

1. Get the script:

wget -O speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest_cli.py

2. Make it executable:

chmod +x speedtest-cli

3. Run it:

./speedtest-cli

Sample output:

Retrieving speedtest.net configuration...
Retrieving speedtest.net server list...
Testing from Dnsslave.com (173.0.63.122)...
Selecting best server based on latency...
Hosted by AT&T (Kansas City, MO) [0.03 km]: 80.691 ms
Testing download speed........................................
Download: 148.48 Mbit/s
Testing upload speed..................................................
Upload: 39.01 Mbit/s