NextCloud
We are installing manually instead of using the package manager for the following reasons:
- Can obtain the newer version straight from NextCloud's website
- Don't want MySQL installed on the same server since I have a dedicate DB server (and also would rather use MariaDB)
- Want to use my own paths rather than the path Ubuntu uses which is different than everyone else.
Multiple web sites - This documentation assumes NextCloud will be an additional web site running on this server and as such will configure its own .conf files and manage each site separately.
Code:
cd /tmp
wget https://download.nextcloud.com/server/releases/nextcloud-12.0.4.zip.md5
wget https://download.nextcloud.com/server/releases/nextcloud-12.0.4.zip
Verify the file integrity of the download. Compare both numbers and insure they are identical:
Code:
md5sum /tmp/nextcloud-12.0.4.zip
d29aa3fd0a57bcc6fbf2af5a21d70c47 /tmp/nextcloud-12.0.4.zip
cat /tmp/nextcloud-12.0.4.zip.md5
d29aa3fd0a57bcc6fbf2af5a21d70c47 nextcloud-12.0.4.zip
Extract the archive:
Code:
cd /tmp
unzip /tmp/nextcloud-12.0.4.zip
chown www-data:www-data -R /tmp/nextcloud/
mv /tmp/nextcloud /var/www/nextcloud
rm /tmp/nextcloud*.zip
rm /tmp/nextcloud*.md5
Create the data repository location. It is recommended to keep this "Data" folder from being anywhere inside the web root folder to ensure users cannot simply browse it.
Code:
mkdir -p /var/www/nextcloud-data
chown www-data:www-data -R /var/www/nextcloud-data
Install NextCloud (create database)
Code:
cd /var/www/nextcloud/
sudo -u www-data php occ maintenance:install --database "mysql" --database-host="srv-mysql" --database-name "nextcloud" --database-table-prefix "nc_" --database-user "nextclouduser" --database-pass "nextclouduserpass" --data-dir "/var/www/nextcloud-data" --admin-user "nextcloudadmin" --admin-pass "nextcloudadminpass"
NextCloud Configuration File
Make sure your config looks similar to this but substituting your actual values and adding any missing lines:
Code:
vi /var/www/nextcloud/config/config.php
Code:
<?php
$CONFIG = array (
'instanceid' => 'ocndnnro5l72',
'passwordsalt' => 'bhiABCw6D7Ed3IF+mHpIzJF06vKLMN',
'secret' => 'abcdefghijklmnopqrstuvwxyz123456790',
'trusted_domains' =>
array (
0 => 'nextcloud.mydomain.com',
1 => '192.168.107.10',
2 => 'localhost',
),
'datadirectory' => '/var/www/nextcloud-data',
'overwrite.cli.url' => 'http://nextcloud.mydomain.com',
'htaccess.RewriteBase' => '/',
'dbtype' => 'mysql',
'version' => '12.0.4.3',
'dbname' => 'nextcloud',
'dbhost' => 'srv-mysql',
'dbport' => '',
'dbtableprefix' => 'nc_',
'dbuser' => 'nextclouduser',
'dbpassword' => 'nextclouduserpass!',
'auth.bruteforce.protection.enabled' => true,
'installed' => true,
);
Create Apache Config for NextCloud
Code:
vi /etc/apache2/sites-available/nextcloud.conf
Code:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName nextcloud.mydomain.com
DocumentRoot /var/www/nextcloud
ErrorLog ${APACHE_LOG_DIR}/nc-error.log
CustomLog ${APACHE_LOG_DIR}/nc-access.log combined
<Directory /var/www/nextcloud/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
<IfModule mod_dav.c>
Dav off
</IfModule>
SetEnv HOME /var/www/nextcloud
SetEnv HTTP_HOME /var/www/nextcloud
</Directory>
</VirtualHost>
Enable the site configuration:
If you need to disable the site in the future:
Code:
a2dissite nextcloud
Reload the Apache config so it is aware of the modified virtual host
Code:
service apache2 reload
NextCloud Login
Now, go to your IP address or domain name in your browser:
Example: http://192.168.107.9/ or http://nextcloud.mydomain.com/
Make sure you can login with your admin account.
Bookmarks