Nextcloud is open-source software that allows you to host your own iCloud, Google drive or Dropbox, with a suite of applications. Their application suite includes a calendar, email client, instant messenger, and video chat just to name a few. If you would like to visit the Nextcloud app store to view their large library of applications click on link below:
When using Nextcloud, you can take full control of your cloud storage from installation to storage space. And using it with ShellsTM you can create your own unique cloud storage experience. In this article we will cover installation and configuration of Nextcloud with Ubuntu 20.04 using a Apache web server.
Before moving on to installation, if you would like to make Nextcloud accessible remotely please click on link below to purchase a public IP address.
Let's open up a terminal by selecting and searching for terminal up top in the search bar and clicking on the terminal icon to open a session and add PHP repository and update packages.
sudo add-apt-repository ppa:ondrej/php
sudo apt update
We also need to install apache, mysql and PHP 7.4 or earlier.
sudo apt-get install apache2 mysql-server -y
sudo apt-get install php7.4 -y
Next, let's install the dependencies needed.
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
After that, let's create a MySQL root password using the command below following the steps instructed.
Now we need to log in to MySql so we can create a database.
sudo mysql -u root -p
Creating a database for Nextcloud
We will need to create a MySql database for our Nexcloud server with the following commands below.
CREATE DATABASE nextcloud;
CREATE USER 'shells_user'@'localhost' IDENTIFIED BY 'My$hell123';
GRANT ALL PRIVILEGES ON nextcloud.* TO 'shells_user'@'localhost';
In this example we are using nextcloud (database name), shell_user (username), My$hell123 (password) for the database, however, you can use your own credentials when creating your database.
Now we can move on to Nextcloud installation using the wget command to download the zipped folder.
Let's move the Nextcloud folder to our HTML directory after we have unzipped it.
sudo mv nextcloud var/www/html
We will need to change the ownership of the Nextcloud directory so we don't run into any permission issues.
sudo chown -R www-data:www-data /var/www/html/nextcloud
Open the following file with your favorite text editor. I will be using nano
sudo nano /etc/apache2/sites-available/nextcloud.conf
We need to make sure Apache knows where the nextcloud directory is pointing to so we will be pasting the following lines of text in nextcloud.conf file and save and close:
Alias /nextcloud "/var/www/html/nextcloud/"
SetEnv HOME /var/www/html/nextcloud
SetEnv HTTP_HOME /var/www/html/nextcloud
Enable the Nextcloud site and the following Apache modules with the command below:
sudo a2ensite nextcloud
sudo a2enmod rewrite headers env dir mime
And now we need to edit php.ini file by updated the memory_limit line to 512M.
sudo nano /etc/php/7.4/apache2/php.ini
Update the memory_limit line to 512M
memory_limit = 512M
Save and close the file and restart Apache
sudo systemctl restart apache2
Now we should be able to access Nextcloud using our web browser with http://your_public_ip/nextcloud if you purchased a public IP or with http:/localhost/nextcloud to access it locally. Once you reach your website, you can create a username and password and access Nextcloud with the database info from earlier.