Learn how to do a local installation and configure each of the four languages.
- [Instructor] This course gives you the opportunity to work with four different languages. And in order to make that work, we need to get your system set up correctly. You can use the exercise files for the course from the site or grab the files via Git from the address on the slide. All of the instructions I'm listing here are included in the README for the repository and at the root of the Exercise Files directory. There are a couple of options for getting the code working on your system. You can install each component locally on your system, or you can use the Docker container, which has everything set up already.
A local installation requires that you install and run MongoDB, as well as installing each of the four languages. This has the advantage that when you're done, you'll have all of the languages working on your own system. Docker containers are lightweight virtual machines with specific functionality. In this case, it has all of the languages and code you need to follow along with the course. The advantage here is a quick and seamless startup experience. If you want to use a Docker container, you can go to docker.com and find an installer for your operating system.
Once you have Docker, run the container with the command shown here on the screen, which will make your files visible to your local system for editing. I'll be working with a Docker container myself throughout the course. If you're comfortable with command line editors and want to keep the course material separate from your system, you can run the simpler command shown here. If you do choose to use Docker, you're done with setup, and you can go on to the rest of the course. Now, if you decided to do a local installation, you'll start off by getting MongoDB ready to go.
There are two videos in our learning library covering how to install Mongo on Windows and OS X. Now that the database is ready to go, let's go through each of the languages in order. First, you'll need Node.js. Go to nodejs.org, and grab the version for your operating system. Once you've installed Node, you'll want to install the needed modules with npm, the Node package manager. To do this, change into the Chapter2 subdirectory in the Exercise Files directory, and run npm install.
To install Python, go to the python.org website and grab the installer. This is a one-step process for most people, very easy to manage. You'll need to get pip, the Python package manager, as well as Python, so I suggest you get Python 3, rather than 2.7, as only Python 3 comes with pip automatically. After you've installed Python and pip, you can retrieve the required libraries in the Chapter3 directory using the command on the screen.
Next up is Perl. If you have macOS, you've already got it installed. If you use Windows, you've got a couple of choices, ActiveState Perl and Strawberry Perl. Having tried both, I personally prefer Strawberry Perl. Once you have Perl installed, you can get the needed libraries by using the Perl package manager in the Chapter4 directory. CPAN stands for Comprehensive Perl Archive Network and is the Perl package manager. You'll need sudo or administrative access in order to run the cpanm or cpanminus command.
And finally, Ruby, follow the instructions at ruby-lang.org to get it up and running on your system. For Windows installations, you can accept the default installation choices for the Ruby installer, and it should work correctly. If you're running macOS and haven't worked with Ruby before, you may want to upgrade your Ruby installation, as the version that ships with even current version of macOS is quite old. Once you've gotten all of these set up, you're ready to get started.
- Why become a polyglot programmer?
- Exploring Node.js, Python, Perl, and Ruby code
- Building on prior knowledge to learn new programming languages
- Learning API read and write functionality in Node.js, Python, Perl, and Ruby
- Implementing API functionality in Node.js, Python, Perl, and Ruby