SDB:Nextcloud
Tested on openSUSE
Recommended articles
Related articles
Situation
Today, computer work is not limited to a single machine. People have the urgent need to share their data over various computers, ie. desktop computers, laptops, mobile phones and such. For that a so called cloud-solution is very helpful.
Many people use tools or sites like Dropbox, OneDrive, Google Drive, Facebook, twitter etcetera. These solutions however are not good for your privacy and you lose control over your own data.
openSUSE believes it is important to protect your privacy and security and the solution for that is Free software. Something which protects both your content and is trust-worthy (source is available and can be modified).
Nextcloud is the next generation Enterprise File Sync & Share that was started by ownCloud inventor Frank Karlitschek to empower users to take back control over their data and communication. It runs on your computer, in your home network or on your web space with minimal requirements. First and foremost it allows you to store files on it and access it from everywhere you have access to the web. It is compatible with most platforms (Win/Mac/Linux/most mobile phones) without requiring you to install anything.
But there are more features: Nextcloud provides you with a media player, calendaring and contact management and with a desktop client you can automate your file backups.
If you want to test Nextcloud, you can check the demo instance at Nextcloud Demo Page
Nextcloud Server Setup
There are several options to easily set up and integrate Nextcloud with openSUSE distributions. The following is using the packages available and manually setting up the components to properly work together.
Install the Nextcloud package
The easiest option is to install Nextcloud package from OBS repositories. There are packages available for openSUSE Leap 15.0, 15.1 and Tumbleweed. You should be an administrator, so you can install Nextloud on your server. This will install a basic Nextcloud installation using mariaDB. It is highly recommended you configure mariaDB for use with Nextcloud over SQLite. SQLite will work but it will not work efficiently.
Set up and configure LAMP Stack
Ensure that the LAMP Stack is properly installed and configured. Follow the instructions on that page before proceeding.
Configure MariaDB for Nextcloud
Nextcloud will need to have a MariaDB user. Log into MariaDB
mysql -u root -p
Enter your MariaDB password
Create the Nextcloud database. Enter the line exactly as displayed, including the semicolon.
create database nextcloud;
Create the Nextcloud user with a password of your choice
create user nextclouduser@localhost identified by 'some-password-here';
Grant the needed privileges of nextclouduser to the database nextcloud with the password of your choice.
grant all privileges on nextcloud.* to nextclouduser@localhost identified by 'some-password-here';
Exit the database configuration application.
exit;
Install Nextcloud
zypper install nextcloud
Initiate Nextcloud
- Navigate to the Nextcloud web portal
- Open http://localhost/nextcloud to install your instance.
- If an "Error" page is displayed followed by a list of missing PHP modules:
- Ensure that the LAMP Stack is properly installed and configured
- Check if that module is installed:
php -m | grep -i <module_name>
- If the "Error" page persists you might need to reboot your server:
shutdown -r now
- Create an admin account with a username an password of your choice
- Select the Storage & database drop down
- The data folder is set to the default path.
- Below Configure Database, Select MySQL/MariaDB
- Enter the MariaDB user for Nextcloud
- Database User - nextclouduser
- Database User Password (for nextclouduser)
- Database name - nextcloud
- Hostname (such as localhost)
Get Started With Nextcloud
That's it. You have Nextcloud set up for a local or home network use. You will be able to use Nextcloud unencrypted.
Install from Source
First of all, let's install the required and recommended modules for a typical Nextcloud installation, using Apache and MariaDB.
zypper in apache2 mariadb apache2-mod_php7 php7-exif php7-gd php7-json php7-fpm php7-mysql php7-curl php7-intl php7-mcrypt php7-zip php7-mbstring php7-zlib php7-openssl php7-fileinfo php7-pcntl php7-posix
Create Database (optional since it'll create everything automatically)
Next step, create a database. First of all start the service.
systemctl start mysql.service systemctl enable mysql.service
The root password is empty by default. That means that you can press enter and you can use your root user. That's not safe at all. So you can set a password using the command:
mysqladmin -u root password newpass
Where newpass is the password you want.
Now you set the root password, create the database.
mysql -u root -p
you'll be asked for your root password
CREATE DATABASE nextcloudb; GRANT ALL ON nextcloudb.* TO ncuser@localhost IDENTIFIED BY 'dbpass';
Database user: ncuser Database name: nextcloudb Database user password: dbpass
You can change the above information accordingly.
PHP changes
Now you should edit the php.ini file.
nano /etc/php7/apache2/php.ini
change the values
post_max_size = 50G upload_max_filesize = 25G max_file_uploads = 200 max_input_time = 3600 max_execution_time = 3600 session.gc_maxlifetime = 3600 memory_limit = 512M
Apache Configuration
You should enable some modules. Some might be already enabled.
a2enmod php7 a2enmod rewrite a2enmod headers a2enmod env a2enmod dir a2enmod mime
Now start the apache service.
systemctl start apache2.service systemctl enable apache2.service
Install Nextcloud
Before the installation, create the data folder and give the right permissions (preferably outside the server directory for security reasons). I created a directory in the /mnt directory. You can mount a USB disk, add it to fstab and save your data there. The commands are:
mkdir /mnt/nextcloud_data chmod -R 0770 /mnt/nextcloud_data chown wwwrun /mnt/nextcloud_data
Now download Nextcloud (find the latest version at install web page). Then unzip and move the folder to the server directory.
wget https://download.nextcloud.com/server/releases/nextcloud-12.0.4.zip unzip nextcloud-12.0.4.zip cp -r nextcloud /srv/www/htdocs chown -R wwwrun /srv/www/htdocs/nextcloud/
Make sure that everything is OK and then delete the folder nextcloud and nextcloud-12.0.4.zip from the root (user) directory.
Now open your browser to the server IP/nextcloud
Set your administrator username and password.
Your data directory is: /mnt/nextcloud_data
Regarding database, use the following.
Database user: ncuser
Database name: nextcloudb
Database user password: dbpass
Wait until it ends the installation.
For more information, please refer to Nextcloud documentation page.
Nextcloud Client Setup
Nextcloud has clients for all operating systems, distributions and mobile-tablets. You can find everything at installation page.
Desktop Environment Integration
GNOME
1. Insert your server address, username and password at online accounts (usermenu).
2. Open Nautilus and connect to server by clicking on the bookmark on the left panel.
Alternatively, you can install Nautilus extension.
zypper in nautilus-extension-nextcloud nextcloud-client
KDE Plasma
A global accounts setting is coming in Plasma 5. In older versions of the KDE Plasma, you can access your files via WebDAV. For that, find the WebDAV link in the Nextloud Files app in the web interface by clicking the gear in the bottom-left:
You can then enter this address in the address bar in Dolphin (shortcut is CTRL-L, just like in web browsers. Clicking after the current location also gets you a text input field). Replace https with webdav and you can get to your files!
NOTE: KMail has 'external cloud storage' support, which includes WebDAV. Unfortunately, this does not work very well with Nextloud as it doesn't generate links which can be shared: the links will need your user credentials.
Alternatively, you can install Dolphin extension.
zypper in nextcloud-desktop-dolphin nextcloud-client
Other desktops
If you have MATE
zypper in caja-extension-nextcloud nextcloud-client
If you have Cinnamon
zypper in nemo-extension-nextcloud nextcloud-client
Install Android App
You can install Nextcloud app from play store for free. Nextcloud works with DAVdroid. You can download it for free from F-Droid.
Install Apple App
You can install the application from iTunes.
Applications
Nextcloud ships with some basic applications installed. Nextcloud is community product, so there are many users who created some awesome applications for Nextloud. You can check the Application site (like appstore), and download the application matched with your Nextcloud version. Installation is pretty simple. Decompress the file and upload it in the apps folder. Finally, login and enable the application you just uploaded.