Nextcloud Installation. Part II. Installing Apache, MySQL, PHP



Nextcloud Installation. Part II. Installing Apache, MySQL, PHP

Nextcloud Installation. Part II. Installing Apache, MySQL, PHP

Update and Upgrade the Ubuntu Packages

# apt update && apt upgrade

Install Apache and MySQL Server

# apt install apache2 mariadb-server

Install PHP and other Dependencies and Restart Apache

# apt install libapache2-mod-php php-bz2 php-gd php-mysql php-curl php-mbstring php-imagick php-zip php-ctype php-curl php-dom php-json php-posix php-bcmath php-xml php-intl php-gmp zip unzip wget

Enable required Apache modules and restart Apache:

# a2enmod rewrite dir mime env headers
# systemctl restart apache2

Create MySQL Database and User for Nextcloud and Provide Permissions

# mysql

CREATE USER ‘nextcloud’@’localhost’ IDENTIFIED BY ‘passw@rd’;
CREATE DATABASE IF NOT EXISTS nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
GRANT ALL PRIVILEGES ON nextcloud.* TO ‘nextcloud’@’localhost’;
FLUSH PRIVILEGES;
quit;

Download, Extract and Install Nextcloud

Download the latest Nextcloud archive file download from this direct link: https://download.nextcloud.com/server/releases/latest.zip

# cd /var/www/
# wget https://download.nextcloud.com/server/releases/latest.zip
# unzip latest.zip

Remove the zip file

# rm -rf latest.zip

Change the ownership of the Nextcloud directory

# chown -R www-data:www-data /var/www/nextcloud/