This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
computing:nextcloud [2019/06/15 23:47] – oemb1905 | computing:nextcloud [2024/07/13 04:12] (current) – oemb1905 | ||
---|---|---|---|
Line 11: | Line 11: | ||
------------------------------------------- | ------------------------------------------- | ||
- | This tutorial is for users of Debian GNU/ | + | This tutorial is for a Nextcloud instance on Debian GNU/ |
- | sudo apt install | + | sudo apt install |
| | ||
- | Ok, now let's download Nextcloud 15.x and proceed as follows, assuming you have left the webroot in / | + | Or ... |
| | ||
- | | + | sudo apt-get install php-{xml, |
- | | + | |
- | sudo unzip nextcloud-15.0.8.zip | + | Once these are installed, make sure you can enable them and that you have no errors in your configurations: |
- | | + | |
- | sudo mv / | + | |
- | sudo mv / | + | |
- | sudo rm -r nextcloudsudo -u www-data php occ db:convert-filecache-bigint | + | |
- | sudo -u www-data php occ db: | + | |
- | sudo rm nextcloud-15.0.8.zip | + | sudo a2enmod ssl |
- | sudo chown www-data: | + | sudo a2enmod headers |
- | sudo mkdir / | + | sudo a2enmod proxy_fcgi |
- | sudo chown www-data: | + | sudo a2enmod setenvif |
- | sudo mkdir assets | + | sudo a2enconf php8.2-fpm |
- | sudo mkdir data | + | sudo a2enconf php8.2-cgi |
+ | sudo sudo apache2ctl configtest | ||
+ | |||
+ | There may be some others for your use case. | ||
+ | |||
+ | cd / | ||
+ | sudo wget https:// | ||
+ | sudo unzip latest.zip | ||
+ | sudo rm latest.zip | ||
+ | sudo rm public_html | ||
+ | sudo mv nextcloud public_html | ||
+ | cd public_html | ||
+ | sudo chown www-data: | ||
+ | sudo mkdir /var/www/ | ||
+ | sudo chown www-data: | ||
+ | sudo chmod 750 -R / | ||
+ | sudo mkdir -p / | ||
sudo chmod 0640 *.php *.txt *.html AUTHORS COPYING | sudo chmod 0640 *.php *.txt *.html AUTHORS COPYING | ||
- | sudo chmod 0750 {3rdparty, | + | sudo chmod 0750 {3rdparty, |
- | sudo chown root: | + | sudo chown root: |
- | sudo chown www-data: | + | sudo chown www-data: |
- | sudo chmod 0755 /var/www/html/occ | + | sudo chmod 0755 /var/www/nextcloud.jonathanhaack.com/ |
- | sudo chmod 0644 /var/www/html/ | + | sudo chmod 0644 /var/www/nextcloud.jonathanhaack.com/ |
- | sudo chown root: | + | sudo chown root: |
sudo systemctl restart mysql | sudo systemctl restart mysql | ||
sudo systemctl restart mysqld | sudo systemctl restart mysqld | ||
sudo systemctl restart apache2 | sudo systemctl restart apache2 | ||
- | sudo systemctl restart php7.0-fpm.service | + | sudo systemctl restart php7.3-fpm.service |
- | Prepate | + | Prepare |
- | sudo nano mariadb.conf.d/ | + | sudo nano /etc/mysql/mariadb.conf.d/ |
| | ||
Once inside that file, copy these configurations under the [mysqld] block and restart the service: | Once inside that file, copy these configurations under the [mysqld] block and restart the service: | ||
Line 58: | Line 69: | ||
sudo mysql -u root -p | sudo mysql -u root -p | ||
- | Enter your password for sudo and then for MySQL. | + | Enter your password for sudo and then for MySQL. |
- | | + | CREATE DATABASE nextcloud; |
- | | + | CREATE USER nextclouduser@localhost IDENTIFIED BY ' |
- | | + | GRANT ALL PRIVILEGES ON nextcloud.* to nextclouduser@localhost IDENTIFIED BY ' |
- | | + | FLUSH PRIVILEGES; |
- | | + | EXIT; |
- | Okay, you can now proceed to the website test.com and make finish the remaining set up using the Nextcloud website that is now active. | + | Let's first restart the web server, php, and mysql: |
| | ||
sudo systemctl restart mysql | sudo systemctl restart mysql | ||
sudo systemctl restart apache2 | sudo systemctl restart apache2 | ||
+ | sudo systemctl restart php7.3-fpm.service | ||
- | Ok, now that those services are restarted, you should be able to access your website. | + | Now, visit test.com in your browser |
- | * create new user name: < | + | * create new user name: adminname |
- | * create new user pass: <this is public facing and is the admin user, so make it a bit beefy> | + | * create new user pass: password |
- | * specify data folder: /var/www/test.com/ | + | * specify data folder: / |
- | * database user name: nextcloud | + | * database user name: nextclouduser |
* database name: nextcloud | * database name: nextcloud | ||
* database location: localhost | * database location: localhost | ||
- | Once you are done, you can now use Nextcloud at will. | + | The first thing to do is to navigate to Settings, Overview. |
+ | |||
+ | sudo nano /etc/php/8.2/cli/conf.d/10-opcache.ini | ||
| | ||
- | Nextcloud | + | I entered the following settings, currently recommended by Nextcloud. You should always check/ |
| | ||
- | sudo find /var/www/codetalkers.group/public_html/ -type f -print0 | xargs -0 chmod 0640 | + | |
- | sudo find /var/www/codetalkers.group/public_html/ -type d -print0 | xargs -0 chmod 0750 | + | opcache.enable_cli=1 |
+ | opcache.interned_strings_buffer=16 | ||
+ | opcache.max_accelerated_files=10000 | ||
+ | opcache.memory_consumption=128 | ||
+ | opcache.save_comments=1 | ||
+ | opcache.revalidate_freq=1 | ||
+ | |||
+ | To adjust php memory limit and post size, navigate to these locations and change the following parameters: | ||
+ | |||
+ | | ||
+ | sudo nano /etc/php/7.3/cgi/php.ini | ||
+ | sudo nano / | ||
+ | sudo nano / | ||
+ | upload_max_filesize=2G | ||
+ | post_max_size=2G | ||
+ | memory_limit=512M | ||
| | ||
- | But that gives me errors, so I developed this (also two lines), from within ServerRoot... | + | Next, adjust your max age header in your ssl vhost: |
+ | |||
+ | sudo nano / | ||
+ | <Header always set Strict-Transport-Security " | ||
+ | |||
+ | Enable overrides | ||
+ | |||
+ | sudo nano / | ||
+ | < | ||
| | ||
+ | If you do not want to allow overrides, then manually set the redirects for cal/card dav as follows: | ||
+ | |||
+ | sudo nano / | ||
+ | < | ||
+ | < | ||
+ | |||
+ | Lastly, when upgraing you might get a big integers db error. If so, run this in web root: | ||
+ | |||
+ | sudo -u www-data php occ db: | ||
+ | |||
+ | To configure cron to refresh php every 5 minutes: | ||
+ | |||
+ | sudo crontab -e -u www-data | ||
+ | < | ||
+ | < | ||
+ | | ||
+ | To fine tune php: | ||
+ | |||
+ | sudo nano / | ||
+ | https:// | ||
+ | | ||
+ | For a 4GB server: | ||
+ | | ||
+ | pm = dynamic | ||
+ | pm.max_children = 120 | ||
+ | pm.start_servers = 12 | ||
+ | pm.min_spare_servers = 6 | ||
+ | pm.max_spare_servers = 18 | ||
+ | | ||
+ | For a 1GB server, use defaults: | ||
+ | |||
+ | pm = dynamic | ||
+ | pm.max_children = 5 | ||
+ | pm.start_servers = 2 | ||
+ | pm.min_spare_servers = 1 | ||
+ | pm.max_spare_servers = 3 | ||
+ | |||
+ | To reset permissions after an update: | ||
cd / | cd / | ||
+ | sudo chown www-data: | ||
+ | sudo chown www-data: | ||
sudo chmod 0640 *.php *.txt *.html AUTHORS COPYING | sudo chmod 0640 *.php *.txt *.html AUTHORS COPYING | ||
- | sudo chmod 0750 {3rdparty, | + | sudo chmod 0750 {3rdparty, |
- | sudo chown -R root: | + | sudo chown root: |
- | sudo chown www-data: | + | sudo chown www-data: |
sudo chmod 0755 / | sudo chmod 0755 / | ||
sudo chmod 0644 / | sudo chmod 0644 / | ||
sudo chown root: | sudo chown root: | ||
+ | sudo systemctl restart mysql | ||
+ | sudo systemctl restart mysqld | ||
+ | sudo systemctl restart apache2pm = dynamic | ||
+ | sudo systemctl restart php7.3-fpm.service | ||
- | And finally you have an instance ... [[https:// | + | Need to manually move files from an old NAS or elsewhere to Nextcloud: |
- | Update: | + | sudo -u www-data php / |
+ | sudo -u www-data | ||
+ | sudo -u www-data php occ files:scan --path=/ | ||
+ | sudo -u www-data | ||
- | | + | Okay, and for Nextcloud Talk configuration, |
+ | |||
+ | sudo apt install coturn | ||
+ | sudo nano /etc/turnserver.conf | ||
+ | openssl rand -hex 32 | ||
| | ||
- | The settings below are currently recommended by Nextcloud, but always check/verify this before copying and pasting: | + | The Nextcloud |
+ | |||
+ | listening-port=3478 | ||
+ | fingerprint | ||
+ | use-auth-secret | ||
+ | static-auth-secret=< | ||
+ | realm=your.domain.org | ||
+ | total-quota=100 | ||
+ | bps-capacity=0 | ||
+ | stale-nonce | ||
+ | no-multicast-peers | ||
+ | systemctl restart coturn | ||
| | ||
- | opcache.enable=1 | + | After doing this, go to Nextcloud / Settings / Talk, and enter localhost: |
- | opcache.enable_cli=1 | + | |
- | opcache.interned_strings_buffer=8 | + | |
- | opcache.max_accelerated_files=10000 | + | |
- | opcache.memory_consumption=128 | + | |
- | opcache.save_comments=1 | + | |
- | opcache.revalidate_freq=1 | + | |
- | Adjust the memory limit for php by finding the line `memory_limit | + | sudo nano /etc/php/ |
+ | sudo nano / | ||
+ | sudo nano / | ||
+ | sudo nano / | ||
+ | max_excution_time | ||
- | sudo nano / | + | If you get the missing indexes error on an upgrade, use: |
- | Find the `memory_limit = ` line and change the value to 1G. Next, you may get a Header error for your SSL configuration. | + | sudo -u www-data php occ db:add-missing-indices |
- | sudo nano / | + | Brute force won't permit log in |
- | Add the following Header parameter with the other parameters, or anywhere before the </ | + | select database; |
- | + | | |
- | | + | |
+ | exit; | ||
+ | |||
+ | Log in normally after that. My latest command is for Stubborn files that won't delete from trashbin: | ||
- | Lastly, Nextcloud uses an .htaccess file inside the webroot, and in order for that configuration to be utilized, Overrides must be enabled: | + | |
- | + | ||
- | | + | |
| | ||
- | Scroll down to the web server root section and adjust it to read as follows: | + | Phone region issue |
- | | + | |
- | Options FollowSymLinks | + | |
- | AllowOverride All | + | |
- | Require all denied | + | |
- | | + | |
- | Also, your cal and card dav need redirects | + | New weird error about svg support |
- | sudo nano / | + | sudo apt install libmagickcore-6.q16-6-extra |
| | ||
- | Place the following redirects after < | + | Upgrade & Update: |
- | | + | |
- | | + | |
+ | cd /var/www/html/ | ||
+ | sudo -u www-data php updater.phar | ||
| | ||
- | Okay, that is the majority of fundamental configuration details required to have it running smoothly. Here are a few more optional configurations. The first of those is enabling memcache: | + | Use redis for everything except local memcache which uses apcu. Also, in this configuration, redis is on the same machine as nextcloud. First, install needed packages. Adjust versions to your needs. |
- | sudo apt install | + | sudo apt install |
+ | sudo apt install | ||
+ | sudo apt-get install php-{xml, | ||
+ | sudo apt-get install php8.3-{xml, | ||
- | After installing the package, make sure to adjust your config.php as follows: | + | Then, right underneath |
- | + | ||
- | sudo nano / | + | |
- | + | ||
- | Add the following | + | |
' | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ], | ||
- | Lastly, I ran into an error that stated that the database I created above was not set to handle "13 big integers" | ||
- | sudo systemctl stop apache2 | + | Configure apcu in php mods: |
- | sudo systemctl stop php7.0-fpm | + | |
- | Now that your service is sudo -u www-data | + | |
- | stopped, you can safely run Netcloud' | + | < |
- | sudo -u www-data php occ db: | + | To get Social working, these rewrite rules are needed. However, these need to actually point to a .well-known directory which is configured properly. If, however, override All did not make that or your instance was upgraded and does not have it, these rewrites in .htaccess will not be enough on their own. |
- | Follow the prompts, and then run it again once it completes in order to verify that "All tables are already up to date!" | + | RewriteRule ^\.well-known/ |
+ | RewriteRule ^\.well-known/ | ||
| | ||
- | sudo systemctl restart mysql | + | Enable rotation of logs |
- | sudo systemctl restart mysqld | + | |
- | sudo systemctl restart apache2 | + | |
- | sudo systemctl restart php7.0-fpm.service | + | |
- | sudo reboot | + | |
- | Happy clouding ... remember, this is contingent on having a full LAMP stack up and knowing how to enable the appropriate mods and headers and/or custom configurations (like for SSL). Here is a quick helper if that is stumping you: | + | ' |
- | sudo a2enmod ssl | + | Delete the log contents (removes errors from admin settings GUI) |
- | | + | |
- | sudo a2enconf ssl-params | + | sudo -u www-data truncate nextcloud.log |
- | sudo a2enmod proxy_fcgi setenvif | + | |
- | sudo a2enconf php7.0-fpm | + | |
- | All the best ... | + | This will put the logs on a schedule and remove old errors in due time. When I put Nextcloud behind a reverse proxy, I had to change the following in the primary config: |
- | -- -- -- -- -- | + | sudo nano / |
+ | ' | ||
+ | array ( | ||
+ | 0 => ' | ||
+ | 1 => ' | ||
+ | ), | ||
+ | ' | ||
+ | ' | ||
+ | |||
+ | This ensures that the upstream subnet and node is trusted and that external url requests don't try to access the subnet directly. There are other notes in the proxmox tutorial since that is when I set up the reverse proxy setup. There is now a recommended maintenance window setting: | ||
+ | |||
+ | ' | ||
+ | |||
+ | Mimetype migrations | ||
- | This tutorial is a designated " | + | sudo -u www-data |
- | --- //[[netcmnd@jonathanhaack.com|oemb1905]] | + | --- //[[webmaster@haacksnetworking.org|oemb1905]] |