Nextcloud is a very useful application that allows us to create a private cloud. Thanks to it, any company can create a server dedicated to its data. So you will have absolute control of them. This is important because privacy and file security are currently highly valued. But it is also quite useful if we have a personal server and we want to have our data backed up without having to entrust our data to third parties. Anyway, in this post, you will learn to install Nextcloud on CentOS 8 / RHEL 8.
Install Nextcloud on CentOS 8 / RHEL 8 / Oracle Linux 8
Nextcloud is a web application built with PHP. Then we will have to configure a web server for it. So we’ll install Nginx + PHP + MariaDB. But we will also create a Server block for it.
So let’s go for it.
1) Install Nginx and PHP
So, the first step is to install Nginx and PHP. Let’s start with Nginx. Open a terminal and run the following:
:~$ su :~# dnf install nginx
Then, start and enable the service. Next, add a firewall rule to allow access to Nginx.
:~# systemctl start nginx :~# systemctl enable nginx :~# firewall-cmd --permanent --add-service=http success :~# firewall-cmd --permanent --add-port=9000/tcp :~# firewall-cmd --reload success
Now, you can open the web browser and go to http://your-server
. You will see something like this:
Now, you need to install PHP. So, run the following command:
:~# dnf install php php-mysqlnd php-intl php-curl php-json php-gd php-xml php-mbstring php-zip php-fpm php-cli
Now, on the file /etc/php.ini
change the following value:
:~# nano /etc/php.ini cgi.fix_pathinfo=0
Then, save the changes and close the file. On the file /etc/php-fpm.d/www.conf
changes these values:
:~# nano /etc/php-fpm.d/www.conf user = nginx group = nginx pm.min_spare_servers = 5 pm.max_spare_servers = 35 listen = 127.0.0.1:9000
Again, save the changes and close the file. After that, start the php-fpm service and restart the Nginx service by running the following commands:
:~# systemctl start php-fpm :~# systemctl enable php-fpm :~# systemctl restart nginx
So, Nginx and PHP are working fine.
2) Install and configure MariaDB
Now it is necessary to install MariaDB because Nextcloud requires a database manager. To do this, run the following command:
:~# dnf install mariadb-server
Then, start and enable the service.
:~# systemctl enable mariadb :~# systemctl start mariadb
After that, you need to set a root password for MariaDB. You can do it by using the mysql_secure_installation
script. Moreover, you can secure the installation.
:~# mysql_secure_installation
And answer the following question:
Remove anonymous users? Y Disallow root login remotely? Y Remove test database and access to it? Y Reload privilege tables now? Y
Now, create a new user and database for Nextcloud. So, access to the MariaDB console. Next, run the following commands:
:~# mysql -u root -p > CREATE DATABASE nextcloud; > GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextclouduser'@'localhost' IDENTIFIED BY 'nextcloudpss'; > FLUSH PRIVILEGES; > exit;
Now, you can install Nextcloud.
3) Install MariaDB on CentOS 8 / RHEL 8 / Oracle Linux 8
Now we can start the installation. Make sure to install wget
and unzip
. Then, use it to start the download.
:~# cd /tmp/ :~# wget -c https://download.nextcloud.com/server/releases/nextcloud-16.0.3.zip
Then, decompress the folder. Move it to the Nginx document root and set the right permissions.
:~# unzip nextcloud-16.0.3.zip :~# mv nextcloud /usr/share/nginx/html/ :~# chown -R nginx:nginx /usr/share/nginx/html/ :~# chmod 755 -R /usr/share/nginx/html/
Now, we need to create a new Server Block for Nextcloud.
:~# nano /etc/nginx/conf.d/nextcloud.local.conf
And add the following:
server { server_name nextcloud.local; root /usr/share/nginx/html/nextcloud; location / { index index.html index.htm index.php; rewrite ^ /index.php$request_uri; } location ~ \.php$ { include /etc/nginx/fastcgi_params; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } }
Save the changes and close the file.
Finally, restart the Nginx and the PHP-fpm services.
:~# systemctl restart nginx :~# systemctl restart php-fpm
4) Install Nextcloud on CentOS 8 / RHEL 8 / Oracle Linux 8 (II)
So, complete the installation using the web browser. And you will see this:
So, type your MariaDB credentials and start the installation.
When the installation is finished, you will see the following screen.
After that, you can start to use Nextcloud.
So, that is it.
Conclusion
Nextcloud is one of those applications that are necessary for any company. Because it is possible to create a private cloud with all the features of the most popular services. Nextcloud even has clients for other platforms such as Android and iOS.
So, you can also read how to install Nextcloud on Debian 10?
Please share this post with your friends and join our Telegram channel.
The image from “10.- Nextcloud log in” has nothing to do with the Login screen. 🙂
You are right. It was a server problem. If you need the image, just tell me. I can send it to you.