Few weeks ago we showed students and new users an easy way to install OwnCloud on Ubuntu. Today’s post shows you how to install Nextcloud, a fork of OwnCloud on Ubuntu servers as well. For those who don’t know about OwnCloud or Nextcloud can read a bit out them online.
Both are open source software that provide private cloud services. Just like DropBox and similar storage services, NextCloud enables anyone to host their own cloud storage on their servers. Unlike Dropbox and other services, OwnCloud and NextCloud are both free to install and use.
This brief tutorial is going to show you how to easily install NextCloud on Ubuntu servers if you don’t know how.
Like Owncloud, Nextcloud uses the LAMP stack to function. You must install MySQL or MariaDB, PHP and a web server like Apache2 or Nginx. To get started with installing Nextcloud, follow the steps below:
Step 1: Install the LAMP stack
For Nextcloud to work, it must be installed on a server with LAMP on it. To install LAMP, read the post below:
Nextcloud requires other modules that may not be installed using the guide above.. to make sure all other required modules are installed, run the commands below:
sudo apt-get install libapache2-mod-php7.0 php7.0-gd php7.0-json php7.0-mysql php7.0-curl php7.0-mbstring php7.0-intl php7.0-mcrypt php-imagick php7.0-xml php7.0-zip
Step 2: Download Nextcloud
After installing LAMP, go and download Nextcloud’s package. At the time of this writing, the current version was at 11.0.1. You may have to change the version number accordingly. Run the commands below to download Nextcloud.
cd /tmp/ && wget https://download.nextcloud.com/server/releases/nextcloud-11.0.1.zip
After downloading, run the commands below to extract Nextcloud and move it to Apache2 default root directory.
unzip nextcloud-11.0.1.zip sudo cp -r nextcloud /var/www/html/
Don’t forget to remove Apache2 default html file from the root directory. This can cause confusion for new users
sudo rm /var/www/html/index.html
Change the directory permission to allow Nextcloud to function properly
sudo chown -R www-data:www-data /var/www/html/nextcloud
Step 3: Configure Apache2
Now that Nextcloud is downloaded and moved to Apache2 default document root, go and add these configurations to Apache2′ default site configuration file. Run the commands below to open the file.
sudo nano /etc/apache2/sites-available/default or sudo nano /etc/apache2/sites-available/000-default.conf
Then add the highlighted lines in it and save the file.
<VirtualHost *:80> ServerAdmin [email protected] DocumentRoot /var/www/html/nextcloud Alias /nextcloud "/var/www/nextcloud/" <Directory /var/www/nextcloud/> Options +FollowSymlinks AllowOverride All <IfModule mod_dav.c> Dav off </IfModule> SetEnv HOME /var/www/nextcloud SetEnv HTTP_HOME /var/www/nextcloud </Directory>
Next, enable these Apache2 modules
sudo a2enmod headers sudo a2enmod rewrite sudo a2enmod env sudo a2enmod dir sudo a2enmod mime
Step 4 Create Nextcloud Database / User
Finally, create Nextcloud database and database user. At this point, you should be able to run Nextcloud without customizing the database. Nextcloud will automatically create a database for you. Some folks just like to create and define their own database.
To create it, follow the guide below:
Run the commands below to logon to the database server.
sudo mysql -u root -p
Then run the commands below to create a new database called nextloud
CREATE DATABASE nextcloud;
Next, run the commands below to create a database user for owncloud called nextclouduser
CREATE USER nextclouduser;
Next, grant all privileges to the database user by running the commands below
GRANT ALL ON nextcloud.* TO 'nextclouduser'@'localhost' IDENTIFIED BY 'new_password_here';
Flush the permission and exit
FLUSH PRIVILEGES; exit
Step 5: Restart Apache2 and connect
Finally, restart Apache2 webserver and connect. To do that, run the commands below:
sudo systemctl restart apache2.service
Next, open your web browser and browse to the server hostname or IP address followed by nextcloud. Example
You should see Nextcloud setup page like the one below. Fill in the database information from above, create the site admin account and finish setup.
Login and being using Nextcloud.