Install NextCloud Server by Manual Method On Ubuntu 16.04 | 18.04 With Apache2, MariaDB And PHP 7.3
In this tutorial, we will install and configure Latest Nextcloud 17.0.2 on an Ubuntu 18.04 LTS server. As always we will do it one by one in Simple Steps.
Nextcloud is a fork of ownCloud used for file-sharing servers to store your personal data like documents and pictures in a centralized location, like Dropbox or Google Drive. Nextcloud is fully open-source software. Your data privacy and security are much better when you use a self-hosted server instead of using Third-party cloud services like Google Drive or Dropbox. Nextcloud is GDPR and HIPAA compliant, it gives you encrypted data with the ability to audit.
Step 1: Install Apache Web Server
Nextcloud is a PHP based Web Application, So we need a web server for it. Apache is one of the most used Web Servers on the internet.
Install Apache2 Web Server by running the below command.
sudo apt update sudo apt install apache2
Verify that the Apache Web Server is installed correctly by pointing your browser at
http://mydomain/ and replace the mydomain with your current FQDN. You should see output like the below image.
Step 2: Install PHP7.3 and it’s Additional Modules
PHP is one of the most used programming languages for creating Web Apps. The Current Stable release of PHP is 7.4.1 but PHP version 7.3 is recommended for better compatibility and stability.
For installing PHP 7.3 we have to add ppa:ondrej/php repository to our server by running the below command. Because the latest versions of PHP are not available in Ubuntu’s default repository.
sudo add-apt-repository ppa:ondrej/php sudo apt-get update
So, now we can install PHP 7.3 and its additional modules by running the below command
sudo apt-get install php7.3 libapache2-mod-php7.3 php7.3-gd php7.3-json php7.3-mysql php7.3-curl php7.3-mbstring php7.3-intl php-imagick php7.3-xml php7.3-zip sudo service apache2 restart
After that, Verify that PHP is installed successfully by running the below command.
[email protected]:~# php -v PHP 7.3.13-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Dec 18 2019 14:48:49) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.3.13, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.3.13-1+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
After that, we create a PHP file for verifying that apache can process PHP files successfully. You can create the test file by simply running the below command.
echo "<?php phpinfo( ); ?>" > /var/www/html/phpinfo.php
Now point your browser at the following URL
http://mydomain/phpinfo.php. You should Output like the below image.
Now we have successfully installed Apache Web Server and PHP 7.3 on our server. So let’s move on to the Database part now.
Step 3: Install and Configure MariaDB Server
If you are looking for a fully open-source and reliable solution for a relational database, you should go with MariaDB Server because it’s one of the most used DB servers on the Internet.
Adding the MariaDB Latest Stable Version Repository
MariaDB may not be listed in Ubuntu 18.04 Default repositories. Therefore we have to add the MariaDB repository manually. So you can add it by running the below command.
For Ubuntu 18.04 LTS
sudo apt-get install software-properties-common sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8 sudo add-apt-repository 'deb [arch=amd64,arm64,ppc64el] http://mirror.host.ag/mariadb/repo/10.4/ubuntu bionic main' sudo apt update
For Ubuntu 16.04 LTS
sudo apt-get install software-properties-common sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8 sudo add-apt-repository 'deb [arch=amd64,arm64,i386,ppc64el] http://mirror.host.ag/mariadb/repo/10.4/ubuntu xenial main' sudo apt update
After that, we have the MariaDB packages listed in our servers repositories. For Confirm you can run the below command.
sudo apt list | grep mariadb-
As a result, you should see the output like below
[email protected]:~# apt list | grep mariadb- WARNING: apt does not have a stable CLI interface. Use with caution in scripts. libmariadb-dev/unknown 1:10.4.11+maria~bionic ppc64el libmariadb-dev-compat/unknown 1:10.4.11+maria~bionic ppc64el mariadb-backup/unknown 1:10.4.11+maria~bionic ppc64el mariadb-client/unknown,unknown,unknown 1:10.4.11+maria~bionic all mariadb-client-10.4/unknown,now 1:10.4.11+maria~bionic amd64 [installed,automatic] mariadb-client-core-10.4/unknown 1:10.4.11+maria~bionic ppc64el mariadb-common/unknown,unknown,unknown,now 1:10.4.11+maria~bionic all [installed,automatic] mariadb-server/unknown,unknown,unknown,now 1:10.4.11+maria~bionic all [installed] mariadb-server-10.4/unknown 1:10.4.11+maria~bionic ppc64el mariadb-server-core-10.4/unknown 1:10.4.11+maria~bionic ppc64el mariadb-test/unknown 1:10.4.11+maria~bionic ppc64el mariadb-test-data/unknown,unknown,unknown 1:10.4.11+maria~bionic all
So, now we have to install MariaDB Server which you can do by running the below command.
sudo apt install mariadb-server