26 Mar 2022
The purpose of this article, is to deploy a light-weight, cloud solution for friends and family. I will be creating a Proxmox VE 7 LXC, running Ubuntu 20.04 LTS and deploying NextCloud. Furthermore.
NextCloud offers the industry-leading, on-premises content collaboration platform. It combines the convenience and ease of use of consumer-grade solutions like Dropbox and Google Drive with security, privacy and control, while being compliant with HIPAA, GDPR and more.
NextCloud is entirely open-source, free of lockin or paywalls.
See how NextCloud compares against Office 365, OwnCloud and others.
In this demonstration I will be deploying a light-weight NextCloud instance using a Proxmox unprivileged LXC running Ubuntu 20.04 LTS. This instance will be without the integrated Office and Talk features, therefore my resources will be set to:
I have monitored this deployment and over a month the maximum memory usage was 271 MB and average CPU between 0.1 to 0.5%. The completed installation takes 1.01 GB of the 8 GB disk.
Always start by updating the repositories and upgrading any available packages.
sudo apt update && sudo apt upgrade -y
Now install the core packages required for NextCloud.
sudo apt install -y gpg
sudo apt install -y apache2 mariadb-server libapache2-mod-php7.4
sudo apt install -y php7.4-gd php7.4-mysql php7.4-curl php7.4-mbstring php7.4-intl
sudo apt install -y php7.4-gmp php7.4-bcmath php-imagick php7.4-xml php7.4-zip
Because I have an addition hard disk I will be creating a nextcloud
directory and setting its permissions.
mkdir /mnt/data/nextcloud
chown -R www-data:www-data /mnt/data/nextcloud
Now we start mySQL and login using root
sudo /etc/init.d/mysql start
sudo mysql -uroot -p
The following commands will create a new database called nextcloud
and a user called nextcloud
.
CREATE USER 'nextcloud'@'localhost' IDENTIFIED BY 'UNxQzQn8jdzEMBDs4yKKVzwmm';
CREATE DATABASE IF NOT EXISTS nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextcloud'@'localhost';
FLUSH PRIVILEGES;
quit;
Download the NextCloud release
wget https://download.nextcloud.com/server/releases/nextcloud-23.0.0.tar.bz2
wget https://download.nextcloud.com/server/releases/nextcloud-23.0.0.tar.bz2.sha256
sha256sum -c nextcloud-23.0.0.tar.bz2.sha256 < nextcloud-23.0.0.tar.bz2
wget https://download.nextcloud.com/server/releases/nextcloud-23.0.0.tar.bz2.asc
wget https://nextcloud.com/nextcloud.asc
gpg --verify nextcloud-23.0.0.tar.bz2.asc nextcloud-23.0.0.tar.bz2
Extract the contents
tar -xjvf nextcloud-23.0.0.tar.bz2
Copy the contents over to the /var/www
directory
cp -r nextcloud /var/www
Clean up by removing the NextCloud files
rm -R nextcloud \
nextcloud-23.0.0.tar.bz2 \
nextcloud-23.0.0.tar.bz2.asc \
nextcloud-23.0.0.tar.bz2.sha256 \
nextcloud.asc
Now we will create a new Apache configuration for our NextCloud instance.
nano /etc/apache2/sites-available/nextcloud.conf
Copy the below and modify the ServerName
value.
<VirtualHost *:80>
DocumentRoot /var/www/nextcloud/
ServerName nextcloud.networkingdream.com
<Directory /var/www/nextcloud/>
Require all granted
AllowOverride All
Satisfy Any
Options FollowSymLinks MultiViews
php_admin_value memory_limit 512M
<IfModule mod_dav.c>
Dav off
</IfModule>
</Directory>
</VirtualHost>
Test the Apache configuration by using the following command
apache2ctl configtest
Now enable the NextCloud site conf and disable the default site.
a2ensite nextcloud.conf
a2dissite 000-default.conf
We will be enabling a few Apache2 modes
a2enmod rewrite
a2enmod headers
a2enmod env
a2enmod dir
a2enmod mime
Once enabled, reload the Apache2 service.
sudo systemctl reload apache2
chown -R www-data:www-data /var/www/nextcloud/
Find the IP address of the NextCloud server
ip addr
Visit server address and complete Installation Wizard.
http://192.168.1.x/
Modify the NextCloud config file
sudo nano /var/www/nextcloud/config/config.php
Add your trusted domains as an array, as shown below.
'trusted_domains' =>
array (
0 => '192.168.1.x',
1 => 'nextcloud.networkingdream.com',
),
Modify the NextCloud config file
sudo nano /var/www/nextcloud/config/config.php
Copy and overwrite the value in your configuration file, make sure to change the address.
'overwrite.cli.url' => 'https://nextcloud.networkingdream.com',
'htaccess.RewriteBase' => '/',
Run the below occ-command to update your .htaccess
file.
sudo -u www-data php /var/www/nextcloud/occ maintenance:update:htaccess
Now reload the Apache2 service.
sudo systemctl reload apache2
Modify the NextCloud config file
sudo nano /var/www/nextcloud/config/config.php
Add your reverse proxy server information, as shown below.
'trusted_proxies' => ['192.168.1.250'],
'overwriteprotocol' => 'https',
Now reload the Apache2 service.
sudo systemctl reload apache2
Install the php-apcu
package and then reload the Apache2 service.
sudo apt install -y php-apcu
sudo systemctl reload apache2
Next modify the Nextcloud config file
sudo nano /var/www/nextcloud/config/config.php
Setting the below value.
'memcache.local' => '\OC\Memcache\APCu',
To enable SVG support install the below packages
sudo apt install -y php-imagick libmagickcore-6.q16-6-extra
The default phone region is en
, to set a new default region, modify the NextCloud config file
sudo nano /var/www/nextcloud/config/config.php
Set your region as shown below.
'default_phone_region' => 'GB',