@Stefan_Walter_Minder
Hey there,
sorry for late reply,
You can do what @yashodhan suggested if you know docker well, else you can do my way, personally I have never used docker so I achieved Nextcloud & Erpnext by following steps mentioned below.
It requires Ubuntu Server 18.04.4 Lts on a VM or your personalised hardware
note: after fresh install, do not upgrade, only use apt-get update cmd
Login via default user, & change root user password by
sudo passwd root
Then change to root user by
su root
Then change directory to root by
cd /
Then run update command by
apt-get update
After system gets updated, install erpnext support package by
apt-get install python3-minimal build-essential python3-setuptools
reboot system by,
Reboot
Then login via your default user into ubuntu
Now you can use your default user to install both Nextcloud & erpnext or you can create a new user
For using same user, you need to follow this command
sudo usermod -aG sudo user_name (replace your username with user_name )
if you want to create a new user you can use
Sudo adduser username (replace your username with username)
sudo usermod -aG sudo user_name (replace your username with user_name )
Now you need to switch to you desired user for which you will install erpnext & nextcloud, please follow
Su username & enter password
First we will install erpnext (I have installed production version with easy install script)
use these commands
wget https://raw.githubusercontent.com/frappe/bench/master/playbooks/install.py
Then install erpnext by following this command
sudo python3 install.py --production --user username (replace with your username)
You will be asked asked to enter mysql root password & erpnext admin password - please enter & make note of the same.
After successful installation of the Erpnext, user Admin password to login & activate erpnext site
You can access your defaul erpnext site (site1.local)
you need to setup dns multitenant to access both on domain. you need to change directory to frappe-bench folder for this to work
bench config dns_multitenant on (this will turn on dns based setup on site)
To make a new site under DNS based multitenancy, perform the following steps & install erpnext app on the same.
bench new-site erp.your-domain.com (this will create frappe bench site without erpnext app)
bench --site erp.your-domain.com install-app erpnext (this will install erpnext)
bench setup nginx (this will reconfigure nginx file to allow only dns based sites and disable port based sites.)
sudo service nginx reload (this will reload nginx)
you also need to delete the default site which was created with automated setup of erpnext, use these command
bench drop-site site1.local --no-backup
Now we will install nextcloud alongside erpnext.
For Nextcloud to work, it requires LEMP Stack (Nginx, MariaDB, PHP7.2) on Ubuntu 18.04 LTS
Nginx & Mariadb were already installed with erpnext bundle, so we will only install Php 7.2 & its modules for it to work.
Use this command to install
sudo apt install php7.2 php7.2-fpm php7.2-mysql php-common php7.2-cli php7.2-common php7.2-json php7.2-opcache php7.2-readline php7.2-mbstring php7.2-xml php7.2-gd php7.2-curl -y
sudo systemctl start php7.2-fpm ( to start php)
Enable auto-start at boot time.
sudo systemctl enable php7.2-fpm
Also we need to configure php to custom settings, you can do so by,
sudo nano /etc/php/7.2/fpm/php.ini
Make changes to the following lines:
file_uploads = On
allow_url_fopen = On
memory_limit = 512M
upload_max_filesize = 100M
display_errors = Off
cgi.fix_pathinfo = 0
date.timezone = America/Chicago
Now we need to make www-data
(Nginx user) as the owner of web directory. By default itâs owned by the root user
Also create Nginx Server Block
sudo chown www-data:www-data /usr/share/nginx/html -R (to make logged in user the owner)
sudo nano /etc/nginx/conf.d/default.conf (create nginx server block)
fill the file with the below mentioned code.
server {
listen 80;
listen [::]:80;
server_name _;
root /usr/share/nginx/html/;
index index.php index.html index.htm index.nginx-debian.html;
location / {
try_files $uri $uri/ /index.php;
}
location ~ .php$ {
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
include snippets/fastcgi-php.conf;
}
A long browser cache lifetime can speed up repeat visits to your page
location ~* .(jpg|jpeg|gif|png|webp|svg|woff|woff2|ttf|css|js|ico|xml)$ {
access_log off;
log_not_found off;
expires 360d;
}
disable access to hidden files
location ~ /.ht {
access_log off;
log_not_found off;
deny all;
}
}
Save & exit Then run
sudo nginx -t
sudo systemctl reload nginx
After the above step, you will not be able to access erpnext site, else you will see Nginx welcome page,
Now we need to test our php installation,
To test PHP-FPM with Nginx Web server, we need to create a info.php
file in the document root directory.
sudo nano /usr/share/nginx/html/info.php
Paste the following PHP code into the file.
<?php phpinfo(); ?>
Save & exit. Now you can access php information via ip address of the server i.e 192.168.2.1/info.php (Change the ip with your server ip
Now we need to delete the info.php file, its not good for security. Please run this command
sudo rm /usr/share/nginx/html/info.php
Now letâs install NextCloud. by running this command
wget https://download.nextcloud.com/server/releases/nextcloud-18.0.2.zip
You can always use the above URL format to download NextCloud. If a new version comes out, simply replace 18.0.2
with the new version number.
Once downloaded, extract the archive with unzip
(if somehow the above command doesnt work, kindly download nextcloud & use filezilla or any other client to copy nextcloud.zip file to user folder, then use unzip)
sudo apt install unzip (to install unzip)
sudo unzip nextcloud-18.0.2.zip -d /usr/share/nginx/
The -d
option specifies the target directory. NextCloud web files will be extracted to /usr/share/nginx/nextcloud/
. Then we need to change the owner of this directory to www-data
so that the web server (Nginx) can write to this directory.
sudo chown www-data:www-data /usr/share/nginx/nextcloud/ -R
Create a Database and User in MariaDB
sudo mysql -u root -p
enter_your_password (enter mysql root passsword used for erpnext installation earlier)
Then create a database for Nextcloud. This tutorial name the database nextcloud. You can use whatever name you like.
create database nextcloud;
Create the database user. Again, you can use your preferred name for this user. Replace your-password
with your preferred password.
create user ânextclouduserâ@âlocalhostâ identified by âyour-passwordâ;
Grant this user all privileges on the nextcloud
database.
grant all privileges on nextcloud.* to ânextclouduserâ@âlocalhostâ identified by âyour-passwordâ;
flush privileges;
exit;
Create a Nginx Config File for Nextcloud
Create a nextcloud.conf
file in /etc/nginx/conf.d/
directory.
sudo nano /etc/nginx/conf.d/nextcloud.conf
Put the following text into the file.
server {
listen 80;
server_name nextcloud.your-domain.com;
# Add headers to serve security related headers
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
add_header X-Robots-Tag none;
add_header X-Download-Options noopen;
add_header X-Permitted-Cross-Domain-Policies none;
add_header Referrer-Policy no-referrer;
#I found this header is needed on Ubuntu, but not on Arch Linux.
add_header X-Frame-Options "SAMEORIGIN";
# Path to the root of your installation
root /usr/share/nginx/nextcloud/;
access_log /var/log/nginx/nextcloud.access;
error_log /var/log/nginx/nextcloud.error;
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
# The following 2 rules are only needed for the user_webfinger app.
# Uncomment it if you're planning to use this app.
#rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
#rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json
# last;
location = /.well-known/carddav {
return 301 $scheme://$host/remote.php/dav;
}
location = /.well-known/caldav {
return 301 $scheme://$host/remote.php/dav;
}
location ~ /.well-known/acme-challenge {
allow all;
}
# set max upload size
client_max_body_size 512M;
fastcgi_buffers 64 4K;
# Disable gzip to avoid the removal of the ETag header
gzip off;
# Uncomment if your server is build with the ngx_pagespeed module
# This module is currently not supported.
#pagespeed off;
error_page 403 /core/templates/403.php;
error_page 404 /core/templates/404.php;
location / {
rewrite ^ /index.php$uri;
}
location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ {
deny all;
}
location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) {
deny all;
}
location ~ ^/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+|core/templates/40[34])\.php(?:$|/) {
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
#Avoid sending the security headers twice
fastcgi_param modHeadersAvailable true;
fastcgi_param front_controller_active true;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
fastcgi_intercept_errors on;
fastcgi_request_buffering off;
}
location ~ ^/(?:updater|ocs-provider)(?:$|/) {
try_files $uri/ =404;
index index.php;
}
# Adding the cache control header for js and css files
# Make sure it is BELOW the PHP block
location ~* \.(?:css|js)$ {
try_files $uri /index.php$uri$is_args$args;
add_header Cache-Control "public, max-age=7200";
# Add headers to serve security related headers (It is intended to
# have those duplicated to the ones above)
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
add_header X-Robots-Tag none;
add_header X-Download-Options noopen;
add_header X-Permitted-Cross-Domain-Policies none;
add_header Referrer-Policy no-referrer;
# Optional: Don't log access to assets
access_log off;
}
location ~* .(?:svg|gif|png|html|ttf|woff|ico|jpg|jpeg)$ {
try_files $uri /index.php$uri$is_args$args;
# Optional: Donât log access to other assets
access_log off;
}
}
Save and close the file. Test Nginx configuration, then reload Nginx for the changes to take effect.
sudo nginx -t
sudo service nginx reload
Install and Enable PHP Modules
Run the following commands to install PHP modules required or recommended by NextCloud.
sudo apt install php-imagick php7.2-common php7.2-mysql php7.2-fpm php7.2-gd php7.2-json php7.2-curl php7.2-zip php7.2-xml php7.2-mbstring php7.2-bz2 php7.2-intl -y
Now you can access the Nextcloud web install wizard in your browser by entering the domain name for your Nextcloud installation.
Finish the Installation in your Web Browser to nextcloud:
To complete the installation, you need to create an admin account, enter the path of Nextcloud data folder, enter database details created earlier. You can use the default localhost as host address, or you can enter localhost:3306, as MariaDB listens on port 3306.
The data folder is where usersâ files are stored. For security, itâs best to place the data directory outside of Nextcloud web root. So instead of storing usersâ files under /usr/share/nginx/nextcloud/data/, we can change it to /usr/share/nginx/nextcloud-data. which can be created with the following command:
sudo mkdir /usr/share/nginx/nextcloud-data
Then make sure Nginx user (www-data) has write permission to the data directory.
sudo chown www-data:www-data /usr/share/nginx/nextcloud-data -R
Now access nextcloud & enter the asked details
User name : User
Password : Passwd
Data folder : /usr/share/nginx/nextcloud-data
Database user : mysql_user_name
database passwd : mysql_user_pswd
database name : nextcloud
localhost : localhost
Once entered, you can now access nextcloud web interface.
Now to access erpnext along with nextcloud, you will have to delete default nginx file, to do that run this command
sudo rm sudo rm /etc/nginx/sites-enabled/default.conf
After deleting the above mentioned file, you can access you erpnext site, if not change directory to frappe-bench and run this command.
bench setup nginx
bench restart
you will now be able to access erpnext site & nextcloud site on different sub-domain.
If you do it successfully, please dont thank me, I am not a developer or coder, just an advance user who was able to combine bits and pieces of info on the above mentioned subject to achieve the goal