How To Install Nextcloud In Ubuntu 16.04 Using Apache

https://www.ostechnix.com/install-nextcloud-ubuntu-16-04-lts/

https://docs.nextcloud.com/server/11/admin_manual/installation/source_installation.html

https://bayton.org/2016/07/installing-nextcloud-on-ubuntu-16-04-lts-with-redis-apcu-apache/
also adds crontab for letsencrypt certificate renewal

Installation

$ sudo apt-get update

$ sudo apt-get upgrade

$ sudo apt-get install php-gd php-json php-mysql php-curl php-intl php-mcrypt php-imagick php-zip php-dom php7.0-xml php-mbstring wget unzip

edit php.ini file:

$ sudo nano /etc/php/7.0/apache2/php.ini

Find and edit or modify the following values. Use Ctrl+w to search for each line:

[...]

memory_limit = 512M

upload_max_filesize = 200M

post_max_size = 200M

[...]

Ctrl+x, then ‘Y' to save and exit.

Restart Apache service to take effect the changes.

$ sudo systemctl restart apache2

Create database for Nextcloud

Log in to mysql prompt using command:

mysql -u root -p

Enter the following commands one by one to create the database, database user:

mysql> CREATE DATABASE nextcloud;

mysql> GRANT ALL PRIVILEGES ON nextcloud.* TO 'vagrant'@'localhost' IDENTIFIED BY 'nextcloudpw';

mysql> FLUSH PRIVILEGES;

mysql> \q

Download Nextcloud

$ wget https://download.nextcloud.com/server/releases/nextcloud-11.0.2.zip

Extract the downloaded zip with command:

$ unzip nextcloud-11.0.2.zip

Move the extracted folder to your web root directory i.e /var/www/html/ in our case.

$ sudo cp -r nextcloud/ /var/www/html/

Set the proper ownership permission to the nextcloud directory:

$ sudo chown -R www-data:www-data /var/www/html/nextcloud/

Next, create a /etc/apache2/sites-available/nextcloud.conf file:

$ sudo nano /etc/apache2/sites-available/nextcloud.conf

Add the following lines. Replace the path (/var/www/html/nextcloud/) with your own path values.

Alias /nextcloud "/var/www/html/nextcloud/"

<Directory /var/www/html/nextcloud/>
  Options +FollowSymlinks
  AllowOverride All

 <IfModule mod_dav.c>
  Dav off
 </IfModule>

 SetEnv HOME /var/www/html/nextcloud
 SetEnv HTTP_HOME /var/www/html/nextcloud

</Directory>

Ctrl+x, then ‘Y' to save and exit.

Then create a symlink to /etc/apache2/sites-enabled/ directory using the following command:

$ sudo ln -s /etc/apache2/sites-available/nextcloud.conf /etc/apache2/sites-enabled/nextcloud.conf

For Nextcloud to work correctly, we need to enable the following Apache modules.

$ sudo a2enmod rewrite

$ sudo a2enmod headers

$ sudo a2enmod env

$ sudo a2enmod dir

$ sudo a2enmod mime

Restart Apache service:

$ sudo systemctl restart apache2

Start Nextcloud web installer

Open up your web browser and navigate to URL: http://IP_Address/nextcloud or http://domain_name/nextcloud.

Create a new admin account and enter database user name, password, and database name that you chose when you created the database above. Done.


How To Create a Self-Signed SSL Certificate for Apache in Ubuntu 16.04

Configuring Memory Caching In Nextcloud

Enabling Pretty links In Nextcloud

How To Install Nextant Full Text Search For NextCloud

How To Install Tesseract OCR For Nextant and Nextcloud


Adding a crontab

As the certificate currently expires after 90 days by default, to automatically renew the certificate let’s create a cronjob:

sudo crontab -e

This will open the crontab file for the root user. Add the following line to the crontab file (substitute ‘username' with your username:

0 0 * * 0 /home/username/certbot-auto renew

Ctrl+X, then ‘Y' to save and exit.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.