How to run LUCI locally

I tried following process for run luci locally but its not work

Step 1: Set up the development environment

Install Git: You can install Git by following the instructions for your operating system. Git is necessary to clone the LuCI repository.

Clone the LuCI repository: Open your terminal or command prompt and run the following command to clone the LuCI repository: git clone https://github.com/openwrt/luci.git. This will download the latest version of LuCI to your local machine.

Install build dependencies: Run the following command to install the build dependencies for LuCI:

sudo apt-get install build-essential libncurses5-dev libssl-dev git gawk subversion libncurses5-dev zlib1g-dev gettext file python.

Step 2: Build and run LuCI locally

Navigate to the LuCI directory: In your terminal or command prompt, navigate to the LuCI directory by running the following command:

cd luci.

Build LuCI: Run the following command to build LuCI: make image PROFILE=<profile_name>. Replace <profile_name> with the name of the OpenWrt device profile that you want to build LuCI for. This will create a LuCI image that you can run locally.

Run LuCI locally: After building LuCI, run the following command to run it locally: make run. This will start a local web server that you can access in your browser.

Step 3: Access LuCI in your browser

Open your browser: Open your preferred browser.

Navigate to LuCI: In the address bar of your browser, enter http://localhost:8080/cgi-bin/luci or https://localhost:8443/cgi-bin/luci. This will open the LuCI web interface in your browser.

Step 4: Debug LuCI in your IDE

Open LuCI in your IDE: Open your preferred IDE and navigate to the LuCI directory.

Debug LuCI: Use the built-in debugging tools in your IDE to debug LuCI. For example, you can use the "Inspect Element" feature in Chrome to inspect the HTML, CSS, and JavaScript code of LuCI.

Step 5: Make changes to LuCI code

Modify LuCI code: While LuCI is running locally, you can make changes to the code in your local LuCI repository using your preferred text editor or IDE. Your changes will be reflected in the LuCI web interface immediately, so you can see how they affect the layout and behavior of LuCI.

Build and install the updated LuCI package: After making changes to the LuCI code, you need to build and install the updated LuCI package on your OpenWrt device. To do this, run the following command from the root directory of the LuCI repository: make package/<package_name>/compile V=s. Replace <package_name> with the name of the LuCI package that you have modified.

Install the updated LuCI package on your OpenWrt device: Finally, you can install the updated LuCI package on your OpenWrt device using the opkg package manager. To do this, connect to your OpenWrt device using SSH and run the following command: opkg install /path/to/luci-package.ipk. Replace /path/to/luci-package.ipk with the path to the updated LuCI package.

Can you be more specific here… what doesn’t work?

Also, can you describe what you mean here? What device are you trying to run it on? And what does ‘locally’ mean in your context?

LuCI runs as a web server on OpenWrt…. You must use a browser on a full featured host OS (i.e. a desktop or mobile OS, not a router OS) to use the interface itself.

i want to customize luci

wouldn't it be easier to customize the code, on an openwrt device, then make a package out of it ?

But you haven’t described what device you are trying to target and what device you are trying to use to run LuCI.

1 Like

right now i am trying on virtual machine

running what OS ?

openwrt v22

now you're on the right track, imho.

1 Like

i access the code by using winscp and making chnages after that what process i need to create final build image

i know build process starting from git clone to create .img file but i cant understand how to merge customize code and make build

You won't be able to make an image.

See instead: https://openwrt.org/docs/guide-developer/toolchain/using_the_sdk