Differences

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

doc:howto:owncloud [2013/07/14 22:55]
mes dead slow
doc:howto:owncloud [2014/03/21 15:01] (current)
tmomas Cosmetics: Syntax, grammar, typo correction
Line 1: Line 1:
====== ownCloud on OpenWrt ====== ====== ownCloud on OpenWrt ======
-Hint: I'm installed OwnCloud on an TP-Link TL-WR2543ND, using lighttpd and sorry, it's dead slow! :-(+Hint: I've installed OwnCloud on an TP-Link TL-WR2543ND, using lighttpd and sorry, it's dead slow! :-( 
===== Get OpenWrt ===== ===== Get OpenWrt =====
-Use current trunk-version of OpenWrt[0], cause one necessary package (php5-mod-zip) isn't available in latest stable version 10.3.1. The web resources of OpenWrt will help you figuring out what firmware you will need for your device and how to flash it.+Use current trunk-version of OpenWrt[0], because one necessary package (php5-mod-zip) isn't available in latest stable version 10.3.1. The web resources of OpenWrt will help you figuring out what firmware you will need for your device and how to flash it. 
 + 
 +| {{:meta:icons:tango:48px-outdated.svg.png?nolink}} | OpenWrt is not built with locale support by default, which is needed for ownCloud. Therefore this HOWTO only works if you compile your own OpenWRT firmware image and include full language support in the kernel. For more information see [[https://forum.openwrt.org/viewtopic.php?id=45251]].  |
===== Get USB-support ===== ===== Get USB-support =====
-ownCloud is around 30 MB and you will like to store your data somewhere. So best both is done on some external storage cause small routers don't have that much.+ownCloud is around 30 MB and you will like to store your data somewhere. So best both is done on some external storage because small routers don't have that much.
Have a look in the OpenWrt-Wiki at usb.essentials [1] and usb.storage[2], and figure out what USB-mode your device is using (ohci or uhci) and know what filesystem is on your storage (here: ext4). Have a look in the OpenWrt-Wiki at usb.essentials [1] and usb.storage[2], and figure out what USB-mode your device is using (ohci or uhci) and know what filesystem is on your storage (here: ext4).
Line 33: Line 36:
/etc/init.d/lighttpd start /etc/init.d/lighttpd start
-===== If <= 8MB flash; Get extroot =====+===== If <= 8MB flash: Get extroot =====
-If your device has only 8 MB of flash-memory, it is to small to get all the dependencies on it. You'll need to put the operating-system on the USB-device as well. Have a look at [[doc:howto:extroot]] and follow the instructions for trunk. The flavour "New external overlay variant (pivot overlay)" worked for me on a TP-Link WR1043ND quite well. Remember to use both steps while "Duplicate Data": pivot overlay and pivot root.+If your device has only 8 MB of flash-memory (or even less), it is too small to get all the dependencies on it. You'll need to put the operating-system on the USB-device as well. Have a look at [[doc:howto:extroot]] and follow the instructions for trunk. The flavour "New external overlay variant (pivot overlay)" worked for me on a TP-Link WR1043ND quite well. Remember to use both steps while "Duplicate Data": pivot overlay and pivot root.
===== Install & configure webserver ===== ===== Install & configure webserver =====
==== use luci with httpd (default web server for luci) ==== ==== use luci with httpd (default web server for luci) ====
-May you have allready the OpenWrt web-interface (luci) on your router, may you want to get the OpenWrt web-interface initially.+May you have already the OpenWrt web-interface (luci) on your router, may you want to get the OpenWrt web-interface initially.
If you like OpenWrt-webinterface luci, install it If you like OpenWrt-webinterface luci, install it
opkg install uhttpd luci opkg install uhttpd luci
-You're able to start uhttpd twice: Add an new uhttpd section in the /etc/config/uhttpd file. And don't forget to serve luci on another port.+You're able to start uhttpd twice: Add a new uhttpd section in the /etc/config/uhttpd file. And don't forget to serve luci on another port.
|'' |''
Line 74: Line 77:
==== disable httpd and use luci on lighttpd ==== ==== disable httpd and use luci on lighttpd ====
-Somewhere I got the hint to use lighttpd for running ownCloud. I tried out uhttpd simultaniously - the interfaced looked quite broken.+Somewhere I got the hint to use lighttpd for running ownCloud. I tried out uhttpd simultaneously - the interface looked quite broken.
-And may you would no run two web server simultanious.+If you don't want to run two web servers simultaneously:
Disable uhttpd even after reboot Disable uhttpd even after reboot
Line 87: Line 90:
opkg install lighttpd lighttpd-mod-cgi lighttpd-mod-fastcgi lighttpd-mod-access opkg install lighttpd lighttpd-mod-cgi lighttpd-mod-fastcgi lighttpd-mod-access
-//If the httpd server is located on the SquashFS it is not recomend to remove the files// from the space, due to wasing space by doing this (learn more about SquashFS!). Otherwise you're able to remove httpd by typing+//If the httpd server is located on the SquashFS, it is not recomend to remove the files// from the space, due to wasting space by doing this (learn more about SquashFS!). Otherwise you're able to remove httpd by typing
opkg --force-depends remove uhttpd opkg --force-depends remove uhttpd
-FIXME: Is it possible to run luci only with fastcgi?+ 
 +Now configure lighttpd, to be able to use luci again.
Edit the config-file /etc/lighttpd/lighttpd.conf Edit the config-file /etc/lighttpd/lighttpd.conf
-First configuration lighttpd, and you are able to use luci again. uncomment the mod_cgi:+Uncomment the mod_cgi:
server.modules = ( server.modules = (
        "mod_cgi"         "mod_cgi"
) )
 +
 +see errors on syslog:
 + server.error-log-use-syslog = "enable"
assign luci to lua assign luci to lua
Line 107: Line 114:
/etc/init.d/lighttpd start /etc/init.d/lighttpd start
 + /etc/init.d/lighttpd enable
...and access luci again. Use e.g. http://192.168.1.1:81 ...and access luci again. Use e.g. http://192.168.1.1:81
Line 112: Line 120:
==== Configure lighttpd for OwnCloud ==== ==== Configure lighttpd for OwnCloud ====
-Move the Luci-Server to the Port 81; after this we'll create a new server for OwnCloud: 
- server.port = 81 
- 
-Uncomment these lines to enable the fastcgi-module 
server.modules = ( server.modules = (
"mod_access", "mod_access",
- "mod_fastcgi"+ "mod_cgi"
) )
-Make shure mod_fastcgi is listet in top of mod_cgi. 
-Set www-root for OwnCloud: +cause, we'll move the Luci-Server to the Port 81; we need the port 80 for the OwnCloud-Server
-And append a new server for luci: + server.port = 80
- $SERVER["socket"] == ":80" { +
- server.document-root = "/www/owncloud" +
- }+
-Add "index.php" to the List of index-file.names+Set www-root for OwnCloud (We will add a new server for Luci later.):  
- index-file.names = ( "index.php", "index.html", "default.html", "index.htm", "default.htm" )+ server.document-root = "/www/owncloud"
Add these lines to secure the access to the data according to ownCloud WebServer-notes[3], beware that in this example the ownCloud-folder is our www-root Add these lines to secure the access to the data according to ownCloud WebServer-notes[3], beware that in this example the ownCloud-folder is our www-root
$HTTP["url"] =~ "^/data/" { $HTTP["url"] =~ "^/data/" {
-     url.access-deny = ("")+ url.access-deny = ("")
- 
$HTTP["url"] =~ "^($|/)" { $HTTP["url"] =~ "^($|/)" {
-     dir-listing.activate = "disable"+ dir-listing.activate = "disable"
} }
-ReStart the webserver with+And append a new server for luci: 
 + $SERVER["socket"] == ":81" { 
 + server.document-root = "/www" 
 + cgi.assign = ("luci" => "/usr/bin/lua") 
 +
 + 
 +Due to this, remember to remove the line we have added before: 
 + #cgi.assign = ( "luci" => "/usr/bin/lua" ) 
 + 
 +Restart the webserver with
/etc/init.d/lighttpd restart /etc/init.d/lighttpd restart
Line 151: Line 159:
/etc/init.d/lighttpd enabled /etc/init.d/lighttpd enabled
-Now point your browser to http://yourhost/index.php and see if this manual missed something. If so; please contact the author (see details below) or get an account for this wiki and fix the how-to yourself :)+Now point your browser to http://yourhost/index.php and see if this manual missed something. If so, please contact the author (see details below) or get an account for this wiki and fix the how-to yourself :)
===== Install & configure PHP ===== ===== Install & configure PHP =====
-Get the dirty part: php and sqlite. I am not sure if really all these packages are necessary, but it seems so:+Get the dirty part: php and sqlite. I am not sure if really all of these packages are necessary, but it seems so:
opkg install php5 php5-cgi php5-fastcgi php5-mod-json php5-mod-session php5-mod-zip libsqlite3 zoneinfo-core php5-mod-pdo php5-mod-pdo-sqlite php5-mod-ctype php5-mod-mbstring php5-mod-gd sqlite3-cli php5-mod-sqlite3 php5-mod-curl curl php5-mod-xml php5-mod-simplexml php5-mod-hash php5-mod-dom php5-mod-iconv opkg install php5 php5-cgi php5-fastcgi php5-mod-json php5-mod-session php5-mod-zip libsqlite3 zoneinfo-core php5-mod-pdo php5-mod-pdo-sqlite php5-mod-ctype php5-mod-mbstring php5-mod-gd sqlite3-cli php5-mod-sqlite3 php5-mod-curl curl php5-mod-xml php5-mod-simplexml php5-mod-hash php5-mod-dom php5-mod-iconv
Configure /etc/php.ini to our needs, mainly uncomment the installed Dynamic Extensions and change the doc_root to our www-root: Configure /etc/php.ini to our needs, mainly uncomment the installed Dynamic Extensions and change the doc_root to our www-root:
;open_basedir= ;open_basedir=
 +
 + error_log = syslog
doc_root = doc_root =
Line 175: Line 185:
extension=sqlite3.so extension=sqlite3.so
extension=xml.so extension=xml.so
- doc_root = "/www" 
-Play around with memory_limit = 8M within php.ini, I reduced the value form 8MB to 4MB ... but maybe 50MB might be better with 64MB RAM.+ memory_limit = 32M 
 + 
 +Play around with memory_limit, I reduced the value form 8MB to 4MB ... but maybe 50MB might be better with 64MB RAM.
run php run php
Line 183: Line 194:
/etc/init.d/php5-fastcgi start /etc/init.d/php5-fastcgi start
-activate PHP in lighttpd.conf+==== activate PHP in lighttpd.conf ====
- +
-Uncomment the lines following "#### fastcgi module" and change the path to the php to /usr/bin/php-cgi:+
 +Uncomment to enable the fastcgi module
server.modules = ( server.modules = (
 + "mod_access",
"mod_fastcgi", "mod_fastcgi",
"mod_cgi" "mod_cgi"
) )
- server.document-root = "/www/owncloud"+Add "index.php" to the list of index-file.names: 
 + index-file.names = ( "index.php", "index.html", "default.html", "index.htm", "default.htm" )
- index-file.names = ( "index.php", "index.html", "default.html", "index.htm", "default.htm")+ static-file.exclude-extensions = (".php, ".pl", ".fcgi")
- server.port = 80+Include php by using fast-cgi (gample against max-procs for performance):
fastcgi.server = ( fastcgi.server = (
- ".php" => ( + ".php" => (
- "localhost" => ( + "bin-path" => "/usr/bin/php-cgi", 
- "socket" => "/tmp/php-fastcgi.socket", + "socket" => "/tmp/php.socket", 
- "bin-path" => "/usr/bin/php-cgi" + "max-procs" => 1 
- ) + ))
-+
- )+
) )
- cgi.assign = ( ".php" => "/usr/bin/php-cgi" )+Only if you are using normal cgi mode for PHP, you'll need the following line 
 + cgi.assign = (".php" => "/usr/bin/php-cgi")
- $SERVER["socket"] == ":81" { +Restart the webserver with 
- server.document-root = "/www" + 
- cgi.assign = ( "luci" => "/usr/bin/lua" ) + /etc/init.d/lighttpd restart 
- }+ 
 +Now point your browser to http://yourhost/index.php (first create a helpful content to this file) and see if this manual missed something. If so, please contact the author (see details below) or get an account for this wiki and fix the how-to yourself.
===== Get SSL (optional) ===== ===== Get SSL (optional) =====
Probably you want to run lighttpd with SSL/https to get your traffic crypted. These instructions are taken from [4]. For generating a key you need to install libopenssl and the openssl-utils Probably you want to run lighttpd with SSL/https to get your traffic crypted. These instructions are taken from [4]. For generating a key you need to install libopenssl and the openssl-utils
opkg install libopenssl openssl-utils opkg install libopenssl openssl-utils
 +(or openssl-util without the 's?)
Now you can create a folder for your key like this Now you can create a folder for your key like this
Line 227: Line 240:
Make the file only accessable to root Make the file only accessable to root
chmod 0600 /etc/lighttpd/ssl/YOURDOMAIN chmod 0600 /etc/lighttpd/ssl/YOURDOMAIN
 + chmod 0600 /etc/lighttpd/ssl/YOURDOMAIN/server.pem
Now we can uncomment the lines for SSL in lighttp.conf and modify the path to the server.pem: Now we can uncomment the lines for SSL in lighttp.conf and modify the path to the server.pem:
Line 237: Line 251:
===== unleash OwnCloud ===== ===== unleash OwnCloud =====
-download and unpack the newest revision:+Download and unpack the newest revision:
| ''cd /tmp | ''cd /tmp
Line 266: Line 280:
'' | '' |
-Open your Website http://192.168.1.1/ and configure your first steps then wait for a loooonnnnngggg time and you'll see the result+Open your Website http://192.168.1.1/ and configure your first steps, then wait for a loooonnnnngggg time and you'll see the result
 + 
 +=====The easiest way to install owncloud ===== 
 + 
 +Format your USB drive as ext3 or ext4 and plug it into your Openwrt router 
 + 
 +download the script from gizfun.com, run it and you are good to go 
 + 
 +''wget http://www.gizfun.com/dl/web_for_openwrt.sh'' 
 + 
 +''sh web_for_openwrt.sh'' 
 + 
 +The script will download, install and configure all necessary web server components automatically. All software will be installed onto the external USB storage.
-===== Know bugs =====+===== Known bugs =====
-  * Even php5-mod-xml (and php5-mod-simplexml, -xmlreader and -xmlwriter) are installed, ownCloud lists php-xml as a missing dependency. Anyone an idea? +  * Even if php5-mod-xml (and php5-mod-simplexml, -xmlreader and -xmlwriter) are installed, ownCloud lists php-xml as a missing dependency. Anyone an idea? 
-  * It can be fix if select php5-mod-xml when you make php5. If you not, libxml will not be loaded, even phh5-mod-xml is installed later. +  * It can be fixed by selecting php5-mod-xml when you make php5. If you don't, libxml will not be loaded, even if phh5-mod-xml is installed later.
===== Written by ===== ===== Written by =====
Line 289: Line 315:
  * [3] http://owncloud.org/support/webserver-notes/   * [3] http://owncloud.org/support/webserver-notes/
  * [4] http://www.cyberciti.biz/tips/howto-lighttpd-create-self-signed-ssl-certificates.html   * [4] http://www.cyberciti.biz/tips/howto-lighttpd-create-self-signed-ssl-certificates.html
 +  * [5] http://www.gizfun.com/content/install-owncloud-your-openwrt-router-3-steps

Back to top

doc/howto/owncloud.1373835329.txt.bz2 · Last modified: 2013/07/14 22:55 (external edit)