In this tutorial you will learn to install and create React Application on a Ubuntu Linux system.

Prerequisites

You must have a running Ubuntu 20.04 system with console access.

Step 1 – Install Node.js

Node.js is required to create and run a React.js application. The following steps will install Node.js 14 on your Ubuntu system. Except yarn, you can also use npx (npx create-react-app myreactapp) or npm (npm init react-app myreactapp) commands to create React.js application. On successful application creation, you will see a long result on screen. At the end, you will find the result like below with some useful commands.

Step 3 – Start React Application

Once you have created your React application. This will create a folder in current directory with project name. Switch to that project and run yarn start to start application. Output: The default react application start on port 3000. Access your React application using 3000 port with system IP address. For local machine use “localhost” followed by port.

Lets create an awesome user interface with React.

Step 4 – Create React.js Production Build

Once your application is ready for production deployment. Let’s create a production build of your React application. The Production build contains static files required to run application on production environment. You don’t need to install Node.js on production servers as they don’t contains any development files. Use yarn build or npm run build command to create production build of your React.js application. On successful build, you will see the output like below: All the production files are created under the build directory. Upload all the content from build directory to production website document root. In case of any issue occurred on production server. First, you need to fix issue on local source code, then re-create the production build and re-deploy on server.

Conclusion

In this tutorial, you have learned, how to setup React.js development environment and access application in web browser. Additionally, you found instructions to create production build of your React application.

How to Install ReactJS on Ubuntu 20 04   TecAdmin - 65How to Install ReactJS on Ubuntu 20 04   TecAdmin - 28