Set up lab for React on Linux
This article will show how to install Visual Studio Code for your development environment, the tools, and libraries needed for a React web development class.
To set up this lab, you need an Azure subscription and lab account to get started. If you don't have an Azure subscription, create a free account before you begin. Once you get an Azure subscription, you can create a new lab account in Azure Lab Services. For more information about creating a new lab account, see the tutorial on how to setup a lab account. You can also use an existing lab account.
Lab account settings
Enable your lab account settings as described in the following table. For more information about how to enable Azure Marketplace images, see Specify the Azure Marketplace images available to lab creators.
|Lab account setting||Instructions|
|Marketplace images||Enable the 'Ubuntu Server 18.04 LTS' image for use within your lab account.|
The size of the virtual machine (VM) that we recommend depends on the types of workloads that your students need to do.
|Lab setting||Value and description|
|Virtual Machine Size||Small.|
We recommend testing your workloads to see if a larger size is needed. For more information about each size, see VM sizing.
Template machine configuration
The steps in this section show how to complete the following to set up the template VM:
- Install Development tools.
- Install debugger extensions for your web browser.
- Update firewall settings.
Install Development tools
Install your preferred web browser.
sudo apt install nodejs
Install Node Package Manager, which will be used for installing the React, Redux, and JSX.
sudo apt install npm
Install Visual Studio Code.
Create React App is an officially supported way to create a ReactApp and requires no further configuration if using npm 5.2 and above. For instructions using Create React App, see their getting started documentation.
Other components needed for a React-based website are installed using NPM into a specific application. For example, enter the following commands to install the Redux and JSX libraries:
npm install react-redux npm install react-jsx
Install debugger extensions
Install the React Developer Tools extensions for your browser so you can inspect React components and record performance information.
- React Developer Tools Edge add-on
- React Developer Tools Chrome extension
- React Developer Tools FireFox add-on
To run the app in development mode, use the
npm start built-in command. The local and network urls will be listed in the command output. To use HTTPS instead of HTTP, see create React app using https in development.
Update firewall settings
Official Ubuntu builds have iptables installed and will allow all incoming traffic by default. However, if you're using a VM that has a more restrictive firewall, add an inbound rule to allow traffic to the NodeJS server. The example below uses iptables to allow traffic to port 3000.
sudo iptables -I INPUT -p tcp -m tcp --dport 3000 -j ACCEPT
Instructors must use the template VM or another lab VM to access a student's website.
Let’s cover an example cost estimate for this class. Suppose you have a class of 25 students. Each student has 20 hours of scheduled class time. Another 10 quota hours for homework or assignments outside of scheduled class time is given to each student. The virtual machine size we chose was Small, which is 20 lab units.
- 25 students × (20 scheduled hours + 10 quota hours) × 20 Lab Units × USD0.01 per hour = 150.00 USD
The cost estimate is for example purposes only. For current pricing information, see Azure Lab Services pricing.
The template image can now be published to the lab. See publish the template VM for further instructions.
As you set up your lab, see the following articles: