With a Nextcloud server, you can operate your own file-sharing server with your Ubuntu install. This can be used as your own private cloud. Nextcloud services can be accessed via app or web browser.
With a Nextcloud server, you can operate your own file-sharing server with your Ubuntu install. This can be used as your own private cloud. Once your server is set up, you can access Nextcloud via app or web browser. There is a client-side app available for Linux, Windows, and IOS devices.
For this tutorial, you will need an Ubuntu 20.04 install with a static IP address assigned.
Install software needed by Nextcloud
We will begin by installing Apache, MySQL, and PHP by entering the following commands:
sudo apt-get install apache2 mysql-server -y
sudo apt-get install php zip libapache2-mod-php php-gd php-json php-mysql php-curl php-mbstring php-intl php-imagick php-xml php-zip php-mysql php-bcmath php-gmp -y
Setting up your Nextcloud database
To finish installing MySQL, use the following command:
To create your database enter the following commands:
sudo mysql -u root -p
CREATE DATABASE insertdatabasenamehere;
CREATE USER 'insertusernamehere'@'localhost' IDENTIFIED BY 'insertPASSWORD';
GRANT ALL PRIVILEGES ON insertdatabasenamehere.* TO 'insertusernamehere'@'localhost';
In order to apply these changes enter the following commands:
Install Nextcloud on Ubuntu server
You will need to switch to the /temp directory. Enter the following command:
To download and install Nextcloud, enter the following commands:
You will need to move the Nextcloud directory into Apache’s root folder. To do so, enter the following command:
sudo mv nextcloud /var/www/html/
Next, we will need to adjust the file permissions with this command:
sudo chown -R www-data:www-data /var/www/html/nextcloud
Create your Apache configuration file, by entering this command:
sudo nano /etc/apache2/sites-available/nextcloud.conf
Paste the following code into the file:
Alias /nextcloud "/var/www/html/nextcloud/"
SetEnv HOME /var/www/html/nextcloud
SetEnv HTTP_HOME /var/www/html/nextcloud
Add Nextcloud to Apache with the following commands:
sudo a2ensite nextcloud
sudo a2enmod rewrite headers env dir mime
sudo sed -i '/^memory_limit =/s/=.*/= 512M/' /etc/php/7.4/apache2/php.ini
sudo systemctl restart apache2
To access Nextcloud, enter your IP address or domain followed by /nextcloud in your browser.
You will then be asked to create an Admin account for Nextcloud and supply your database username, password, and the name of the database.
Once your Nextcloud install is successful, you will be greeted with this screen:
The latest version includes several useful features that even go beyond just file sharing.
Create and manage user accounts
Setup shared folders and grant access to specific users or user groups
A calendar for managing appointments and receiving reminders
The chat feature is also built into the file access so users can comment on any of the files shared in Nextcloud.
Nextcloud offers client-side software support for additional features such as syncing a folder or having items on your mobile devices such as pictures set to auto-upload.
These are just a handful of the features available in the latest version of Nextcloud. You can add additional features to your server through their app store.
Nextcloud is more than just a file-sharing solution. What do you think, is this just a fun project, or does it have the potential for use in modern IT infrastructures? Feel free to share your thoughts in the comments below.