User Tools

Site Tools


doc:howto:owncloud

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
doc:howto:owncloud [2013/01/26 22:24]
mes configure uhttpd to serve luci
doc:howto:owncloud [2014/12/10 14:40] (current)
attila.lendvai [ownCloud on OpenWrt] added links to the wiki page of the noted routers
Line 1: Line 1:
 ====== ownCloud on OpenWrt ====== ====== ownCloud on OpenWrt ======
  
 +Hint: I've installed OwnCloud on an TP-Link [[toh/​tp-link/​tl-wr2543nd|TL-WR2543ND]],​ using lighttpd and sorry, it's dead slow! :-(
 +
 + --- //unknown//
 +
 +I've also installed it on a more powerful TP_Link [[toh/​tp-link/​tl-wdr3500|TL-WDR3500]] but it's still very slow, 4-5 secs per page...
 +
 + --- //​motherjoker 2014/06/05 15:41//
 ===== 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 Attitude Adjustment or current trunk-version of OpenWrt[0], ​because ​one necessary package (php5-mod-zip) isn't available in 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 36:
  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 flashGet extroot =====+===== If <= 8MB flashGet 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 +
- +
-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=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 new uhttpd section in the /​etc/​config/​uhttpd file. And don't forget to serve luci on another port.
  
 |''​ |''​
Line 91: Line 58:
     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 114: Line 81:
 ==== 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 127: Line 94:
  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 SquashFSit 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 141: Line 109:
  )  )
  
-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 156: Line 124:
 ==== 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" ="/usr/​bin/​lua"​)
- $HTTP["url"="^($|/)" {                                                         +
-      ​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 200: Line 163:
  /​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 soplease 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 soplease 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 
 + 
 +Those packages are also suggested:​ 
 + opkg install php5-mod-mcrypt php5-mod-openssl php5-mod-fileinfo php5-mod-exif 
 + 
 +Configure /​etc/​php.ini to our needs and change the doc_root to our www-root: 
 + ;​open_basedir= 
 + 
 + error_log = syslog 
 + 
 + doc_root = 
 + cgi.fix_pathinfo=1 
 + 
 + memory_limit = 32M 
 + 
 +Check that the extensions are enabled: 
 + 
 +/​etc/​php5/<​extension>​.ini should contains extension=<​extension>​.ini 
 + 
 +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-fcgi",​ 
 + "​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 214: Line 238:
 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 222: Line 247:
  /​etc/​init.d/​lighttpd restart  /​etc/​init.d/​lighttpd restart
  
-===== Know bugs =====+===== unleash 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 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. 
 + 
 + 
 +=====Owncloud on alternative destination ===== 
 + 
 +If you don't want to set up a extroot, you can install owncloud on a different location (http://​wiki.openwrt.org/​doc/​techref/​opkg#​mount.point) 
 + 
 +Install php on another location, then 
 +| ''​ln -s /​opt/​etc/​php.ini /​etc/​php.ini 
 +ln -s /​opt/​etc/​php5 /etc/php5 
 +''​ | 
 + 
 +If you still get errors related timezones and calls to undefined functions:​ 
 +| ''​opkg -dest usb install zoneinfo-core zoneinfo-[your region] 
 +ln -s /​opt/​usr/​lib/​php /​usr/​lib/​php 
 +ln -s /​opt/​usr/​share/​zoneinfo/​ /​usr/​share/​zoneinfo/​ 
 +''​ | 
 + 
 +TODO 
 + 
 +===== 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 =====
-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 234: Line 322:
   * Twitter: @wetterfrosch   * Twitter: @wetterfrosch
  
 +but a lot of modifications are done by others...
  
 ===== Resources ===== ===== Resources =====
Line 242: Line 331:
   * [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
doc/howto/owncloud.1359235447.txt.bz2 · Last modified: 2013/01/26 22:24 by mes