To install the http-server package on Ubuntu, you can follow these steps:
- Open a terminal on your Ubuntu system. You can do this by pressing
Ctrl + Alt + Tor by searching for “Terminal” in the application launcher. - Update the packages list to ensure you have the latest versions by running the following command:
sudo apt update - Once the update is complete, you can install
http-serverusingnpm(Node Package Manager). Ensure that you have Node.js installed on your system by typing:node --versionIf Node.js is not installed, you can install it by running:sudo apt install nodejs - Next, install
http-serverglobally by running the following command:sudo npm install --global http-serverThis command will installhttp-serverglobally on your system, making it accessible from anywhere. - After the installation is complete, you can use
http-serverby navigating to the directory containing your website files and running the following command:http-serverThis will start the HTTP server, and it will print the available URLs where you can access your website locally. - By default,
http-serverwill serve your files on port 8080. If you want to use a different port, you can provide it as an argument when starting the server. For example, to use port 3000, run:http-server -p 3000
That’s it! You have successfully installed and started http-server on Ubuntu. You can now access your website by opening a web browser and navigating to the provided URL, such as http://localhost:8080.

