Nextcloud is a popular open-source cloud storage solution that allows users to store and share files, contacts, calendars, and more. Installing Nextcloud on AlmaLinux 9 is a straightforward process that can be completed in a few simple steps.
Here’s how you can install Nextcloud on your AlmaLinux 9 server:
1. Update your system: Before installing Nextcloud, it is recommended to update your AlmaLinux 9 system to ensure that you have the latest security patches and software updates. You can do this by running the following command:
sudo dnf update -y
2. Install required dependencies: Nextcloud requires a web server, PHP, MariaDB, and other dependencies to function properly. You can install these dependencies by running the following command:
sudo dnf install httpd mariadb mariadb-server php php-fpm php-mysqlnd php-mbstring php-xml php-curl php-gd php-zip php-intl php-json php-openssl php-ldap php-apcu unzip -y
3. Configure MariaDB: Next, you need to configure MariaDB by running the following commands:
sudo systemctl enable –now mariadb
sudo mysql_secure_installation
Follow the on-screen prompts to secure your MariaDB installation. You will be asked to set a root password, remove anonymous users, disallow remote root login, and remove the test database.
4. Create a database for Nextcloud: Once MariaDB is configured, you need to create a database and user for Nextcloud. You can do this by running the following commands:
sudo mysql -u root -p
CREATE DATABASE nextcloud;
CREATE USER ‘nextclouduser’@’localhost’ IDENTIFIED BY ‘password’;
GRANT ALL PRIVILEGES ON nextcloud.* TO ‘nextclouduser’@’localhost’;
FLUSH PRIVILEGES;
EXIT;
Replace ‘password’ with a strong password of your choice.
5. Download and extract Nextcloud: Next, download the latest version of Nextcloud and extract it to your web server’s document root directory. You can do this by running the following commands:
sudo wget https://download.nextcloud.com/server/releases/nextcloud-22.1.2.zip
sudo unzip nextcloud-22.1.2.zip -d /var/www/html/
sudo chown -R apache:apache /var/www/html/nextcloud/
6. Configure Apache: Next, you need to configure Apache to serve Nextcloud. You can do this by creating a new virtual host configuration file for Nextcloud. Create a new file named ‘nextcloud.conf’ in the ‘/etc/httpd/conf.d/’ directory and add the following configuration:
ServerAdmin admin@example.com
DocumentRoot /var/www/html/nextcloud/
ServerName example.com
Options +FollowSymlinks
AllowOverride All
Require all granted
ErrorLog /var/log/httpd/nextcloud_error.log
CustomLog /var/log/httpd/nextcloud_access.log combined
Replace ‘example.com’ with your domain name.
7. Enable and start Apache: Finally, enable the new virtual host configuration and restart Apache to apply the changes. You can do this by running the following commands:
sudo systemctl enable –now httpd
8. Complete the installation: Lastly, navigate to your Nextcloud installation in a web browser (e.g., http://example.com/nextcloud) and follow the on-screen instructions to complete the installation. Enter the database details you created earlier and set up an admin account for Nextcloud.
That’s it! You have successfully installed Nextcloud on AlmaLinux 9. You can now start using Nextcloud to store and share your files securely.