How to install Nextcloud in ubuntu

Install the Apache webserver.

				
					sudo apt update && apt upgrade -y
sudo apt install -y apache2 libapache2-mod-php bzip2
         
				
			

Install the necessary PHP modules for Nextcloud installation.

				
					sudo apt install -y php-gd php-json php-mysql php-curl php-mbstring php-intl php-imagick php-xml php-zip php-sqlite3

#Enable mod_rewrite for NextCloud work properly.
sudo a2enmod rewrite

#also, you need to enable a few additional Apache modules.
sudo a2enmod headers
sudo a2enmod dir
sudo a2enmod env
sudo a2enmod mime

#Restart the Apache service.
sudo systemctl restart apache2
     
				
			

Install the MariaDB server

				
					sudo apt install -y mariadb-server mariadb-client
      
#Securing mariaDB
systemctl start mariadb
mysql_secure_installation
    
#Let us Create Database

sudo mysql -u root -p

#Create a database called nextcloud_db.
create database nextcloud_db;
   
#Create a database user nextcloud_user and nextcloud password.
create user nextcloud@localhost identified by '123Admin';

#Grant this user all privileges on the nextcloud database.
grant all privileges on nextcloud_db.* to nextcloud@localhost identified by '123Admin';  

#Flush privileges and exit.
flush privileges;
exit;
				
			

Go to Nextcloud official website to get the latest Server installer Link: https://nextcloud.com/

				
					wget https://download.nextcloud.com/server/releases/nextcloud-23.0.0.zip
     
#Once downloaded, extract the archive with unzip.
sudo apt install unzip
sudo unzip nextcloud-23.0.0.zip -d /var/www/html

#change the owner of this directory
sudo chown www-data:www-data /var/www/html/nextcloud/ -R
   
#Give access permision to the nextcloud files
sudo chmod 775 -R /var/www/html/nextcloud
				
			

open your browser using your server IP address
http://your-server-ip/nextcloud

Leave a Comment

Your email address will not be published. Required fields are marked *