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
docs:user-guide:services:owncloud [2018/02/18 19:00] tmomasdocs:guide-user:services:nas:owncloud [2022/07/05 11:01] (current) – propose WebDAV for small routers stokito
Line 1: Line 1:
-====== ownCloud on OpenWrt ======+====== ownCloud or NextCloud ======
  
-Owncloud is very heavy and requires devices with relatively powerful processors, while it will run well even on weak PC and servers, it is too heavy for low-power devices like a router or a NAS.\\+ownCloud/Nextcloud is very heavy and requires devices with relatively powerful processors, while it will run well even on weak PC and servers, it is too heavy for low-power devices like a router or a NAS.\\
  
-It's recommended to have at least a dualcore ARMv7 processor (or you are running OpenWrt on PC/server hardware).+It's recommended to have at least a dualcore ARMv7 processor if you are not running OpenWrt on PC/server hardware.
  
-I've installed OwnCloud on an TP-Link [[toh/tp-link/tl-wr2543nd|TL-WR2543ND]], using lighttpd and sorry, it's dead slow! :-(+I've installed ownCloud on an TP-Link [[toh:tp-link:tl-wr2543nd|TL-WR2543ND]], using lighttpd and sorry, it's dead slow! :-(
  
  --- //unknown//  --- //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...+I've also installed it on a more powerful TP_Link [[toh:tp-link:tl-wdr3500_v1|TL-WDR3500]] but it's still very slow, 4-5 secs per page...
  
  --- //motherjoker 2014/06/05 15:41//  --- //motherjoker 2014/06/05 15:41//
  
-===== Get OpenWrt ===== +Internally both NextCloud and ownCloud are using a WebDAV protocol with some extensions for basic file operations and Web UI to it. For a better performance you can use just pure WebDAV  [[:docs:guide-user:services:nas:webdav]]
-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 =====
Line 47: Line 44:
 ===== If <= 8MB flash: Get extroot ===== ===== If <= 8MB flash: Get extroot =====
  
-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 [[docs:user-guide:additional-software:extroot_configuration]] 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 [[docs:guide-user:additional-software:extroot_configuration]] 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) ==== 
-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 +ownCloud can't be installed on uhttpd (default web server on OpenWrt). You need to install and configure lighttpd.
- opkg install uhttpd luci+
  
-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.+I had trouble moving Luci from uhttpd to lighttpd so I recommend keeping uhttpd running for Luci on a different port and assign port 80 to lighttpd for ownCloud.
  
-|'' +==== Change uhttpd port ==== 
-config uhttpd owncloud +Edit ''/etc/config/uhttpd'' file and change http port to 81 and https port to 8443:
-    list listen_http  0.0.0.0:80 +
-    list listen_http  0.0.0.0:443+
  
-    option home /www/owncloud+  config uhttpd main 
 +    list listen_http  0.0.0.0:81 
 +    list listen_http  [::]:81
  
-    list interpreter  ".php=/usr/bin/php-cgi"+    list listen_https  0.0.0.0:8443 
 +    list listen_https  [::]:8443
  
-    option index_page  index.php, index.html, index.htm, default.html, default.htm+Restart uhhtpd.
  
-...+  /etc/init.d/uhttpd restart
  
-config uhttpd config +You should be able to reach luci under e.g. http://192.168.1.1:81
-    list listen_https  192.168.1.1:81 +
-    list listen_https  0.0.0.0:444+
  
-    option home  /www +==== Install lighttpd ====
-''|+
  
-after a restart of uhhtp+Install [[docs:guide-user:services:webserver:lighttpd|Lighttpd webserver]] packages:
  
- /etc/init.d/uhttpd restart+  opkg install lighttpd lighttpd-mod-cgi lighttpd-mod-fastcgi lighttpd-mod-access
  
-you should be able to reach luci under e.g. http://192.168.1.1:81+Now configure lighttpd for ownCloudEdit the config-file ''/etc/lighttpd/lighttpd.conf''
  
-==== disable httpd and use luci on lighttpd ====+Set www-root for ownCloud: 
  
-Somewhere I got the hint to use lighttpd for running ownCloudI tried out uhttpd simultaneously the interface looked quite broken.+ server.document-root = "/www/owncloud"
  
-If you don't want to run two web servers simultaneously:+see errors on syslog:
  
-Disable uhttpd even after reboot 
- 
- /etc/init.d/uhttpd disable 
- /etc/init.d/uhttpd stop 
- 
-Remember, at this point you can't use luci. So install lighttpd: 
- 
- 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 wasting space by doing this (learn more about SquashFS!). Otherwise you're able to remove httpd by typing 
- 
- opkg --force-depends remove uhttpd 
- 
- 
-Now configure lighttpd, to be able to use luci again. 
- 
-Edit the config-file /etc/lighttpd/lighttpd.conf 
- 
-Uncomment the mod_cgi: 
- 
- server.modules = ( 
-         "mod_cgi" 
- ) 
- 
-see errors on syslog: 
  server.error-log-use-syslog = "enable"  server.error-log-use-syslog = "enable"
  
-assign luci to lua +Uncomment the mod_cgi and add modules:
- cgi.assign = ( "luci" => "/usr/bin/lua"+
- +
-At this point it's possible to start the server... +
- +
- /etc/init.d/lighttpd start +
- /etc/init.d/lighttpd enable +
- +
- ...and access luci again. Use e.g. http://192.168.1.1:81 +
- +
-==== Configure lighttpd for OwnCloud ====+
  
  server.modules = (  server.modules = (
  "mod_access",  "mod_access",
- "mod_cgi"+         "mod_cgi"
  )  )
  
 +Assign port 80 for the ownCloud Server:
  
-cause, we'll move the Luci-Server to the Port 81; we need the port 80 for the OwnCloud-Server: 
  server.port = 80  server.port = 80
- 
-Set www-root for OwnCloud (We will add a new server for Luci later.):  
- 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
Line 145: Line 99:
  $HTTP["url"] =~ "^/data/" {  $HTTP["url"] =~ "^/data/" {
  url.access-deny = ("")  url.access-deny = ("")
- + }
  
  $HTTP["url"] =~ "^($|/)" {  $HTTP["url"] =~ "^($|/)" {
Line 151: Line 105:
  }  }
  
-And append a new server for luci: +Start the server:
- $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: + /etc/init.d/lighttpd start
- #cgi.assign = ( "luci" => "/usr/bin/lua" )+
  
-Restart the webserver with+Enable server for next boots:
  
- /etc/init.d/lighttpd restart + /etc/init.d/lighttpd enable
- +
-And make sure it's enabled for next boots: +
- +
- /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 :)+
  
 ===== Install & configure PHP ===== ===== 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: 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 php7 php7-cgi php7-fastcgi php7-mod-json php7-mod-session php7-mod-zip libsqlite3 zoneinfo-core php7-mod-pdo php7-mod-pdo-sqlite php7-mod-ctype php7-mod-mbstring php7-mod-gd sqlite3-cli php7-mod-sqlite3 php7-mod-curl curl php7-mod-xml php7-mod-simplexml php7-mod-hash php7-mod-dom php7-mod-iconv php7-mod-xmlwriter php7-mod-xmlreader php7-mod-intl
  
 Those packages are also suggested: Those packages are also suggested:
- opkg install php5-mod-mcrypt php5-mod-openssl php5-mod-fileinfo php5-mod-exif+ opkg install php7-mod-mcrypt php7-mod-openssl php7-mod-fileinfo php7-mod-exif
  
 Configure /etc/php.ini to our needs and change the doc_root to our www-root: Configure /etc/php.ini to our needs and change the doc_root to our www-root:
Line 193: Line 137:
 Play around with memory_limit, I reduced the value form 8MB to 4MB ... but maybe 50MB might be better with 64MB RAM. 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
- /etc/init.d/php5-fastcgi enable + 
- /etc/init.d/php5-fastcgi start+ /etc/init.d/php7-fastcgi enable 
 + /etc/init.d/php7-fastcgi start
  
 ==== activate PHP in lighttpd.conf ==== ==== activate PHP in lighttpd.conf ====
  
-Uncomment to enable the fastcgi module+Uncomment to enable the fastcgi and access module
  server.modules = (  server.modules = (
  "mod_access",  "mod_access",
Line 231: Line 176:
  
 ===== 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-util 
- opkg install libopenssl openssl-utils + opkg install libopenssl openssl-util
-(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 252: Line 196:
  /etc/init.d/lighttpd restart  /etc/init.d/lighttpd restart
  
-===== unleash OwnCloud =====+===== MySQL Installation (Optional) ===== 
 + 
 +ownCloud is installed with SQLite by default. However SQLite is only good for testing and lightweight single user setups. It has no client synchronisation support, so other devices will not be able to synchronise with the data stored in an ownCloud SQLite database. MariaDB is the ownCloud recommended database. 
 + 
 +Install the recommended MySQL/MariaDB database: 
 + 
 +  opkg update 
 +  opkg install mysql-server mariadb-client-extra php7-mod-pdo-mysql 
 +   
 +Configure the database server: 
 + 
 +  sed -i 's,^datadir.*,datadir         = "/srv/mysql",g' /etc/my.cnf 
 +  sed -i 's,^tmpdir.*,tmpdir          = "/tmp",g' /etc/my.cnf 
 +   
 +  mkdir -p /srv/mysql 
 +  mysql_install_db --force 
 +   
 +Start MySQL: 
 + 
 +  /etc/init.d/mysqld start 
 +  /etc/init.d/mysqld enable 
 +   
 +Set password for root user: 
 + 
 +  mysqladmin -u root password 'password' 
 +   
 +Connect to MySQL database: 
 + 
 +  mysql -uroot -p 
 +   
 +Create user for web server and set its password: 
 + 
 +  CREATE USER 'http'@'localhost' IDENTIFIED BY 'password'; 
 +   
 +Create database for ownCloud and set privileges: 
 + 
 +  CREATE DATABASE IF NOT EXISTS owncloud; 
 +  GRANT ALL PRIVILEGES ON owncloud.* TO 'http'@'localhost' IDENTIFIED BY 'password'; 
 +  FLUSH PRIVILEGES; 
 +   
 +For more information, please refer to the documentation: https://doc.owncloud.org/server/10.4/admin_manual/installation/installation_wizard.html#post-installation-steps-label. 
 + 
 +===== Unleash ownCloud =====
  
 Download and unpack the newest revision: Download and unpack the newest revision:
  
-| ''cd /tmp +  cd /tmp 
-wget http://mirrors.owncloud.org/release/ownclound-X.X.X.tar.bz2 +  wget https://download.owncloud.org/community/owncloud-X.X.X.tar.bz2 
-opkg update +  opkg update 
-opkg install tar +  opkg install tar 
-cd /www +  cd /www 
-tar -xjf /tmp/owncloud-X.X.X.tar.bz2 +  tar -xjf /tmp/owncloud-X.X.X.tar.bz2
-'' |+
  
 Now you should cleanup: Now you should cleanup:
  
-| ''rm /tmp/owncloud-X.X.X.tar.bz2 +  rm /tmp/owncloud-X.X.X.tar.bz2 
-opkg remove --autoremove tar +  opkg remove --autoremove tar
-'' |+
  
 You have to configure the rights of the /www/owncloud in addition. 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 +  chown -R root:root /www/owncloud 
-'' |+  chmod 770 -R /mnt/sda1/owncloud/data
  
-| ''cd /mnt/sda1 +  cd /mnt/sda1 
-mkdir owncloud +  mkdir owncloud 
-cd owncloud +  cd owncloud 
-mkdir data +  mkdir data 
-chown -R root:root /mnt/sda1/owncloud +  chown -hR http /mnt/sda1/owncloud 
-chmod 770 -R /mnt/sda1/owncloud +  chmod 770 -R /mnt/sda1/owncloud 
-'' |+ 
 +create the following folder after installation and change its permissions: 
 +  cd /www/owncloud 
 +  mkdir apps-external 
 +  chmod 777 apps-external
  
 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 =====+===== Enable Background Jobs =====
  
-Format your USB drive as ext3 or ext4 and plug it into your Openwrt router+ownCloud requires background jobs like database cleanup. For best performance, it is recommended to enable background jobs. 
  
-download the script from gizfun.com, run it and you are good to go+Enable Cron job:
  
-''wget http://www.gizfun.com/dl/web_for_openwrt.sh'' #This link does not available now.+  opkg install sudo 
 +  crontab -u http -e 
 +  * * * * * /usr/bin/php-cli /www/owncloud/occ system:cron
  
-''sh web_for_openwrt.sh''+For more information, please refer to the documentation: https://doc.owncloud.com/server/admin_manual/configuration/server/background_jobs_configuration.html.
  
-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 [[docs:guide-user:additional-software:opkg#non-standard_installation_destinations|Opkg Package Manager - Non-standard Installation Destinations]]
-=====Owncloud on alternative destination ===== +
- +
-If you don't want to set up a extroot, you can install owncloud on a different location (doc:techref:opkg#mount.point)+
  
 Install php on another location, then Install php on another location, then
 | ''ln -s /opt/etc/php.ini /etc/php.ini | ''ln -s /opt/etc/php.ini /etc/php.ini
-ln -s /opt/etc/php5 /etc/php5+ln -s /opt/etc/php7 /etc/php7
 '' | '' |
  
Line 312: Line 299:
 ln -s /opt/usr/share/zoneinfo/ /usr/share/zoneinfo/ ln -s /opt/usr/share/zoneinfo/ /usr/share/zoneinfo/
 '' | '' |
- 
-TODO 
- 
-===== 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 =====
Line 332: Line 312:
  
   * [0] [[http://downloads.openwrt.org/snapshots/]]   * [0] [[http://downloads.openwrt.org/snapshots/]]
-  * [1] [[doc/howto/usb.essentials]] +  * [1] [[docs:guide-user:storage:usb-installing|Installing and troubleshooting USB Drivers]] 
-  * [2] [[docs/user-guide/storage/usb-drives]]+  * [2] [[docs:guide-user:storage:usb-drives|Using storage devices]]
   * [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]]   * [5] [[http://www.gizfun.com/content/install-owncloud-your-openwrt-router-3-steps]]
  • Last modified: 2022/07/05 11:01
  • by stokito