ReactJS is an open-source JavaScript library that aims to simplify the complex process of building interactive UIs. Known for its speed, flexibility, and strong online community, ReactJS is the most popular JavaScript library. Its main advantage is its component-based approach. In React, you can develop applications by creating reusable components. These components are like Lego blocks that you assemble to form a complete UI. Currently, ReactJS is widely used to create dynamic UIs. Its primary use is in developing SPAs (single-page applications). In this article, we will show you how to install ReactJS on Ubuntu 26.04.
Prerequisites
- An Ubuntu 26.04 VPS
- SSH root access, or a user with sudo privileges
Conventions
# – given commands should be executed with root privileges either directly as a root user or by use of sudo command
$ – given commands should be executed as a regular user
Step 1. Log in to the server
First, log in to your Ubuntu 24.04 server through SSH as the root user:
ssh root@IP_Address -p Port_number
You will need to replace ‘IP_Address‘ and ‘Port_number‘ with your server’s respective IP address and SSH port number. Additionally, replace ‘root’ with the username of the system user with sudo privileges.
You can check whether you have the proper Ubuntu version installed on your server with the following command:
# lsb_release -a
You should get this output:
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 26.04 LTS
Release: 26.04
Codename: resolute
Step 2. Install Dependencies
We need to install some dependencies to proceed with installing ReactJS in our system. Let’s install them by running the command below.
# apt install curl apt-transport-https ca-certificates gnupg
Step 3. Install NodeJS and NPM
ReactJS uses the Node Package Manager to manage its dependencies, so we need NodeJS and NPM. The easiest way to install NodeJS and NPM on a Ubuntu 26.04 system is from the default APT repository. Using this installation method, you will get NodeJS version 22 and NPM version 9. The installation is simple and straightforward. Let’s execute the command below to install NodeJS and NPM.
# apt install nodejs npm -y
Once installed, you can run this command to check the version.
# nodejs -v; npm -v
The command will print this output:
v22.22.1
9.2.0
Step 3. Install ReactJS
The React team officially deprecated Create React App (create-react-app) on February 14, 2025. They encourage users to adopt a framework or migrate to a build tool such as Vite, Parcel, or RSBuild. In this article, we will show you how to install ReactJS using Vite.
# cd /opt
# npm create vite@latest my-react-app
After executing the command above, you will be prompted for a few questions. You will be asked to choose which framework; use your keyboard and select React, then hit ENTER to continue.
root@ubuntu26:/opt# npm create vite@latest my-react-app
Need to install the following packages:
[email protected]
Ok to proceed? (y)
│
◆ Select a framework:
│ ○ Vanilla
│ ○ Vue
│ ● React
│ ○ Preact
│ ○ Lit
│ ○ Svelte
│ ○ Solid
│ ○ Ember
│ ○ Qwik
│ ○ Angular
│ ○ Marko
│ ○ Others
└
After this, you will need to choose a variant. Vite offers several React variants when you run npm create vite@latest and select React:
JavaScript: Choose this if you are a complete beginner to React, prefer a minimal setup, or want to avoid type complexity. It is simple and flexible for learning the basics.
TypeScript: The standard for professional, long-term, and scalable projects. It ensures predictable, maintainable code by catching errors during development.
SWC (Speedy Web Compiler): An extremely fast alternative to the traditional Babel compiler. Variants with + SWC generally offer better performance during development and builds.
React Compiler: This variant supports upcoming React optimizations, which is excellent for learning modern patterns that future versions of React will support.
Let’s choose JavaScript + React Compiler; press your keyboard to select it, then press ENTER. Select YES when prompted to install them with npm and start now. Once completed, you will see this on your screen:
│
◇ Select a framework:
│ React
│
◇ Select a variant:
│ Javascript + React Compiler
│
◇ Install with npm and start now?
│ Yes
│
◇ Scaffolding project in /opt/my-react-app...
│
◇ Installing dependencies with npm...
added 17 packages, and audited 18 packages in 6s
9 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
│
◇ Starting dev server...
> [email protected] dev
> vite
VITE v8.0.11 ready in 439 ms
➜ Local: http://localhost:5173/
➜ Network: use --host to expose
➜ press h + enter to show help
At this point, you should be able to access http://localhost:5173
You can close it by hitting q then ENTER
Now, if you want the service to listen not only on localhost, you can run this command:
# cd my-react-app
# npm run dev -- --host
At this point, you should be able to access http://YOUR_SERVER_IP_ADDRESS:5173
Step 4. Create Systemd Service File
In this step, we will create a systemd unit file, which is required to start/stop/restart ReactJS. With this systemd service, we can easily start and stop it. Let’s create it now.
# nano /lib/systemd/system/reactjs.service
Paste the following into the file
[Unit]
Description=My Vite React App Service
After=network.target
[Service]
User=root
WorkingDirectory=/opt/my-react-app2
ExecStart=/usr/bin/npm run dev -- --host
Restart=always
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=my-react-app
[Install]
WantedBy=multi-user.target
Save the file, then exit from the editor and reload the daemon with the command below:
# systemctl daemon-reload
Once done, start and enable the React.js service:
# systemctl enable --now reactjs
You will see this message:
Created symlink '/etc/systemd/system/multi-user.target.wants/reactjs.service' → '/usr/lib/systemd/system/reactjs.service'.
It means ReactJS is running now. To check the status of the React.js service:
# systemctl status reactjs
You should receive output similar to this:
● reactjs.service - My Vite React App Service
Loaded: loaded (/usr/lib/systemd/system/reactjs.service; enabled; preset: enabled)
Active: active (running) since Sat 2026-05-09 07:23:21 UTC; 36s ago
Invocation: bef5a8e196064e519dd2c873fa4329a7
Main PID: 45045 (npm run dev --h)
Tasks: 29 (limit: 1605)
Memory: 63.6M (peak: 80.1M)
CPU: 1.529s
CGroup: /system.slice/reactjs.service
├─45045 "npm run dev --host"
├─45056 sh -c "vite --host"
└─45057 node /root/my-react-app/node_modules/.bin/vite --host
May 09 07:23:21 ubuntu26 systemd[1]: Started reactjs.service - My Vite React App Service.
May 09 07:23:22 ubuntu26 my-react-app[45045]: > [email protected] dev
May 09 07:23:22 ubuntu26 my-react-app[45045]: > vite --host
May 09 07:23:22 ubuntu26 my-react-app[45057]: VITE v8.0.11 ready in 375 ms
May 09 07:23:22 ubuntu26 my-react-app[45057]: ➜ Local: http://localhost:5173/
May 09 07:23:22 ubuntu26 my-react-app[45057]: ➜ Network: http://192.168.93.138:5173/
May 09 07:23:22 ubuntu26 my-react-app[45057]: ➜ Network: http://172.18.0.1:5173/
You can go to HTTP://YOUR_SERVER_IP_ADDRESS:5173 and see your default ReactJS page.
Wrap Up
Congratulation! You have successfully installed ReactJS on your Ubuntu 26.04 machine. For more information about ReactJS, please refer to the ReactJS website. If you find yourself still needing assistance, you can always find a reputable Linux MSP.
If you liked this post on how to install ReactJS on Ubuntu 26.04, please share it with your friends or simply leave a comment below.