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 AlmaLinux 9. You can follow the same instructions for CentOS and Rocky Linux or RHEL-based.
- A server running one of the following operating systems: AlmaLinux 9.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
- An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies for ReactJS.
- Bpytop requires certain permissions that can only be granted to a superuser or a user with
sudoprivileges. Ensure that you have the necessary administrative access.
Install ReactJS on AlmaLinux 9
Step 1. First, let’s make sure we are working with the latest packages by updating the repositories. This step is crucial to ensure we install the most up-to-date version of ReactJS and its essential dependencies. Open your terminal and execute the following command:
sudo dnf clean all sudo dnf update
Step 2. Installing Node.js.
sudo curl -sL https://rpm.nodesource.com/setup_18.x | sudo bash -
Install Node.js and npm using the following command:
sudo dnf install nodejs
To verify that Node.js and npm are installed correctly, run the following commands:
node -v npm -v
Step 3. Creating a React App.
React applications are typically created using the
Create React App (CRA) tool. This tool simplifies the setup process and provides a clean project structure.
Use npm to install CRA globally on your system with the following command:
sudo npm install -g create-react-app
This makes the
create-react-app command available system-wide.
Navigate to the directory where you want to create your project and run:
my-react-app with your preferred project name.
Move into your project folder:
Inside your project folder, run the following command:
This command starts the development server and opens your React app in your default web browser.
Step 5. Accessing the React App in a Web Browser.
Open your web browser and navigate to:
You’ll see your React app up and running. Any changes you make in your code editor will be automatically reflected in the browser.
Step 6. Troubleshooting and Tips.
Node.js Installation Issues: If you encounter problems during Node.js installation, ensure that you added the correct repository for your AlmaLinux 9 version.
Code Editor Problems: If your code editor isn’t working as expected, check for any error messages in the terminal. Ensure that you installed the editor correctly.
Create React App Errors: If you face issues when creating a new React app, ensure that you have a stable internet connection and that your npm version is up to date.
Congratulations! You have successfully installed ReactJS. Thanks for using this tutorial for installing the ReactJS on your AlmaLinux 9 system. For additional help or useful information, we recommend you check the official ReactJS website.