Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
virtualisation:nextcloud [2018/02/27 14:40] buettnervirtualisation:nextcloud [2018/03/01 09:19] (current) buettner
Line 1: Line 1:
-====How to setup Nextcloud on a NB2800 router====+======How to setup Nextcloud on a NB2800 router======
  
 This article describes how to setup a Nextcloud server on your NB2800 router. This article describes how to setup a Nextcloud server on your NB2800 router.
  
-[[https://nextcloud.com/|Nextcloud]] is a free and open source cloud hosting software. It lets you easily provide files for and share them with others, and lets you customize your cloud with a lot of tools and additional apps.+[[https://nextcloud.com/|Nextcloud]] is a free and open source cloud hosting software. It lets you easily share your files with others, hosts your own calenders and contact lists and lets you customize your cloud with a lot of tools and additional apps.
  
 ===Preparations=== ===Preparations===
- 
-All basic preparations made are described in this article: [[http://wiki.netmodule.com/virtualisation/file-server | How to set up a NB2800 File Server ]] 
  
 If you need instructions on how to set up a LXC Container on NB2800 Routers, you can refer to this page: http://wiki.netmodule.com/app-notes/virtualisation.  If you need instructions on how to set up a LXC Container on NB2800 Routers, you can refer to this page: http://wiki.netmodule.com/app-notes/virtualisation. 
 +
 +The first step you should take is to give your router a static IP adress. For this, use 
 +<code>
 +nano /etc/network/interfaces
 +</code>
 +and set up a static IP configuration for your primary interface. In this example, the configuration for the eth0 interface looks like this:
 +<konsole>
 +auto eth0
 +iface eth0 inet static
 +address 192.168.1.50
 +netmask 255.255.255.0
 +network 192.168.1.0
 +broadcast 192.168.1.255
 +gateway 192.168.1.105
 +dns-nameservers 192.168.1.105
 +</konsole>
 +
 +After that, use 
 +<code>
 +apt-get update
 +apt-get upgrade
 +</code>
 +to bring your system up to date.
 +
 +If your network setup doesn't include a domain you could use on your router, you can easily create one you can use to access your file server.
 +
 +For this, get access to the routers web interface and go to Services -> DNS Server. Under "Static Hosts" , click on the plus symbol to add a new domain name.
 +
 +Now enter the IP address and the domain name you want it linked to and click "Apply"
 +{{ :virtualisation:local_domain_lxc2.png?nolink&600 |}}
 +
 +
 +After this, your configuration should look like this:
 +
 +{{ :virtualisation:local_domain_lxc.png?nolink&600 |}}
 +
 +Now you can access the file server with both its IP address a its local domain name.
 +
  
 ===Installations=== ===Installations===
  
-Before Nextcloud can be installed, some other programs need to be installed and set up. In the first step, enter+Before Nextcloud can be installed, a web server (here: Nginx), a SQL program (here: MariaDB) and PHP need to be installed and set up. In the first step, install these programs by entering
 <code> <code>
 +apt-get update
 apt-get install nginx mariadb-client mariadb-server php7.0-common php7.0-fpm php7.0-cli php7.0-json php7.0-mysql php7.0-curl php7.0-intl php7.0-mcrypt php-pear php7.0-gd php7.0-zip php7.0-xml php7.0-mbstring php7.0-apcu apt-get install nginx mariadb-client mariadb-server php7.0-common php7.0-fpm php7.0-cli php7.0-json php7.0-mysql php7.0-curl php7.0-intl php7.0-mcrypt php-pear php7.0-gd php7.0-zip php7.0-xml php7.0-mbstring php7.0-apcu
 </code> </code>
Line 25: Line 62:
 ===Configuring PHP=== ===Configuring PHP===
  
-For setting up PHP, several values in three files have to be edited. First, go to /etc/php/7.0/fpm/pool.d/www.conf and edit the following values (Note: all values described here have to be edited, decommented or added):+For setting up PHP, several values in three files have to be edited. First, go to /etc/php/7.0/fpm/pool.d/www.conf and edit the following values (Note: all values described here have to be edited, decommentedor added):
 <code c /etc/php/7.0/fpm/pool.d/www.conf> <code c /etc/php/7.0/fpm/pool.d/www.conf>
 user = www-data user = www-data
Line 63: Line 100:
 ===Configuring MariaDB=== ===Configuring MariaDB===
  
-First, you have to finish the MariDB installation:+First, you have to finish the MariaDB installation:
 <code> <code>
 mysql_secure_installation mysql_secure_installation
Line 73: Line 110:
 service mysql restart service mysql restart
 </code> </code>
-Now you have to create a new MariaDB user which is only needed for Nextcloud access. To enter the MariaDB editing  shell, enter+Now you have to create a new MariaDB database and an user which is only needed for Nextcloud access. To enter the MariaDB shell, enter
 <code> <code>
 mysql -u root -p mysql -u root -p
Line 81: Line 118:
 create database nextcloud_db; create database nextcloud_db;
 </code> </code>
-Now create a new MariaDB-user with a password which can access the "nextcloud_db":+Now create a new MariaDB user with a password which can access the "nextcloud_db":
 <code> <code>
 create user 'user'@localhost identified by 'password'; create user 'user'@localhost identified by 'password';
Line 87: Line 124:
 Note that you have to enter your own credentials for 'user' and 'password'. Note that you have to enter your own credentials for 'user' and 'password'.
  
-Now all necessary right have to be granted to this new user:+Now all necessary rights have to be granted to this new user:
 <code> <code>
 grant all privileges on nextcloud_db.* to 'user'@localhost; grant all privileges on nextcloud_db.* to 'user'@localhost;
Line 114: Line 151:
 First, go to /etc/nginx/nginx.conf and edit the following three lines: First, go to /etc/nginx/nginx.conf and edit the following three lines:
 <code c /etc/nginx/nginx.conf> <code c /etc/nginx/nginx.conf>
-überprüfen ob user = www-data +user = www-data 
-überprüfen ob worker_process = auto +worker_process = auto 
-in html-Block: server_tokens off+server_tokens off
 </code> </code>
  
Line 270: Line 307:
 nginx -t nginx -t
 </code> </code>
 +
 +<konsole>
 +root@LXC_MEDIA:/# nginx -t
 +nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
 +nginx: configuration file /etc/nginx/nginx.conf test is successful
 +</konsole>
  
 If no error occurs, restart Nginx with If no error occurs, restart Nginx with
Line 279: Line 322:
 ===Nextcloud Download and Installation=== ===Nextcloud Download and Installation===
  
-First, download the Nextcloud installation file from the Nextcloud homepage. Before downloading the file, you should visit the [[https://nextcloud.com/install/#instructions-server|Nextcloud download page]] to check for the newest version+First, download the Nextcloud installation file from the Nextcloud homepage. Before downloading the file, you should visit the [[https://nextcloud.com/install/#instructions-server|Nextcloud download page]] to check for the newest version.
 <code> <code>
 wget https://download.nextcloud.com/server/releases/nextcloud-13.0.0.tar.bz2 wget https://download.nextcloud.com/server/releases/nextcloud-13.0.0.tar.bz2
 +</code>
 +After the download finished, extract the file to its directory:
 +<code>
 +tar -xjf nextcloud-13.0.0.tar.bz2 -C /var/www
 +</code>
 +If you want to, you can now delete the installation file:
 +<code>
 +rm nextcloud-13.0.0.tar.bz2
 +</code>
 +Now you have to set the correct user and group to the Nextcloud folder:
 +<code>
 +chown -R www-data:www-data /var/www/nextcloud
 </code> </code>
  
 +Now open your web browser and go to http://Ip-address-or-domain to enter the Nextcloud installation screen.
 +
 +Here you have to set credentials for an administrator and enter the MariaDB user credentials you set earlier.
 +
 +{{ :virtualisation:nc-setup.jpg?nolink&600 |}}
 +
 +
 +===Configuration Nextcloud===
 +
 +After Nextcloud was installed succesfully, go to /var/www/nextcloud/config/config.php and add or edit the following lines:
 +<code c /var/www/nextcloud/config/config.php>
 +'memcache.local' => '\OC\Memcache\APCu',
 +'trusted_domains' =>
 + array (
 + 0 => 'mediacontainer.local',
 + 1 => '192.168.1.50',
 + ),
 +'overwriteprotocol' => 'https',
 +'logtimezone' => 'Europe/Berlin',
 +</code>