Differences

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

doc:howto:owncloud [2013/04/17 15:37]
keffr3n
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'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 27: Line 32:
mount -t ext4 /dev/sda1 /mnt/sda1 -o rw,sync mount -t ext4 /dev/sda1 /mnt/sda1 -o rw,sync
-Get fstab to auto-mount the usb-stick on startup, otherwise your webserver won't come up and you have to start it after mounting manually. (Insert how-to here)+Get fstab to auto-mount the usb-stick on startup, otherwise your webserver won't come up and you have to start it after mounting manually. ( FIXME Insert how-to here)
Even if auto-mounting on startup works, it probably ends too late when the webserver tries to start. To make sure the webserver is up after booting, insert this line into /etc/rc.local before "exit 0": Even if auto-mounting on startup works, it probably ends too late when the webserver tries to start. To make sure the webserver is up after booting, insert this line into /etc/rc.local before "exit 0":
/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.
- +
-===== unlease OwnCloud ===== +
- +
-download and unpack the newest revision: +
- +
-| ''cd /tmp +
-wget http://mirrors.owncloud.org/release/ownclound-X.X.X.tar.bz2 +
-opkg update +
-opkg install tar +
-cd /www +
-tar -xjf /tmp/owncloud-X.X.X.tar.bz2 +
-'' | +
- +
-Now you should cleanup: +
- +
-| ''rm /tmp/owncloud-X.X.X.tar.bz2 +
-opkg remove --autoremove tar +
-'' | +
- +
-You have to configure the rights of the /www/owncloud in addition. +
-| ''chown -R www-data:www-data /www/owncloud +
-chmod ??? -R /www/owncloud +
-'' | +
- +
-===== 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: +
- 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: +
- extension=ctype.so +
- extension=curl.so +
- extension=dom.so +
- extension=iconv.so +
- extension=gd.so +
- extension=hash.so +
- extension=json.so +
- extension=pdo.so +
- extension=session.so +
- extension=pdo_sqlite.so +
- extension=sqlite3.so +
- extension=xml.so +
- doc_root = "/mnt/sda1/owncloud" +
- +
-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.+
===== 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 93: Line 54:
    list listen_http  0.0.0.0:443     list listen_http  0.0.0.0:443
-    option home /owncloud+    option home /www/owncloud
    list interpreter  ".php=/usr/bin/php-cgi"     list interpreter  ".php=/usr/bin/php-cgi"
Line 116: 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 129: 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 = (
Line 143: Line 105:
) )
-And append a new server for luci:+see errors on syslog: 
 + server.error-log-use-syslog = "enable"
- $SERVER["socket"] == ":81" { +assign luci to lua 
- server.document-root = "/www" + cgi.assign = ( "luci" => "/usr/bin/lua" )
- cgi.assign = ( "luci" => "/usr/bin/lua" ) +
- }+
At this point it's possible to start the server... At this point it's possible to start the server...
/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 158: Line 120:
==== Configure lighttpd for OwnCloud ==== ==== Configure lighttpd for OwnCloud ====
-Now configure the web server for OwnCloud: 
-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+cause, we'll move the Luci-Server to the Port 81; we need the port 80 for the OwnCloud-Server
- server.document-root = "/mnt/sda1/owncloud"+ server.port = 80
-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"
-Uncomment the lines following "#### fastcgi module" and change the path to the php to /usr/bin/php-cgi:+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
- fastcgi.server = (                                                                 + $HTTP["url"] =~ "^/data/" { 
-     ".php" => (                                                               + url.access-deny = ("") 
-             "localhost" => (                                                   +
-                     "socket" => "/tmp/php-fastcgi.socket",                     +
-                   "bin-path" => "/usr/bin/php-cgi"                          +
-           )                                                                  +
-     )                                                                         +
- )+
-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"] =~ "^($|/)" { 
 + dir-listing.activate = "disable" 
 + }
- $HTTP["url"] =~ "^/data/" {                                                        +And append a new server for luci: 
-     url.access-deny = ("")                                                       + $SERVER["socket"] == ":81" { 
- }                                                                         + server.document-root = "/www
-                                                                                   + cgi.assign = ("luci" =&gt; "/usr/bin/lua")
- $HTTP["url"] =~ &quot;^($|/)" {                                                         +
-     dir-listing.activate = "disable"                                            +
} }
-ReStart the webserver with+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 202: 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 ===== 
 +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 
 + 
 +Configure /etc/php.ini to our needs, mainly uncomment the installed Dynamic Extensions and change the doc_root to our www-root: 
 + ;open_basedir= 
 + 
 + error_log = syslog 
 + 
 + doc_root = 
 + cgi.fix_pathinfo=1 
 + 
 + extension=ctype.so 
 + extension=curl.so 
 + extension=dom.so 
 + extension=gd.so 
 + extension=hash.so 
 + extension=iconv.so 
 + extension=json.so 
 + extension=pdo.so 
 + extension=pdo_sqlite.so 
 + extension=session.so 
 + extension=sqlite3.so 
 + extension=xml.so 
 + 
 + 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 
 + /etc/init.d/php5-fastcgi enable 
 + /etc/init.d/php5-fastcgi start 
 + 
 +==== activate PHP in lighttpd.conf ==== 
 + 
 +Uncomment to enable the fastcgi module 
 + server.modules = ( 
 + "mod_access", 
 + "mod_fastcgi", 
 + "mod_cgi" 
 +
 + 
 +Add "index.php" to the list of index-file.names: 
 + index-file.names = ( "index.php", "index.html", "default.html", "index.htm", "default.htm" ) 
 + 
 + static-file.exclude-extensions = (".php, ".pl", ".fcgi") 
 + 
 +Include php by using fast-cgi (gample against max-procs for performance): 
 + 
 + fastcgi.server = ( 
 + ".php" => (( 
 + "bin-path" => "/usr/bin/php-cgi", 
 + "socket" => "/tmp/php.socket", 
 + "max-procs" => 1 
 + )) 
 +
 + 
 +Only if you are using normal cgi mode for PHP, you'll need the following line 
 + cgi.assign = (".php" => "/usr/bin/php-cgi") 
 + 
 +Restart the webserver with 
 + 
 + /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 216: 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 224: Line 249:
/etc/init.d/lighttpd restart /etc/init.d/lighttpd restart
-===== Know bugs =====+===== unleash OwnCloud =====
-  * Even php5-mod-xml (and php5-mod-simplexml, -xmlreader and -xmlwriter) are installed, ownCloud lists php-xml as a missing dependency. Anyone an idea? +Download and unpack the newest revision: 
-  * 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. + 
 +| ''cd /tmp 
 +wget http://mirrors.owncloud.org/release/ownclound-X.X.X.tar.bz2 
 +opkg update 
 +opkg install tar 
 +cd /www 
 +tar -xjf /tmp/owncloud-X.X.X.tar.bz2 
 +'' | 
 + 
 +Now you should cleanup: 
 + 
 +| ''rm /tmp/owncloud-X.X.X.tar.bz2 
 +opkg remove --autoremove tar 
 +'' | 
 + 
 +You have to configure the rights of the /www/owncloud in addition. 
 +| ''chown -R root:root /www/owncloud 
 +chmod 770 -R /mnt/sda1/owncloud/data 
 +'' | 
 + 
 +| ''cd /mnt/sda1 
 +mkdir owncloud 
 +cd owncloud 
 +mkdir data 
 +chown -R root:root /mnt/sda1/owncloud 
 +chmod 770 -R /mnt/sda1/owncloud 
 +'' | 
 + 
 +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. 
 + 
 +===== Known bugs ===== 
 + 
 +  * 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 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 =====
-wetterfrosch +Page was initiated by wetterfrosch
  * Mail: wetter_ät_netzpolitik.org   * Mail: wetter_ät_netzpolitik.org
  * Jabber: wetterfrosch_ät_jabber.berlin.ccc.de   * Jabber: wetterfrosch_ät_jabber.berlin.ccc.de
Line 236: Line 306:
  * Twitter: @wetterfrosch   * Twitter: @wetterfrosch
-and modified by others +but a lot of modifications are done by others...
===== Resources ===== ===== Resources =====
Line 246: 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.1366205857.txt.bz2 · Last modified: 2013/04/17 15:37 by keffr3n