User Tools

Site Tools


docs:guide-user:luci:luci.essentials

LuCI essentials

Introduction

While OpenWrt can be managed completely using SSH and the terminal, the LuCI WebUI makes many administration tasks easier. The OpenWrt full releases, such as the current 18.06.x series, ship with the LuCI WebUI installed. But for lower-memory devices, such as those with 4MBytes Flash and/or 32MBytes of RAM, the full install may fail because of lacking sufficient Flash memory so you will have to build your own image with LuCI included. More info on this can be obtained here.

Instructions

1. Basic installation

Connect to your router via SSH and install the packages.

opkg update
opkg install luci

Now you can open LuCI interface.

2. Providing encryption

Connect to your router via SSH and install the packages.

For devices with limited flash or running v18 (or prior, though you should strongly consider upgrading)

opkg update
opkg install luci-ssl-openssl

For routers without significant space constraints running on snapshots/master or v19 or later, it is possible to install using nginx (a commercial-grade web server)

opkg update
opkg install luci-ssl-nginx

Reload LuCI interface and verify that you are using HTTPS.

Even when using nginx, exposing the LuCI interface to the Internet or guest networks is not recommended.

3. Native language support

LuCI uses English by default. You can search and install additional packages for native language support.

opkg update
opkg list luci-i18n-\*
opkg install luci-i18n-hungarian

You can also install multiple language packs and switch between them in the LuCI settings.

LuCI is being actively translated into many languages by volunteers.

4. Additional web applications

Search and install luci-app-* packages if you want to configure services via LuCI.

opkg update
opkg list luci-app-\*

5. Alternative ports

Use alternative ports:

  • 8080/TCP - HTTP
  • 8443/TCP - HTTPS
uci -q delete uhttpd.main.listen_http
uci add_list uhttpd.main.listen_http="0.0.0.0:8080"
uci add_list uhttpd.main.listen_http="[::]:8080"
uci -q delete uhttpd.main.listen_https
uci add_list uhttpd.main.listen_https="0.0.0.0:8443"
uci add_list uhttpd.main.listen_https="[::]:8443"
uci commit uhttpd
/etc/init.d/uhttpd restart

Extras

Details

LuCI is installed as a 'meta package' which installs several other packages by having these defined as a dependency. Notably, it installs the uHTTPd web server, configured for use with LuCI.

In case you want to use uHTTPd, there is little configuration necessary as uHTTPd is configured with CGI to make LuCI work with the Lua interpreter. By default this is organised as follows. By default /www is the standard document root. Thus, by requesting this docroot (by pointing your browser to the devices IP address) an index file such as index.html is searched for (per uHTTPd settings). The file /www/index.html (installed with LuCI) is prepared such that when requested, it redirects you to /cgi-bin/luci, which is the default CGI gateway for LuCI. This is just a script, which basically calls Lua at /usr/bin/lua. uhttpd is configured by default to load pages as CGI in the /cgi-bin path, and thus starts serving these pages with the /cgi-bin/luci script.

It is also possible to run LuCI with Lua as an embedded process. uhttpd supports this; see the corresponding section of the uHTTPd Web Server Configuration article on the UCI configuration of uhttpd.

Configuration

LuCI on other web servers

LuCI on lighttpd

LuCI on nginx

LuCI on nginx is currently supported by using uwsgi as plain-cgi interpreter. You need to install one of this 2 variants of the LuCI meta-package:

  • luci-nginx - Autoinstall nginx, uwsgi-cgi and the default config file to make luci work on nginx.
  • luci-ssl-nginx - Autoinstall nginx-ssl, uwsgi-cgi and the default config file to make luci wok on nginx.

It does also create a self-signed certificate for nginx and redirect http traffic to https by default.

Currently LuCI on nginx is fully supported (maybe only in master snapshots for now, as of 16-Feb-2019). If any problem is found, report them to the support forum.

Offline installation

Download the following packages from the package repository using your platform and release version:

  • luci
  • luci-app-firewall
  • luci-i18n-english
  • luci-lib-core
  • luci-lib-ipkg
  • luci-lib-nixio
  • luci-lib-sys
  • luci-lib-web
  • luci-mod-admin-core
  • luci-mod-admin-full
  • luci-proto-core
  • luci-proto-ppp
  • luci-sgi-cgi
  • luci-theme-base
  • luci-theme-openwrt
# Upload the packages to the router
scp *.ipk root@openwrt.lan:/tmp
 
# Log into the router
ssh root@openwrt.lan
 
# Installed the packages
opkg install /tmp/*.ipk
 
# Clean up
rm -f /tmp/*.ipk

Minimalistic offline installation

You can also install a minimal version of LuCI with following packages selected for installation. Download and transfer the packages to your OpenWrt router onto the RAM disk in /tmp/luci-offline-packages.

mkdir -p /tmp/luci-offline-packages; cd /tmp/luci-offline-packages
  • liblua
  • lua
  • libuci-lua
  • libubus
  • libubus-lua
  • uhttpd
  • rpcd
  • luci-base
  • luci-lib-ip
  • luci-lib-nixio
  • luci-theme-bootstrap
  • luci-mod-admin-full
  • luci-lib-jsonc

and install them with:

opkg install /tmp/luci-offline-packages/*.ipk

Or use this script bellow. Note, the script assumes you have internet access through the router where you are installing LuCI. If you do not, then you will need to either manually download required .ipk packages, or run the script in two parts. First part till the last done statement to be executed when connected to the internet:

#!/bin/sh
#assumes the user has egrep, wget, ssh, and scp
 
set -e
 
# Change this to match your router
architecture="arm_cortex-a7_neon-vfpv4"
target="ipq40xx"
 
# These should be fine unless you've changed something
user="root"
ip_address="openwrt.lan"
 
tmpdir="/tmp/luci-offline"
 
base="liblua lua libuci-lua libubus libubus-lua uhttpd rpcd"
baseurl="https://downloads.openwrt.org/snapshots/packages/${architecture}/base"
 
luci="luci-base liblucihttp liblucihttp-lua luci-lib-ip luci-lib-nixio luci-theme-bootstrap luci-mod-admin-full luci-lib-jsonc luci-mod-status luci-mod-system luci-mod-network"
luciurl="https://downloads.openwrt.org/snapshots/packages/${architecture}/luci"
 
targets="libiwinfo libiwinfo-lua"
targetsurl="https://downloads.openwrt.org/snapshots/targets/${target}/generic/packages"
mkdir -p "${tmpdir}"
 
for pkgdir in base luci targets; do
    url=$(eval echo '${'${pkgdir}'url}')
    echo "${url}/Packages"
    wget -N -P "${tmpdir}" "${url}/Packages"
    for pkg in $(eval echo '${'${pkgdir}'}'); do
        pkgfile="$(egrep -o -e " ${pkg}[0-9\.]*_.+\.ipk" "${tmpdir}/Packages" | tail -c +2)"
        pkgurl="${url}/${pkgfile}"
        echo "${pkg} ${pkgurl}"
        wget -N -P "${tmpdir}" --quiet "${pkgurl}"
    done
done
 
ssh "${user}@${ip_address}" mkdir -p "${tmpdir}"
scp "${tmpdir}"/*.ipk "${user}@${ip_address}:${tmpdir}"
ssh "${user}@${ip_address}" opkg install "${tmpdir}"/*.ipk
ssh "${user}@${ip_address}" rm -r -f "${tmpdir}"
 
rm -r -f "${tmpdir}"
This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
docs/guide-user/luci/luci.essentials.txt · Last modified: 2019/10/23 18:43 by jeff