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: https://nextcloud.com/install/
Click “Download for server” and copy the link address
Set up database server
sudo apt install mariadb-server mysql_secure_installation
Create Nextcloud Database
sudo mariadb CREATE DATABASE nextcloud; SHOW DATABASES; GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextcloud'@'localhost' IDENTIFIED BY 'mypassword'; FLUSH PRIVILEGES;
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 nc.learnlinux.tv sudo chown -R www-data:www-data nc.learnlinux.tv sudo mv nc.learnlinux.tv /var/www sudo a2dissite 000-default.conf sudo systemctl reload apache2
Add Apache virtual host for Nextcloud
sudo nano /etc/apache2/sites-available/nc.learnlinux.tv.conf
<VirtualHost *:80>
DocumentRoot "/var/www/nc.learnlinux.tv"
ServerName nc.learnlinux.tv
<Directory "/var/www/nc.learnlinux.tv/">
Options MultiViews FollowSymlinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
TransferLog /var/log/apache2/nc.learnlinux.tv_access.log
ErrorLog /var/log/apache2/nc.learnlinux.tv_error.log
</VirtualHost>
Enable the site
sudo a2ensite nc.learnlinux.tv.conf
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 nc.learnlinux.tv