Introduction
Nextcloud is a self-hosted file sharing and collaboration platform. Nextcloud All-in-One (AIO) provides a convenient way to install Nextcloud along with its required components on a single Ubuntu 22.04 server. This tutorial will guide you through the process of installing Nextcloud AIO on Ubuntu 22.04.
Prerequisites
Before you begin, ensure you have:
- An Ubuntu 22.04 server or desktop system
- SSH access to the server (optional)
- Root or sudo privileges
Step 1: Install Required Packages
Update the package repository and install required packages:
sudo apt update
sudo apt install -y apache2 mariadb-server php php-mysql libapache2-mod-php redis-server php-redis php-gd php-curl php-zip php-intl php-mbstring php-xml php-ldap php-bcmath
Step 2: Install Nextcloud
Download the latest version of Nextcloud:
cd /tmp
wget https://download.nextcloud.com/server/releases/latest.tar.bz2
Extract the Nextcloud archive:
sudo tar -xvf latest.tar.bz2 -C /var/www/
Set the correct permissions:
sudo chown -R www-data:www-data /var/www/nextcloud
Step 3: Configure Apache
Create a new Apache configuration file for Nextcloud:
sudo nano /etc/apache2/sites-available/nextcloud.conf
Add the following configuration:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/nextcloud/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<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>
</VirtualHost>
Enable the Nextcloud site and rewrite module:
sudo a2ensite nextcloud.conf
sudo a2enmod rewrite
Restart Apache:
sudo systemctl restart apache2
Step 4: Configure MariaDB
Secure the MariaDB installation:
sudo mysql_secure_installation
Create a new MariaDB database and user for Nextcloud:
sudo mysql -u root -p
CREATE DATABASE nextcloud;
CREATE USER 'nextclouduser'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextclouduser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Step 5: Complete the Installation
Open a web browser and navigate to:
http://your_server_ip_or_domain/nextcloud
Follow the on-screen instructions to complete the installation using the database credentials you created earlier.
Conclusion
Congratulations! You have successfully installed Nextcloud All-in-One (AIO) on Ubuntu 22.04. You can now use Nextcloud to store, share, and collaborate on files and documents.