This tutorial will guide you on how to configure a Raspberry Pi to boot directly into a web page or application without a desktop environment.
- Raspberry Pi 4 with the latest OS installed
-
Create an lxsession Directory: If it doesn't already exist, create using the following command:
mkdir -p ~/.config/lxsession/LXDE-pi
-
Create an Autostart File: Create an autostart file (e.g., autostart) in the
~/.config/lxsession/LXDE-pi/
directory:nano ~/.config/lxsession/LXDE-pi/autostart
-
Add Startup Programs: Add the programs you want to start automatically to this file. For example, in this case I'm opening a browser with application url, you can add a line like this:
@/usr/bin/firefox <your-application-url>
Replace
<your-application-url>
with the URL of your web application(http://localhost:3000/test).Save and Exit: Save the file by pressing
Ctrl + X
, thenY
, and finallyEnter
. -
Configuring Crontab: Starting your server on boot
-
Reboot: Reboot your Raspberry Pi to apply the changes:
sudo reboot
Your Raspberry Pi should now start with your application open in the Firefox browser.