Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revisionBoth sides next revision
docs:user-guide:luci:luci.essentials [2018/02/20 20:02] – ↷ Page moved from docs:user-guide:luci.essentials to docs:user-guide:luci:luci.essentials bobafetthotmaildocs:guide-user:luci:luci.essentials [2023/04/03 08:32] – [Offline installation] update vgaetera
Line 1: Line 1:
-====== LuCI installation ====== +====== LuCI essentials ====== 
-~~NOTOC~~+{{section>meta:infobox:howto_links#basic_skills&noheader&nofooter&noeditbutton}}
  
-<WRAP round info 520px> +===== Introduction ===== 
-LuCI installation will fail if there is not enough space for installation.\\ **This is regularly the case on devices with only 4MB flash.**\\ You will have to [[docs:user-guide:additional-software:imagebuilder|build your own image]] with LuCI included. +While OpenWrt can be managed completely using SSH and the terminal, the LuCI WebUI makes many administration tasks easier. 
-</WRAP>+The OpenWrt full releases, such as the current 21.02.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 [[docs:guide-user:additional-software:imagebuilder|build your own image]] with LuCI included. 
 +More info on this can be obtained [[docs:guide-user:additional-software:saving_space|here]].
  
 +===== Instructions =====
 +==== 1. Basic installation ====
 +Install the required packages.
  
-===== Online installation ===== +<code bash>
-==== without SSL ==== +
-  - Open an SSH session to 192.168.1.1. +
-  - Enter the following\\ <code>+
 opkg update opkg update
 opkg install luci opkg install luci
 </code> </code>
-  - After the installation has completed, the LuCI web GUI will be available at %%http://192.168.1.1%% 
  
-==== with SSL ====+Now you can open LuCI interface.
  
-  - Open an SSH session to 192.168.1.1+==== 2Providing encryption ==== 
-  - Enter the following\\ <code>+Install the required packages. 
 + 
 +<code bash>
 opkg update opkg update
 opkg install luci-ssl opkg install luci-ssl
 +/etc/init.d/uhttpd restart
 +</code>
 +
 +Reload LuCI interface and verify that you are using HTTPS.
 +
 +==== 3. Native language support ====
 +LuCI uses English by default.
 +You can search and install additional packages for native language support.
 +
 +<code bash>
 +opkg update
 +opkg list luci-i18n-\*
 +opkg install luci-i18n-hungarian
 +</code>
 +
 +You can also install multiple language packs and switch between them in the LuCI settings.
 +
 +LuCI is being actively [[https://github.com/openwrt/luci/wiki/i18n|translated]] into many languages by volunteers.
 +
 +==== 4. Additional web applications ====
 +Search and install ''luci-app-*'' packages if you want to configure services via LuCI.
 +
 +<code bash>
 +opkg update
 +opkg list luci-app-\*
 +</code>
 +
 +==== 5. Alternative ports ====
 +Use alternative ports:
 +  * HTTP - 8080/TCP
 +  * HTTPS - 8443/TCP
 +
 +<code bash>
 +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
 +</code>
 +
 +===== 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 [[docs:guide-user:services:webserver:http.uhttpd|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 [[docs:guide-user:services:webserver:uhttpd#embedded_lua|uHTTPd Web Server Configuration]] article on the UCI configuration of uhttpd.
 +
 +LuCI by default comes with the bootstrap theme. There are additional themes available and you can create your own if you wish - [[:docs:guide-user:luci:luci.themes]]
 +==== Configuration ====
 +  * ''[[docs:guide-user:services:webserver:uhttpd|/etc/config/uhttpd]]''
 +  * ''[[doc:uci:luci|/etc/config/luci]]''
 +
 +==== LuCI on other web servers ====
 +[[docs:guide-user:services:webserver:start]]
 +
 +=== LuCI on lighttpd ===
 +[[docs:guide-user:luci:luci.on.lighttpd]]
 +
 +=== LuCI on nginx ===
 +For routers without significant space constraints running on snapshots/master or v19 or later, it is possible to install using 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:
 +  * [[packages:pkgdata:luci-nginx]] - Autoinstall nginx, uwsgi-cgi and the default config file to make luci work on nginx.
 +  * [[packages:pkgdata: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.
 +Note that even when using nginx, exposing the LuCI interface to the Internet or guest networks is not recommended.
 +
 +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 [[https://forum.openwrt.org/t/luci-on-nginx-compile/14580|support forum]].
 +
 +=== LuCI on BusyBox httpd ===
 +If you have a very limited space then you can compile OpenWRT image with [[docs:guide-user:services:webserver:http.httpd|BusyBox httpd]] instead of uhttpd. LUCI works fine but you'll need some manual configuration. Also this setup is not widely used and tested.
 +If any problem is found, report them to the [[https://forum.openwrt.org/t/luci-on-busybox-httpd/84418|support forum]].
 +
 +==== Offline installation ====
 +Download the following packages from the [[https://downloads.openwrt.org/releases/18.06.2/targets/ar71xx/generic/packages/|package repository]] using your platform and release version:
 +
 +=== Basic ===
 +  * [[packages:pkgdata:liblua5.1.5|liblua]]
 +  * [[packages:pkgdata:libubus20220601|libubus]]
 +  * [[packages:pkgdata:libubus-lua]]
 +  * [[packages:pkgdata:libuci-lua]]
 +  * [[packages:pkgdata:lua]]
 +  * [[packages:pkgdata:luci-base]]
 +  * [[packages:pkgdata:luci-lib-ip]]
 +  * [[packages:pkgdata:luci-lib-jsonc]]
 +  * [[packages:pkgdata:luci-lib-nixio]]
 +  * [[packages:pkgdata:luci-mod-admin-full]]
 +  * [[packages:pkgdata:luci-theme-bootstrap]]
 +  * [[packages:pkgdata:rpcd]]
 +  * [[packages:pkgdata:uhttpd]]
 +
 +=== Extended ===
 +  * [[packages:pkgdata:luci]]
 +  * [[packages:pkgdata:luci-app-firewall]]
 +  * [[packages:pkgdata:luci-app-opkg]]
 +  * [[packages:pkgdata:luci-proto-ipv6]]
 +  * [[packages:pkgdata:luci-proto-ppp]]
 +
 +Transfer the downloaded packages to your router onto the RAM disk and install them.
 +
 +<code bash>
 +# Upload packages to the router
 +ssh root@openwrt.lan mkdir -p /tmp/luci-offline
 +scp *.ipk root@openwrt.lan:/tmp/luci-offline
 +
 +# Install packages
 +ssh root@openwrt.lan opkg install /tmp/luci-offline/*.ipk
 +
 +# Clean up
 +ssh root@openwrt.lan rm -f -R /tmp/luci-offline
 +</code>
 +
 +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:
 +
 +<code bash>
 +cat << "EOF" > opkg-offline-luci.sh
 +#!/bin/sh
 +
 +# Exit on error
 +set -e
 +
 +# Configuration parameters
 +OWRT_USER="root"
 +OWRT_HOST="openwrt.lan"
 +OWRT_TEMP="/tmp/luci-offline"
 +OWRT_PKGS="libiwinfo20210430 libiwinfo-lua liblua5.1.5 \
 +liblucihttp0 liblucihttp-lua libubus20220601 libubus-lua \
 +libuci-lua lua luci-base luci-lib-ip luci-lib-jsonc \
 +luci-lib-nixio luci-mod-admin-full luci-mod-network \
 +luci-mod-status luci-mod-system luci-theme-bootstrap \
 +rpcd uhttpd"
 +
 +# Fetch OpenWrt release
 +eval $(ssh "${OWRT_USER}@${OWRT_HOST}" cat /etc/os-release)
 +
 +# Fetch LuCI packages
 +REPO_LOCAL="file://${1:-${OWRT_TEMP}}/"
 +REPO_URL="https://downloads.${HOME_URL#*//}"
 +case "${VERSION_ID}" in
 +(snapshot) REPO_DIR="downloads/snapshots" ;;
 +(*) REPO_DIR="downloads/releases/${VERSION_ID}" ;;
 +esac
 +REPO_CORE="${REPO_DIR}/targets/${OPENWRT_BOARD}"
 +REPO_PKGS="${REPO_DIR}/packages/${OPENWRT_ARCH}"
 +for REPO_DIR in "${REPO_CORE}" "${REPO_PKGS}"
 +do mkdir -p "${REPO_LOCAL#*//}${REPO_DIR#*/}"
 +rsync -n --bwlimit="8M" --del -r -t -v \
 +--include="*/" --include-from="-" --exclude="*" \
 +"${REPO_URL/https/rsync}${REPO_DIR}/" \
 +"${REPO_LOCAL#*//}${REPO_DIR#*/}/" << EOI
 +$(echo "${OWRT_PKGS// /$'\n'}" \
 +| sed -e "s|^|/**/|;s|$|_*.ipk|")
 +EOI
 +done
 +
 +# Upload packages to OpenWrt
 +ssh "${OWRT_USER}@${OWRT_HOST}" "mkdir -p ${OWRT_TEMP}"
 +find "${OWRT_TEMP}" -name "*.ipk" -exec scp "{}" "${OWRT_USER}@${OWRT_HOST}:${OWRT_TEMP}" ";"
 +ssh "${OWRT_USER}@${OWRT_HOST}" "opkg install ${OWRT_TEMP}/*.ipk"
 +ssh "${OWRT_USER}@${OWRT_HOST}" "rm -f -R ${OWRT_TEMP}"
 +rm -f -R "${OWRT_TEMP}"
 +EOF
 +chmod +x opkg-offline-luci.sh
 +./opkg-offline-luci.sh
 </code> </code>
-  - After the installation has completed, the LuCI web GUI will be available at %%https://192.168.1.1%% 
  
 +See also: [[docs:guide-user:additional-software:opkg#local_repository|Local repository]]
  
-===== Offline installation =====+==== References ==== 
 +  * [[https://github.com/openwrt/luci|LuCI is developed at GitHub]] 
 +  * [[https://github.com/openwrt/luci/issues|LuCI issue tracker]] 
 +  * [[https://github.com/openwrt/luci/wiki|LuCI documentation wiki]] 
 +  * [[docs:guide-user:luci:luci.secure|Secure access to LuCI via SSH tunnel]] 
 +  * [[docs:techref:luci|LuCI technical reference]] 
 +  * [[docs:guide-user:luci:luci.themes|LuCI Themes and how to change them]]
  
  • Last modified: 2024/10/27 22:35
  • by palebloodsky