Ubuntu Server Installation - Nextcloud¶
Part 1: Setting Up Cloudflare¶
-
Ensure Your Domain Uses Cloudflare DNS
-
Navigate to Network > Tunnels.
-
Create the tunnel and select Debian 64 Bit architecture.
-
Copy the Cloudflared Connector and install on Ubuntu 24.04 server
-
Configure Public Hostname
Part 2: Installing Nextcloud on Ubuntu Server 24.04¶
Step 1: Initial Setup¶
-
Install Necessary Packages:
-
Replace
.bashrc
: -
Update and Upgrade:
-
Updating hostname
Add the subdomain from cloudflareex: my.justaguylinux.cloud
Add line
127.0.1.1 ex: venetian my.justaguylinux.cloud
-
Reboot the Server:
-
Log Back In.
Step 2: Downloading and Installing Nextcloud¶
-
Download Nextcloud:
-
Install MariaDB:
-
Create Nextcloud Database:
Inside the MariaDB shell:
CREATE DATABASE nextcloud; GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextcloud'@'localhost' IDENTIFIED BY 'mypassword'; FLUSH PRIVILEGES;
Exit with
CTRL+D
.
Step 3: Set Up Apache Webserver¶
-
Install Required PHP Packages:
-
Enable Apache Modules:
-
Unzip Nextcloud:
-
Rename nextcloud to subdomain
5. Change nextcloud ownership -
Move nextcloud to apache
7. Disable default apache site -
Configure Apache for Nextcloud:
Add the following content:
<VirtualHost *:80> DocumentRoot "/var/www/my.justaguylinux.cloud" ServerName my.justaguylinux.cloud <Directory "/var/www/my.justaguylinux.cloud/"> Options MultiViews FollowSymlinks AllowOverride All Require all granted </Directory> TransferLog /var/log/apache2/my.justaguylinux.cloud_access.log ErrorLog /var/log/apache2/my.justaguylinux.cloud_error.log </VirtualHost>
-
Enable Nextcloud Site and Restart Apache:
Installing SSL¶
Install Certbot:
Attempt to obtain a certificate (DNS must have already propagated):
Step 4: Adjust PHP Settings¶
-
Edit PHP Configuration:
php.ini
Some of these will need changed others will need uncommnented and changed.
memory_limit = 512M
upload_max_filesize = 2G
max_execution_time = 360
post_max_size = 2G
date.timezone = America/New_York
opcache.enable = 1
opcache.interned_strings_buffer = 32
opcache.max_accelerated_files = 10000
opcache.memory_consumption = 128
opcache.save_comments = 1
opcache.revalidate_freq = 1
-
Enable acpu module
Add to the file:
apc.enable_cli=1
-
Restart Apache:
Step 5: Nextcloud via Web Browser¶
-
Install via Web: https://my.justaguylinux.cloud
-
Install recommended applications
Part 3: Dealing with Warnings¶
-
Change config.php permissions
-
Detected some missing optional indices.
Make occ executable:
Then add missing indices:
Check to see if error is no longer
-
One or more mimetype migrations are available
-
The following warnings
-
Server has no maintenance window start time configured.
-
The database is used for transactional file locking.
-
No memory cache has been configured.
-
Your installation has no default phone region set.
-
You have not set or verified your email server configuration yet.
maintenance => false,
Add:
'mail_from_address' => 'nextcloud', 'mail_smtpmode' => 'smtp', 'mail_sendmailmode' => 'smtp', 'mail_domain' => 'gmail.com', 'mail_smtphost' => 'smtp.gmail.com', 'mail_smtpport' => '587', 'mail_smtpauth' => 1, 'mail_smtpname' => '[email protected]', 'mail_smtppassword' => 'app-specific-pw', 'maintenance_window_start' => 1, 'memcache.local' => '\\OC\\Memcache\\APCu', 'memcache.distributed' => '\\OC\\Memcache\\Redis', 'memcache.locking' => '\\OC\\Memcache\\Redis', 'redis' => array ( 'host' => 'localhost', 'port' => 6379, ), 'default_phone_region' => 'US', 'overwriteprotocol' => 'https',
-
-
**Some headers are not set correctly on your instance - The
Strict-Transport-Security
HTTP header is not set (should be at least15552000
seconds). ****Add after
```SSL configuration (done by Certbot) SSLCertificateFile /etc/letsencrypt/live/my.justaguylinux.cloud/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/my.justaguylinux.cloud/privkey.pem
HSTS header¶
Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"
bash
sudo systemctl restart apache2
```
Source: https://www.learnlinux.tv/complete-walkthrough-for-installing-nextcloud-on-ubuntu-24-04/