How to create Server with Nextcloud


Install Debian

Download Debian
Install debian via Internet to get also the GUI



Give Root access

1. do some config, that root can login from outside
nano /etc/ssh/sshd_config
2. Add this line in the config file
PermitRootLogin yes
3. After save the config file enter this command
systemctl restart sshd


Chage normal user to Root user

1. write "Su" and enter password from root user to login with the root user
su

Connect from outside

1. You can login into Windows PC and open Command and enter follwoing. The Username@IP fo Debian Computer and enter the password.
SSH sajjad@192.168.178.165

Install Nextcloud

1. Run this command and Anydesk will be installed.
sudo apt update
sudo apt install lsb-release ca-certificates apt-transport-https software-properties-common -y
sudo add-apt-repository ppa:ondrej/php
sudo apt update && sudo apt install php8.2 sudo apt install php8.2-{bcmath,xml,fpm,mysql,zip,intl,ldap,gd,cli,bz2,curl,mbstring,pgsql,opcache,soap,cgi} sudo apt install apache2 libapache2-mod-php8.2 sudo a2enmod php8.2
$ sudo vim /etc/php/*/apache2/php.ini date.timezone = Africa/Nairobi memory_limit = 512M upload_max_filesize = 500M post_max_size = 500M max_execution_time = 300
sudo systemctl restart apache2
sudo apt -y install mariadb-server
sudo mysql_secure_installation
$ sudo mysql -uroot -p CREATE USER 'nextcloud'@'localhost' identified by 'StrongPassword'; CREATE DATABASE nextcloud; GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextcloud'@'localhost'; FLUSH PRIVILEGES; QUIT;

$ mysql -u nextcloud -p Enter password: <ENTER PASSWORD> Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 34 MariaDB [(none)]> SHOW DATABASES; MariaDB [(none)]> QUIT Bye
sudo apt install -y wget unzip wget https://download.nextcloud.com/server/releases/latest.zip
unzip latest.zip
sudo mv nextcloud/ /srv
sudo chown -R www-data:www-data /srv/nextcloud/
sudo nano /etc/apache2/conf-enabled/nextcloud.conf
<VirtualHost *:80> ServerAdmin admin@example.com DocumentRoot /srv/nextcloud/ ServerName example.com ServerAlias www.example.com ErrorLog /var/log/apache2/nextcloud-error.log CustomLog /var/log/apache2/nextcloud-access.log combined <Directory /srv/nextcloud/> Options +FollowSymlinks AllowOverride All Require all granted SetEnv HOME /srv/nextcloud SetEnv HTTP_HOME /srv/nextcloud <IfModule mod_dav.c> Dav off </IfModule> </Directory> </VirtualHost>

sudo a2enmod rewrite dir mime env headers sudo systemctl restart apache2
install Nextcloud very easy from here:
https://computingforgeeks.com/how-to-install-nextcloud-on-ubuntu-debian/?expand_article=1


Nextcloud add trusted Domain Name

1. open config file of nextcloud and add the trusted domain name
nano /srv/nextcloud/config/config.php
0 => 'localhost',
0 => 'cloud.sh-ss.de',

Nextcloud mit SSL einrichten

1. to ben ensure, that "/etc/apache2/conf-enabled/nextcloud.conf" you have define your domain.
apt-get update && apt-get upgrade
apt install snapd
apt install fuse
sudo snap install core; sudo snap refresh core
sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot
sudo certbot --apache
sudo certbot certonly --apache
sudo certbot renew --dry-run

Nextcloud with custom Logo

1. Check this video
https://www.youtube.com/watch?v=Y5kyzdBacZU


Install Anydesk

1. Run this command and Anydesk will be installed.
wget -qO - https://keys.anydesk.com/repos/DEB-GPG-KEY | apt-key add -
echo "deb http://deb.anydesk.com/ all main" > /etc/apt/sources.list.d/anydesk-stable.list
apt update
apt install anydesk

Setting in custom.conf for Anydesk

1. Run this code
sudo nano /etc/gdm3/dameon.conf
ENTER YOUR PASSWORD OF ROOT USER
WaylandEnable = true
AutomaticLoginEnable = true
AutomaticLogin = $USERNAME


Close or Start Anydesk

1. Run this code
sudo killall anydesk
sudo anydesk --service



if Anydesk make problem, then use Remote Desktop

1. Run this code
sudo apt update && apt install tasksel -y
sudo tasksel
sudo systemctl set-default graphical.target
sudo reboot
sudo apt install xrdp -y
sudo systemctl status xrdp
sudo usermod -a -G ssl-cert xrdp
sudo nano /etc/xrdp/startwm.sh
Add these commands before the commands that test & execute Xsession as shown below:
Unset DBUS_SESSION_ADDRESS
Unset XDG_RUNTIME_DIR
save the file and enter next code
sudo systemctl restart xrdp
Open Windows remote Desktop and enter the IP, then you can login


Add a new storag in Nexctcloud

1. Run this code, to check your storage
lsblk
after than run this code to open a file for editing:
nano /etc/fstab
the file is open, now enter like this, based on your storage
/dev/sda1       /media/sajjad/Samsung_500GB     ext4 defaults   0       0
Save the file and rebot, the storage should be every time auto mounted and will be available in next cloud

Add a new trusted domain in config for nextcloud


if want to change port:
= Only port 80 will be changed
sudo nano /etc/apache2/ports.conf
sudo nano /etc/apache2/sites-enabled/000-default.conf
sudo nano /etc/apache2/sites-available/000-default.conf
sudo nano /etc/apache2/conf-enabled/nextcloud.conf
sudo systemctl restart apache2
sudo service apache2 restart

= Only port 443 will be changed
sudo nano /etc/apache2/ports.conf
sudo nano /etc/apache2/sites-available/default-ssl.conf

 
 

sudo nano /srv/nextcloud/config/config.php


nextcloud geht kaputt bei 443 nur bei den 2 datein
sudo nano /etc/apache2/ports.conf
sudo nano /etc/apache2/conf-enabled/nextcloud-le-ssl.conf




if you want to see all the data over another user over GUI make a link to the data folder:

ln -s /srv/nextcloud/data /home/sajjad/Nextcloud 













Thanks for reading.

0 $type={blogger}:

Kommentar veröffentlichen