NextCloud can be installed on a private home server or a virtual private server in the cloud. Files can then be uploaded and then synced to a local desktop, laptop, or even a smartphone. This way you have full control of your data.
A system with CentOS Stream 9 installed and running.
rootaccess to the system.
- LAMP Stack installed and running, for this, you can refer to one of our guides on installing the LAMP Stack (Apache, MariaDB and PHP).
Once you're all set, we'll proceed with NextCloud installation and configuration.
yum groupinstall "Development tools" yum install wget
Next, let us disable SELinux. We are going to set SELinux to permissive. Edit this file:
Then update, Edit this line to permissive:
First, navigate to the
/var/www/nextcloud directory as follows:
Now, download the latest NextCloud archive from the official website of NextCloud with the following command:
Check for the latest version here : NextCloud Official.
Check for files with the following command.
Now, extract the NextCloud archive file nextcloud-23.0.0.zip with the following command:
Now, change the owner and group of the
nextcloud/ directory and its contents to apache as follows:
sudo chown -R apache nextcloud
Now, change the permission or the
nextcloud/ directory and its content to 775 as follows:
chmod -Rf 755 nextcloud
For, some update needed 777.
chmod -Rf 777 nextcloud/sites/files chcon -R -t httpd_sys_content_rw_t /var/www/nextcloud/
Nextcloud required a directory to keep its data. To create a data directory and set the proper permissions on the nextcloud directory
sudo mkdir -p /var/nextcloud/data sudo chown -R apache: /var/www/nextcloud sudo chmod -R 755 /var/nextcloud
We need PHP-ZIP Module to run NextCloud. Install it using the below code.
yum install php-zip
Enable Firewall if not already done.
firewall-cmd --permanent --zone=public --add-service=http firewall-cmd --permanent --zone=public --add-service=https sudo firewall-cmd --reload
Create a new apache configuration file
nextcloud.conf for NextCloud with the following command:
Add the following codes:
Alias /nextcloud "/var/www/nextcloud/" <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
Change nextcloud.crowncloud.com with
Your Domain Name. If you are using with IP, Please remove the entire server_name line.
Now, press the
Esc key, and type in
:wq! and press the
Enter key to save and exit the file.
Now, restart & check the apache & PHP-FPM service with the following commands:
systemctl restart php-fpm systemctl restart apache.service
firewall-cmd --permanent --add-service=http firewall-cmd --permanent --add-service=https firewall-cmd --reload
Now create a Database, User & Password for NextCloud:
Change strong_password to something more secure/unqiue when using it for your database password.
mysql -u root CREATE DATABASE nextcloud; CREATE USER 'username'@'localhost' IDENTIFIED BY 'strong_password'; GRANT ALL PRIVILEGES ON nextCloud.* TO 'username'@'localhost'; FLUSH PRIVILEGES; exit
Now open the IP address from your browser, this will redirect you to configuring the final parts of the NextCloud installation.
IP_addresswith the actual IP of the server.
Input the Database details which was configured earlier.
Now you have successfully installed NextCloud with LAMP on your server.