Installation
Update the repositories, install Apache, MySQL and Unzip
#Update the repositories
sudo apt update
#Install apache2
sudo apt install apache2
#Install mysql-server
sudo apt install mysql-server
#Install unzip (will be needed later)
sudo apt install unzip
Secure MySQL database
#Start the mysql-service
sudo service mysql start
#Secure the mysql-server repositories
sudo mysql_secure_installation
VALIDATE PASSWORD COMPONENT: n
New root passwort: <YOUR MYSQL PASSWORD>
Re-enter new password: <YOUR MYSQL PASSWORD>
Remove anonymous user: y
Disallow root login remotely: y
Remove test database and access to it: y
Reload privileges tables now: y
Prepare MySQL database for Nextcloud
#Accessing the mysql-shell as root
sudo mysql -u root -p
<YOUR MYSQL PASSWORD>
#If you enter the mysql-shell as root, execute the following sql-commands
mysql> create database owncloud;
mysql> create user 'owncloud'@'localhost' identified by 'PASSWORD';
mysql> grant all privileges on owncloud.* to 'owncloud'@'localhost';
mysql> flush privileges;
mysql> quit
Install PHP for Nextcloud
#For nextcloud to work, install the latest version of PHP and a few PHP libraries
sudo apt install php7.4
sudo apt install php7.4-gd php7.4-mysql php7.4-curl php7.4-mbstring
sudo apt install php7.4-intl php7.4-gmp php7.4-bcmath php7.4-xml
sudo apt install libapache2-mod-php7.4 php7.4-zip php-imagick php-apcu
Download the latest Version of Owncloud (on the following website)
Go to https://owncloud.com/
Click on "Get started"
Click on "See install options"
Right-click on "Download.ZIP"
Click on "Copy link address"
#Download the latest version of Nextcloud directly on your server
wget https://download.owncloud.org/community/owncloud-complete-20210326.zip
#Unzip the nextcloud-zip-file into the www directory of Apache
sudo unzip owncloud-complete-20210326.zip -d /var/www
#Switch to the directory of Apache
cd /var/www
#Change ownership of the nextcloud-folder to Apache (which is the "www-data" user)
sudo chown -R www-data:www-data owncloud/
Configure Apache for Nextcloud
#Enable a few Apache modifications for Nextcloud
sudo a2enmod headers env dir mime rewrite
#Restart apache2
sudo service apache2 restart
#Switch to the directory of the default Apache configuration
cd /etc/apache2/sites-available
#Open the 000-default.conf-file with nano to edit it
sudo nano 000-default.conf
#File: /etc/apache2/sites-available/000-default.conf
<VirtualHost *:80>
DocumentRoot /var/www/owncloud
ServerName 10.100.1.179
<Directory /var/www/owncloud/>
Require all granted
AllowOverride All
Options FollowSymLinks MultiViews
<IfModule mod_dav.c>
Dav off
</IfModule>
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
#Restart apache2 again
sudo service apache2 restart
#Enter the following command to show the local ip address of the server
hostname -I | awk '{print $1}'
#Öffentliche IPv4-Adresse des Routers anzeigen
wget -4 -O - -q icanhazip.com
Nextcloud configuration
#Switch the directory to the config.php file
cd /var/www/owncloud/config
#If there is no file create a new file called: config.php with the following command
sudo nano config.php
#Edit the content of the config.php file
<?php
$CONFIG = array (
'trusted_domains' =>
array (
0 => '10.100.1.179', #ip address of your server and/or domainname
),
);
#Change owner of the config.php file
sudo chown www-data:root config.php
#Change the authorization of the config.php file
sudo chmod 777 config.php
Last updated