You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
These are the steps and commands i used to install Nextcloud on DreamCompute, a cloud-vps hosting of DreamHost, which i recommend. At least for personal use is enough to use a 1Gb RAM VPS. I also share how to enable and install other interesting complements, like for example OnlyOffice server (community edition, now limited to 20 users, so enough for personal use).
Also include how to install a Let's Encrypt Certificate. So, i think that it give us a really functional and complete NC-Office server. I avoided to use snap and docker whenever it was possible. With manual installations you've better control. It's my personal opinion.
Please, be free to add your suggestions/fixes if you detect something wrong. Until to arrive to this guide, i had to try to install NC at least 3 times. For example, the first one i tried with a 512Mb RAM VPS and it didn't run, generating all kind of odd errors.
Another question i realized during this process is that every X months we probably need to UPDATE ANY INSTALLATION GUIDE, because it probably there are any new version of Ubuntu, NC, Apache, Let's Encrypt-certbot, etc... So you doesn't must desperate if you find problems applying this guide. Find the error and share here with others your solution.
Note: i use Ubuntu (Gnu/Linux) on my local machine and in the VPS. But you probably can follow the guide with minor changes with other operative systems.
to check the last executions of CRON, run this on SHELL:
grep CRON /var/log/syslog
Settings > Sharing
check Enforce password protection around
uncheck all on "Federated Cloud Sharing" (if you do not use it)
on Share by email uncheck Send password by email
and check Enforce password protection
Settings > Security > Password policy
Set "Minimal length" to 4 (to be able to share files protected with an only 4 digits, which is more friendly to third people don't using our Nextcloud)
uncheck "Forbid common passwords" (for the same question above, to let us to use simple passwords like a 4 numeric digits, instead to force to us to use symbols, upper/lower case letters, bla bla bla, when sharing files)
Installing OnlyOffice on a second VPS DreamCompute
By now, to test purposes, i decided to create a second VPS on DreamCompute, also with 1Gb of RAM and install there OnlyOffice to online edition of text/spreadsheets documents from Nextcloud.
I supose that it could run on the same VPS where i installed NC, but i preferred to test it first on a separate instance. In this way, i can use also this office instance to be used by other projects of mine, like some instances of social networking HumHub project.
key pair for SSH: take it from ~/.ssh/id_rsa.pub and name it mymachine-name or you can use a previous one already imported, if you created other instances before
On domain name panel
Add a new DNS record for the subdomain that we want to use to access the OnlyOffice server, for example "onlyoffice.mydomain.com":
A | nextcloud | 107.XXX.YYY.ZZZ
Note: _i recommend to use literally "onlyoffice" word, because this suite use somtimes this name as a default name for a lot of questions (database name, i think, etc.), so its more prudent to use "onlyoffice" around. Yeah, i should preferred to use "office" instead.
Install postgresql, nodejs, redis & OnlyOffice
Connect to the new instance with:
ssh ubuntu@107.XXX.YYY.ZZZ
Install Postgresql database and create db & user for OO:
sudo su
apt update
apt install postgresql
service postgresql status
sudo -u postgres psql -c "CREATE DATABASE onlyoffice;"
sudo -u postgres psql -c "CREATE USER onlyoffice WITH password '********';"
sudo -u postgres psql -c "GRANT ALL privileges ON DATABASE onlyoffice TO onlyoffice;"
Login to Nextcloud through browser panel as administrador and go to Settings > ONLYOFFICE and populate the box Document Editing Service address with the https address of the subdomain where you installed OnlyOffice, something like this:
https://onlyoffice.mydomain.com
Also you sgould take a view to the available options in the same settings page ;-)
It's not so easy as run certbot renew, so i share here a detailed list of steps to make the renew. We need to have installed tmux to be able to split the terminal on 2 panes on the server side (not on client side like with terminator, hehehe).
We identify as root user:
sudo su -
We run tmux:
tmux
then create a second horizontal pane using this keyboard shortcut:
CTRL+b "
Other shortcuts for tmuxhere. We will move between panes using the shortcut CTRL+b (vertical arrow).
Call the certbot script (you should have installed it since you installed the first certificate):
It will detect that you have already installed a certificate and then will proceed with *renew. When it show you a long string hash to be accessible from an URL then change to the other tmux pane (CTRL+b arrow).
key pair for SSH: take it from ~/.ssh/id_rsa.pub from your local machine and name it mymachine-name or you can use a previous one already imported, if you created other VPS before
On domain name panel
Go to the panel where you has hosted your domain and add a new DNS record for the subdomain that we want to use to access the Nextcloud server, for example nextcloud.mydomain.com, because we will access to Nextcloud throgh a subdomain:
A | nextcloud | 64.XXX.YYY.ZZZ
Is convenient to do this now, before to continue with the installation, because in this way we give more time to the DNS propagation and it probably the subdomain will be active when we finished all this installation guide. Indeed, we will need it to install de Let's Encrypt certificate.
First SSH to create MariaDB & Apache
Connect from terminal to the new VPS instance with user ubuntu:
ssh ubuntu@64.XXX.YYY.ZZZ
Install MariaDB:
sudo su -
apt update
apt install mariadb-server mariadb-client
mysql -u root
> CREATE DATABASE nextcloud CHARACTER SET = 'utf8mb4' COLLATE = 'utf8mb4_general_ci';
> GRANT ALL ON nextcloud.* TO 'nc'@'localhost' IDENTIFIED BY '********';
> select user from mysql.db where db='nextcloud';
> flush privileges;
> quit;
service mysql restart
Alternative manual install of Let's Encrypt certificate
These are the steps i really followed to install the certificate, so i know that they works (2019-July), but i readed that the above process (using python-certbot-apache) is fully functional and better, but i have not tested yet.
ssh ubuntu@nextcloud.bimex.tech
We will need to have tmux installed to work with more than one terminal at the same time. Install it with:
apt install tmux
Then start it with 2 windows:
tmux
CTRL+b "
To get a Let's Encrypt certificate:
sudo su -
cd /opt
git clone git://github.com/certbot/certbot
/opt/certbot/certbot-auto --manual -d "nextcloud.mydomain.com" --server https://acme-v02.api.letsencrypt.org/directory certonly
But if you need to install the certificate in "multi-subdomain" style then alternative use this other command:
1) 'y' (continue w installation)
2) [email address] (one you have access to) -> proyectos@imasdeweb.com
3) 'A' (agree terms of service)
4) 'y'/'n' (choose to share your email with EFF)
5) 'y' (agree your IP will be logged)
6) when appears "Press Enter to Continue"...
*** DON'T PRESS ENTER YET !!! ***
Go to the other tmux window with:
CTRL+b (up arrow)
Create a file with the content showed by the wizzard in the las output:
And press ENTER. Wait for a couple of seconds and you must see a confirmation text like this:
IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/nextcloud.mydomain.com/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/nextcloud.mydomain.com/privkey.pem
Your cert will expire on 2019-09-10. To obtain a new or tweaked
version of this certificate in the future, simply run certbot-auto
again. To non-interactively renew *all* of your certificates, run
"certbot-auto renew"
- If you like Certbot, please consider supporting our work by:
Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
Donating to EFF: https://eff.org/donate-le
You can close tmux closing each one of the windows sessions:
<Directory /var/www/html/>
Options +FollowSymlinks
AllowOverride All
<IfModule mod_dav.c>
Dav off
</IfModule>
SetEnv HOME /var/www/html
SetEnv HTTP_HOME /var/www/html
</Directory>
<IfModule mod_headers.c>
Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains; preload"
</IfModule>
Activate the SSL virtualhost:
a2ensite default-ssl
And then exit saving with CTRL+X, and reload apache:
sudo service apache2 reload
Voilà!!! We have the Apache server installed with the subdomain nextcloud. correctly installed and we're ready to download the last nextcloud release and install it.
Download NC release and install from browser
Download and unzip:
sudo su -
cd /var/www/html/
rm -f *.*
wget https://download.nextcloud.com/server/releases/nextcloud-16.0.1.zip
unzip nextcloud-16.0.1.zip
cp -r nextcloud/. .
rm -rf next*
Create directory for data & set permissions:
mkdir /var/www/html/data
chmod -R 777 data
chown -R www-data:www-data /var/www/html
Visit Nextcloud on web browser, but *** DON'T POPULATE THE FORM ***
https://nextcloud.mydomain.com
When loaded the webform (administrator user & database connection), got to SSH terminal and edit the recently created (almost empty) config file:
sudo nano /var/www/html/config/config.php
And populate with this:
'mysql.utf8mb4' => true,
'dbtype' => 'mysql',
Once saved the config file, reload the URL on web browser and continue.
Note: regarding to utf8mb4, also make sure your backup strategy still work, because if you use mysqldump you must be sure to add the --default-character-set=utf8mb4 option.
With a little of lucky then you will get the NextCloud installed and running!
LOGS for debugging
Remember that if you have any problem during installation of NC or later installations of apps, you can check these 3 log files:
awsome :-)