Nextcloud is an alternative to ownCloud for online data storage for online secure data backup with file sync share data storage cloud and secure audio and video conferencing just like Dropbox or Google Drive online file storage. We don’t need to worry about where or how to access our files. With Nextcloud online data storage all our data is where ever we are; accessible on all devices, and any time. We can hosted Nextcloud online data storage exclusively on our own private hosting dedicated server, so we can rest assured that our data is under our control and on our local dedicated server.
In this tutorial will show how to install Nextcloud online data storage on CentOS 7 Linux dedicated server. At the time of writing this document, the latest Nextcloud online data storage version that available to download is 12.0.4.
In this article of installing Nextcloud online data storage on CentOS 7 Linux dedicated server, it is supposed that:
a. You have already install RHEL/CentOS 7 Linux server up and running. In case that you don’t, you would probably like to read this link. Minimal RHEL/CentOS 7 Installation With Logical Volume Manager (LVM).
b. You have already done the initial server setup. Please refer to this link Minimal RHEL/CentOS 7 Initial Server Setup.
3. Install and Configure Database for Nextcloud Application
In CentOS 7 server, MySQl database program which mostly used by many software development company is moved to MariaDB, execute the following command to install MariaDB data base software.
# yum -y install mariadb-server mariadb-devel
Enable MariaDB data base software service to start it a the system boot and start its service.
# systemctl enable mariadb # systemctl start mariadb
Now let do the security hardening of MariaDB data base software by execute the following command.
We need to create a database and a user for Nextcloud online data storage and grant it all database privileges.
# mysql -u root -p mysql> create database nextclouddb01; mysql> create user 'nextclouduser'@'localhost' identified by 'P@ssword01'; mysql> grant all privileges on nextclouddb01.* to nextclouduser@localhost; mysql> flush privileges;
4. Installing Apache Web Server
Before we can start to install Nextcloud online data storage, we need to install Apache Web server and some mandatory packages as the following first.
# rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm # rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm # yum install -y httpd php56w php56w-opcache php56w-xml php56w-mcrypt php56w-gd php56w-devel php56w-mysql php56w-mbstring php56w-ldap
Enable Apache web service to start it a the system boot and start its service.
# systemctl enable httpd # systemctl start httpd
# wget https://download.nextcloud.com/server/releases/nextcloud-12.0.4.zip # unzip nextcloud-12.0.4.zip
# cd /var/www/ # mv nextcloud nextcloud-12.0.4 # ln -s nextcloud-12.0.4 Nextcloud
Also, we need to make sure that the permissions on the Nextcloud online data storage root directories are set correctly as the following.
# chmod -R 755 /var/www/nextcloud-12.0.4 # chown -R apache:apache /var/www/nextcloud-12.0.4
Next, we need to open HTTP port 80 on IPTables by edit file “/etc/sysconfig/iptables” as the following.
# vim /etc/sysconfig/iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT # systemctl restart iptables # iptables -L -n -v
Usually, the default PHP installation has not configured the correct timezone or php error reporting. While not required to run Nextcloud online data storage, it’s highly recommended to enable error reporting to syslog for troubleshooting issues with plugins or other scripts. Edit file “/etc/php.ini” as the following.
# vim /etc/php.ini date.timezone = Asia/Phnom_Penh log_errors = syslog
Then, we need to restart Apache service.
# systemctl restart httpd
We also need to disable SELinux.
# vim /etc/selinux/config SELINUX=disabled # reboot
5. Configure VHost and Install TeamPass Application
To create a VHost for Nextcloud online data storage, we need to create a *.conf file in directory “/etc/httpd/conf.d” as the following.
# vim /etc/httpd/conf.d/nextcloud.conf <VirtualHost *:80> ServerAdmin email@example.com ServerName nextcloud.techspacekh.com DocumentRoot /var/www/nextcloud ErrorLog "/var/log/httpd/nextcloud.techspacekh.com.log" CustomLog "/var/log/httpd/nextcloud.techspacekh.com.log" combined </VirtualHost>
Then, we need to restart Apache service.
# systemctl restart httpd
To access to Nextcloud online data storage with domain as configured in the VHost above we need DNS record for this domain. If you don’t have a DNS record for this domain, we just edit the host file. The host file for Windows is located in “C:\Windows\System32\drivers\etc\host” and you can edit it with Notepad.
After editing the host file, we can test by ping to the domain name and make use the reply IP address for this domain name is IP of server that we install Nextcloud online secure data backup.
>ping nextcloud.techspacekh.com Pinging nextcloud.techspacekh.com [192.168.150.132] with 32 bytes of data: Reply from 192.168.150.132: bytes=32 time<1ms TTL=64 Reply from 192.168.150.132: bytes=32 time<1ms TTL=64 Reply from 192.168.150.132: bytes=32 time<1ms TTL=64 Reply from 192.168.150.132: bytes=32 time<1ms TTL=64 Ping statistics for 192.168.150.132: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 0ms, Maximum = 0ms, Average = 0ms
Finally, we are ready to install Nextcloud online data storage web application.
In your browser, in the address box type in http://Nextcloud.techspacekh.com and the following windows appears. We will be presented with the following page, asking us to create an admin account, so we can enter a username and password for our admin account here.
Then click on the “Storage & database” drop down menu and leave the “Data folder” field information as it is. Click the “MySQL/MariaDB” button and then enter the information of the database database information that we create in the above step for Nextcloud online data storage.
Click on “Finish setup” and our admin account for Nextcloud online data storage will be created
We should be able to successfully login to Nextcloud online data storage web interface with our account and we will be welcomed by the Nextcloud online data storage home page where you can start uploading your files.
That’s all about how to install Nextcloud online secure data backup on CentOS 7 Linux dedicated server from Tech Space KH. Nextcloud a very nice online data storage with privacy and works protection of our files. It ensures that access is controlled only by the one who should have control . Hopefully, you can find this guide informative. If you have any questions or suggestions you can always leave your comments below. I will try all of my best to review and reply them.