In this tutorial, we will show you how to install ReactJS on CentOS 8. For those of you who didn’t know, React is an open-source JavaScript library for creating web frontend and UI components. It is developed and maintained by Facebook and a large community of developers. ReactJS can be used in the development of Web Applications or Mobile Apps.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo
‘ to the commands to get root privileges. I will show you the step-by-step installation of the ReactJS on CentOS 8.
Prerequisites
- A server running one of the following operating systems: CentOS 8.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Install ReactJS on CentOS 8
Step 1. First, let’s start by ensuring your system is up-to-date.
sudo dnf clean all sudo dnf update sudo dnf install gcc-c++ make
Step 2. Installing the Node Version Manager and Node.js.
Now we add Node.js repository on the CentOS system:
curl -sL https://rpm.nodesource.com/setup_14.x | sudo -E bash –
Then, install Node.js using the following commands:
sudo dnf install nodejs
Verify your version of Node.js installed:
$ node -v $ npm -v
Step 3. Installing ReactJS Packages.
Run the following commands to install ReactJS packages:
npm install -g create-react-app
Step 4. Create an Example React App.
You can create a React.js application using one of the following commands:
create-react-app myreactjsapp
You will see a long result on the screen:
Success! Created myreactjsapp at /opt/myreactjsapp Inside that directory, you can run several commands: npm start Starts the development server. npm run build Bundles the app into static files for production. npm test Starts the test runner. npm run eject Removes this tool and copies build dependencies, configuration files and scripts into the app directory. If you do this, you can’t go back! We suggest that you begin by typing: cd myreactjsapp npm start
Once you have created your React application. This will create a folder in the current directory with the project name. Switch to that project and run npm start
to start the application:
cd myreactjsapp npm start
Congratulations! You have successfully installed ReactJS. Thanks for using this tutorial for installing the ReactJS on CentOS 8 systems. For additional help or useful information, we recommend you check the official ReactJS website.