How to install Nextcloud on CentOS
In this tutorial, we will explain how to install Nextcloud on CentOS.
Nextcloud is a suite of client-server software for creating and using file hosting services. Nextcloud application functionally is similar to Dropbox. Unlike Dropbox Nextcloud does not offer off-premises file storage hosting. Nextcloud is free and open-source, which means that anyone is allowed to install and operate it on their own private server devices.
Prerequisites
You will need:
- VPS running CentOS
Step 1 – Install Apache and PHP
Nextcloud requires a LAMP Server. First, install the epel repository:
yum install epel-release
After, add the webtatic repository:
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
Now, install PHP and Apache:
yum install httpd php72w php72w-dom php72w-mbstring php72w-gd php72w-pdo php72w-json php72w-xml php72w-zip php72w-curl php72w-pear php72w-intl setroubleshoot-server bzip2
Step 2 – Install Nextcloud
Now it’s time to install Nextcloud. First, go to web directory:
cd /var/www/html
And download nextcloud tarball file:
curl -o nextcloud-15-latest.tar.bz2 https://download.nextcloud.com/server/releases/latest-15.tar.bz2
Now, extract the downloaded file:
tar -xvjf nextcloud-15-latest.tar.bz2
Create a data folder for Nextcloud:
mkdir nextcloud/data
Set apache permission to Nextcloud:
chown -R apache:apache nextcloud
Now remove the downloaded file:
rm nextcloud-15-latest.tar.bz2
Step 3 – Install MySQL
MySQL is needed to store Nextcloud information. Run this command to install MySQL:
yum install mariadb-server php72w-mysql
Now, start and enable MariaDB:
systemctl start mariadb
systemctl enable mariadb
After, set a strong password for MySQL root user:
mysql_secure_installation
Now, login to MySQL:
mysql -u root -p
Enter the password you have set and create a database for Nextcloud:
CREATE DATABASE nextcloud;
CREATE USER ‘nextcloud_user’@’localhost’ IDENTIFIED BY ‘password’;
GRANT ALL PRIVILEGES ON nextcloud.* TO ‘nextcloud_user’@’localhost’;
FLUSH PRIVILEGES;
exit
Step 4 – Configure firewall
First, install a firewall if is not present in your server:
yum install firewalld
And start it:
systemctl start firewalld
Now, you need to configure the firewall for ownCloud:
firewall-cmd –permanent –add-service=http
firewall-cmd –permanent –add-service=https
firewall-cmd –reload
Now, start and enable Apache:
systemctl start httpd
systemctl enable httpd
Step 5 – Finish Setup
Open the browser and go to your Nextcloud URL:http://youripaddress/nextcloud
Create an admin account:
Click on Storage & Database and enter your data folder:
Now configure the database and click on Finish Setup button:
You will be redirected to Nextcloud dashboard.
You have successfully installed Nextcloud on CentOS.
Enjoy.