Setting up your very own Cloud with Nextcloud on Linode

YouTube player

Setup Commands

Adding a user

sudo adduser jdoe

Adding a user to the sudo group

sudo usermod -aG sudo jdoe

Update packages

sudo apt update
sudo apt dist-upgrade

Set the hostname

sudo nano /etc/hostname
sudo nano /etc/hosts

Reboot to save all changes so far

sudo reboot

Download Nextcloud

Go to:

Click “Download for server” and copy the link address

Set up database server

sudo apt install mariadb-server

Create Nextcloud Database

sudo mariadb
GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextcloud'@'localhost' IDENTIFIED BY 'mypassword';

CTRL+D to exit

Install required packages

sudo apt install php php-cli php-common php-curl php-xml php-gd php-mbstring php-zip php-mysql

Make sure apache2 is listed as a package in the list to be installed

Check status with systemctl

systemctl status apache2
systemctl status mariadb

Install zip and unzip nextcloud

sudo apt install unzip
unzip nextcloud-<version>.zip

Organize Apache files

mv nextcloud
sudo chown -R www-data:www-data
sudo mv /var/www
sudo a2dissite 000-default.conf
sudo systemctl reload apache2

Add Apache virtual host for Nextcloud

sudo nano /etc/apache2/sites-available/
<VirtualHost *:80>
   DocumentRoot "/var/www/"

<Directory "/var/www/">
   Options MultiViews FollowSymlinks
   AllowOverride All
   Order allow,deny
   Allow from all

TransferLog /var/log/apache2/nc.learnlinux.tv_access.log
ErrorLog /var/log/apache2/nc.learnlinux.tv_error.log


Enable the site

sudo a2ensite

Configure PHP

sudo nano /etc/php/7.2/apache2/php.ini
memory_limit = 512M
upload_max_filesize = 200M
max_execution_time = 360
post_max_size = 200M
date.timezone = America/Detroit

Enable required Apache mods

sudo a2enmod rewrite
sudo a2enmod headers
sudo a2enmod env
sudo a2enmod dir
sudo a2enmod mime
sudo a2enmod ssl
sudo systemctl restart apache2

Create an SSL certificate

sudo add-apt-repository ppa:certbot/certbot
sudo certbot --apache -d

LPI Course Now Available!

Support Linux Learning and get yourself some cool Linux swag!

Check out the Shop!

Support Linux Learning and get yourself some cool Linux swag!

Support Linux Learning

Consider becoming a Patron and/or Channel Member to receive exclusive perks!

Receive 5% off an LPI exam voucher!