Install MariaDB.
apt install mariadb-server mariadb-client
Run the MariaDB installer.
mysql_secure_installation
Login to MariaDB as root
mysql -u root
Create a new user.
CREATE USER 'nextcloud'@'localhost' IDENTIFIED BY '***************';
Create a new database.
CREATE DATABASE nextcloud;
Modify privileges.
GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextcloud'@'localhost';
Flush privileges and exit.
FLUSH PRIVILEGES;
QUIT
Install PHP
apt install php8.3-{apcu,bcmath,cgi,cli,common,curl,gd,gmp,igbinary,intl,ldap,mbstring,mysql,opcache,readline,redis,xml,zip}
Install Apache
apt install apache2 libapache2-mod-php8.3
Edit the Apache PHP config.
PHPINI=/etc/php/8.3/apache2/php.ini
sed -i 's|;date.timezone.*|date.timezone = America/Denver|' $PHPINI && \
sed -i 's|memory_limit.*|memory_limit = 512M|' $PHPINI && \
sed -i 's|upload_max_filesize.*|upload_max_filesize = 500M|' $PHPINI && \
sed -i 's|post_max_size.*|post_max_size = 500M|' $PHPINI && \
sed -i 's|max_execution_time.*|max_execution_time = 300|' $PHPINI && \
sed -i 's|output_buffering.*|output_buffering = 0|' $PHPINI
Create a new vhost config for NC.
Notice that nextcloud
is included in the root - when navigating to the NC instance, you would now go to https://nc.domain.com/
instead of https://nc.domain.com/nextcloud/
<VirtualHost *:80>
DocumentRoot /var/www/html/nextcloud
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<IfModule mod_headers.c>
Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains"
</IfModule>
</VirtualHost>
Restart Apache.
systemctl restart apache2
Install unzip
apt install curl unzip
Download NextCloud
curl -o nextcloud-25.zip https://download.nextcloud.com/server/releases/nextcloud-25.0.4.zip
Unzip the download
unzip nextcloud-22.zip
Move the NextCloud directory
mv nextcloud /var/www/
Change the ownership of the new NextCloud directory.
chown -R www-data:www-data /var/www/nextcloud
Change the permissions too.
chmod -R 755 /var/www/nextcloud
Navigate to the web installer.
http://{serverip|hostname}/index.php
Create a new user account, select the data storage location, and enter the info for the database.