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 through the step-by-step installation of the ReactJS on a Debian 11 (Bullseye).
Install ReactJS on Debian 11 Bullseye
Step 1. Before we install any software, it’s important to make sure your system is up to date by running the following
apt commands in the terminal:
sudo apt update sudo apt upgrade sudo apt install build-essential
Step 2. Installing Node.js.
curl -fsSL https://deb.nodesource.com/setup_current.x | sudo -E bash -
Once the repository is added successfully, you can now install Node.js using the following command below:
sudo apt install nodejs
Finally, check the Node.js version using the following command:
Check the npm version:
Step 3. Installing React.js on Debian 11.
After installing the node and npm, to create an app, the following command is needed to download the necessary dependencies your app needs to run:
npm install -g create-react-app
Next, create a React app with the following command below:
Success! Created reactapp at /root/reactapp 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 reactapp npm start
Then, change the directory into the app. NB: reactapp is the name of the app you want to create:
cd reactapp npm start 0.0.0.0
> [email protected] start > react-scripts start "0.0.0.0" Compiled successfully! You can now view reactapp in the browser. http://localhost:3000 Note that the development build is not optimized. To create a production build, use npm run build.
Step 4. Accessing ReactJS Web Interface.
Once successfully installed, open your web browser and test your React application using the URL
http://your-server-ip-address:3000. You should see the React default page:
Congratulations! You have successfully installed ReactJS. Thanks for using this tutorial for installing the latest version of the ReactJS on Debian 11 Bullseye. For additional help or useful information, we recommend you check the official ReactJS website.