Prerequisites & VPS Selection
Before starting this deployment, ensure you have:
- Ubuntu 22.04 LTS installed
- Root or sudo access to your server
- A registered domain name pointed to your VPS IP address
- Basic familiarity with Linux command line operations
Update Your System
Connect to your VPS via SSH and update all system packages:
sudo apt update && sudo apt upgrade -yInstall Required Dependencies
ownCloud requires a LAMP stack with specific PHP extensions:
sudo apt install -y apache2 mariadb-server libapache2-mod-php8.1 \
php8.1-gd php8.1-mysql php8.1-curl php8.1-mbstring \
php8.1-intl php8.1-gmp php8.1-bcmath php8.1-xml \
php8.1-zip php8.1-imagick php8.1-redis redis-server \
unzip wgetsudo a2enmod rewrite headers env dir mimeConfigure MariaDB
Secure your MariaDB installation:
sudo mysql_secure_installationFollow the prompts to set a root password, remove anonymous users, disallow remote root login, and remove the test database.
sudo mysql -u root -pCREATE DATABASE owncloud;
CREATE USER 'owncloud'@'localhost' IDENTIFIED BY 'your_secure_password';
GRANT ALL PRIVILEGES ON owncloud.* TO 'owncloud'@'localhost';
FLUSH PRIVILEGES;
EXIT;⚠️ Important: Replace 'your_secure_password' with a strong, unique password!
Configure PHP
Edit the PHP configuration file to optimize for ownCloud:
sudo nano /etc/php/8.1/apache2/php.inimemory_limit = 512M
upload_max_filesize = 512M
post_max_size = 512M
max_execution_time = 300
date.timezone = America/New_York
opcache.enable=1
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000
opcache.memory_consumption=128
opcache.save_comments=1
opcache.revalidate_freq=1Adjust date.timezone to match your location. Save and exit (Ctrl+X, Y, Enter).
Download and Install ownCloud
Download the latest stable version:
cd /tmp
wget https://download.owncloud.com/server/stable/owncloud-complete-latest.tar.bz2sudo tar -xjf owncloud-complete-latest.tar.bz2 -C /var/www/
sudo chown -R www-data:www-data /var/www/owncloud
sudo chmod -R 755 /var/www/owncloudConfigure Apache Virtual Host
Create a new Apache configuration file:
sudo nano /etc/apache2/sites-available/owncloud.conf<VirtualHost *:80>
ServerName cloud.yourdomain.com
DocumentRoot /var/www/owncloud
<Directory /var/www/owncloud/>
Options +FollowSymlinks
AllowOverride All
Require all granted
<IfModule mod_dav.c>
Dav off
</IfModule>
SetEnv HOME /var/www/owncloud
SetEnv HTTP_HOME /var/www/owncloud
</Directory>
ErrorLog ${APACHE_LOG_DIR}/owncloud_error.log
CustomLog ${APACHE_LOG_DIR}/owncloud_access.log combined
</VirtualHost>sudo a2ensite owncloud.conf
sudo a2dissite 000-default.conf
sudo systemctl reload apache2Install SSL Certificate
Secure your ownCloud installation with Let's Encrypt:
sudo apt install -y certbot python3-certbot-apache
sudo certbot --apache -d cloud.yourdomain.com✅ Follow the prompts to complete SSL setup. Certbot will auto-configure Apache.
Complete Web-Based Installation
Open your browser and navigate to https://cloud.yourdomain.com. Configure:
- Admin Account: Create an administrator username and password
- Data Folder: Leave as default (/var/www/owncloud/data) or specify custom location
- Database Configuration:
- Database user: owncloud
- Database password: The password you created in Step 4
- Database name: owncloud
- Database host: localhost
Click "Finish setup" and wait for the installation to complete.
Configure Redis for File Locking
Enable Redis for improved performance and file locking:
sudo nano /var/www/owncloud/config/config.php'memcache.local' => '\OC\Memcache\Redis',
'memcache.locking' => '\OC\Memcache\Redis',
'redis' => [
'host' => 'localhost',
'port' => 6379,
],Configure Trusted Domains
In the same config.php, ensure your domain is listed:
'trusted_domains' =>
array (
0 => 'localhost',
1 => 'cloud.yourdomain.com',
2 => 'your.server.ip.address',
),Set Up Cron Jobs
sudo crontab -u www-data -e
# Add this line:
*/15 * * * * /usr/bin/php8.1 -f /var/www/owncloud/cron.phpIn ownCloud web interface, go to Settings → Admin → Basic settings, and select "Cron" as the background jobs method.
Production Optimization
Configure Firewall
sudo ufw allow 'Apache Full'
sudo ufw enableEnable HSTS
sudo nano /etc/apache2/sites-available/owncloud-le-ssl.conf
# Add inside <VirtualHost *:443>:
Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains"
sudo systemctl reload apache2Increase MySQL Performance
sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf
# Add under [mysqld]:
innodb_buffer_pool_size = 512M
innodb_log_file_size = 128M
innodb_flush_method = O_DIRECT
innodb_flush_log_at_trx_commit = 2
sudo systemctl restart mariadbBackup & Maintenance
#!/bin/bash
BACKUP_DIR="/backup/owncloud"
DATE=$(date +%Y%m%d_%H%M%S)
# Create backup directory
mkdir -p $BACKUP_DIR
# Backup database
mysqldump -u root -p'your_mysql_root_password' owncloud > $BACKUP_DIR/owncloud_db_$DATE.sql
# Backup data and config
tar -czf $BACKUP_DIR/owncloud_files_$DATE.tar.gz /var/www/owncloud/data /var/www/owncloud/config
# Keep only last 7 days of backups
find $BACKUP_DIR -type f -mtime +7 -deletesudo chmod +x /usr/local/bin/owncloud-backup.sh
sudo crontab -e
# Add: 0 2 * * * /usr/local/bin/owncloud-backup.shMonitor Logs
# Apache logs
sudo tail -f /var/log/apache2/owncloud_error.log
# ownCloud logs
sudo tail -f /var/www/owncloud/data/owncloud.logCheck for Updates
sudo -u www-data php occ update:checkTroubleshooting
Security Hardening
- Enable Two-Factor Authentication via the TOTP app from ownCloud marketplace
- Configure server-side encryption in Settings → Admin → Encryption
- Install the "Brute-force settings" app to limit login attempts
Deployment Complete!
You now have a fully functional ownCloud installation on your RamNode VPS. This self-hosted solution provides enterprise-grade file synchronization and sharing while maintaining complete control over your data.
Download desktop and mobile clients from owncloud.com to sync across all your devices.
Additional Resources
Ready to Deploy ownCloud?
Get started with a RamNode VPS and own your cloud storage today.
View VPS Plans