Installing Nextcloud on Ubuntu 24.04 (Non-Docker)
(written April 2024)
This guide walks through installing Nextcloud on a fresh Ubuntu 24.04 virtual machine using Apache, MariaDB, and PHP, without Docker. This setup is ideal for users running a homelab, particularly on Proxmox.
Prerequisites
VM Configuration (Proxmox)
- Base OS: Ubuntu 24.04 Server
- CPU: 2 Cores (minimum)
- RAM: 2GB (4GB recommended)
- Disk: 32GB+ (more for large file storage)
- Network: Bridged mode with static IP (recommended)
System Preparation
1. Update system packages:
2. Install required dependencies:
sudo apt install -y apache2 mariadb-server libapache2-mod-php \
php php-gd php-mysql php-curl php-mbstring php-intl php-gmp \
php-bcmath php-imagick php-xml php-zip unzip curl gnupg2
Configure MariaDB
1. Secure the installation:
Use a strong root password and answer prompts to secure the DB.
2. Create database and user for Nextcloud:
Then within the MariaDB prompt:
CREATE DATABASE nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
CREATE USER 'nextclouduser'@'localhost' IDENTIFIED BY 'your_secure_password';
GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextclouduser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Download and Configure Nextcloud
1. Download Nextcloud:
cd /var/www/
sudo curl -LO https://download.nextcloud.com/server/releases/latest.zip
sudo unzip latest.zip
sudo chown -R www-data:www-data nextcloud
sudo chmod -R 755 nextcloud
Configure Apache
1. Create a new virtual host file:
Paste the following config (replace your.domain.com
if needed):
<VirtualHost *:80>
ServerName your.domain.com
DocumentRoot /var/www/nextcloud/
<Directory /var/www/nextcloud/>
Require all granted
AllowOverride All
Options FollowSymLinks MultiViews
</Directory>
ErrorLog ${APACHE_LOG_DIR}/nextcloud_error.log
CustomLog ${APACHE_LOG_DIR}/nextcloud_access.log combined
</VirtualHost>
2. Enable site and required modules:
sudo a2ensite nextcloud.conf
sudo a2enmod rewrite headers env dir mime setenvif ssl
sudo systemctl reload apache2
Finalize Installation
- Navigate to
http://your-server-ip
orhttp://your.domain.com
in a browser. - Set your admin user and password.
-
Enter the database info:
-
User:
nextclouduser
- Password:
your_secure_password
- Database:
nextcloud
- Host:
localhost
Optional: Enable HTTPS with Let's Encrypt
If you have a domain and want HTTPS:
Post-Install Tips
- Set up cron for background jobs:
Add:
- Set PHP memory limit (optional):
Increase:
- Restart Apache: