How to Install Nextcloud on CentOS 7
Prerequisites
First, We enable the EPEL repository to get dependency packages which are not found in the base/default repository. With the following command.
rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -ivh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
output:
[root@vps ~]# rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
Retrieving https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
Preparing... ################################# [100%]
[root@vps ~]# rpm -ivh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
Retrieving https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
Preparing... ################################# [100%]
Install the Apache server and other utilities.
yum install -y httpd wget bzip2
output:
[root@my ~]# yum install -y httpd wget bzip2
Loaded plugins: fastestmirror
Determining fastest mirrors
* base: mirror.imt-systems.com
* extras: mirror.fra10.de.leaseweb.net
* updates: mirror.imt-systems.com
base | 3.6 kB 00:00
extras | 2.9 kB 00:00
updates | 2.9 kB 00:00
(1/4): extras/7/x86_64/primary_db | 153 kB 00:00
(2/4): base/7/x86_64/group_gz | 165 kB 00:00
(3/4): base/7/x86_64/primary_db | 6.0 MB 00:00
(4/4): updates/7/x86_64/primary_db | 5.9 MB 00:02
Resolving Dependencies
--> Running transaction check
---> Package bzip2.x86_64 0:1.0.6-13.el7 will be installed
---> Package httpd.x86_64 0:2.4.6-90.el7.centos will be installed
--> Processing Dependency: httpd-tools = 2.4.6-90.el7.centos for package: httpd-2.4.6-90.el7.centos.x86_64
--> Processing Dependency: /etc/mime.types for package: httpd-2.4.6-90.el7.centos.x86_64
Install the PHP and its extensions using the yum command.
yum install -y php71w php71w-common php71w-gd php71w-intl php71w-mbstring php71w-mcrypt php71w-mysqlnd php71w-process php71w-xml php71w-cli php71w-pdo
output:
[root@vps ~]# yum install -y php71w php71w-common php71w-gd php71w-intl php71w-mbstring php71w-mcrypt php71w-mysqlnd php71w-process php71w-xml php71w-cli php71w-pdo
Loaded plugins: fastestmirror, langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Loading mirror speeds from cached hostfile
* base: mirror.nl.datapacket.com
* epel: mirror.infonline.de
* extras: mirror.oxilion.nl
* remi-php70: remi.mirror.karneval.c
Insatll MariaDB/MySQL as a database for Nextcloud.
yum -y install mariadb-server mariadb
output:
[root@my ~]# yum -y install mariadb-server mariadb
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.imt-systems.com
* extras: mirror.fra10.de.leaseweb.net
* updates: mirror.imt-systems.com
Resolving Dependencies
--> Running transaction check
---> Package mariadb.x86_64 1:5.5.64-1.el7 will be installed
--> Processing Dependency: mariadb-libs(x86-64) = 1:5.5.64-1.el7 for package: 1:mariadb-5.5.64-1.el7.x86_64
--> Processing Dependency: perl(Sys::Hostname) for package: 1:mariadb-5.5.64-1.el7.x86_64
--> Processing Dependency: perl(IPC::Open3) for package: 1:mariadb-5.5.64-1.el7.x86_64
--> Processing Dependency: perl(Getopt::Long) for package: 1:mariadb-5.5.64-1.el7.x86_64
--> Processing Dependency: perl(File::Temp) for package: 1:mariadb-5.5.64-1.el7.x86_64
--> Processing Dependency: perl(Fcntl) for package: 1:mariadb-5.5.64-1.el7.x86_64
--> Processing Dependency: perl(Exporter) for package: 1:mariadb-5.5.64-1.el7.x86_64
--> Processing Dependency: /usr/bin/perl for package: 1:mariadb-5.5.64-1.el7.x86_64
---> Package mariadb-server.x86_64 1:5.5.64-1.el7 will be installed
--> Processing Dependency: perl-DBI for package: 1:mariadb-server-5.5.64-1.el7.x86_64
--> Processing Dependency: perl-DBD-MySQL for package: 1:mariadb-server-5.5.64-1.el7.x86_64
--> Processing Dependency: perl(File::Path) for package: 1:mariadb-server-5.5.64-1.el7.x86_64
--> Processing Dependency: perl(Data::Dumper) for package: 1:mariadb-server-5.5.64-1.el7.x86_64
--> Processing Dependency: perl(DBI) for package: 1:mariadb-server-5.5.64-1.el7.x86_64
--> Processing Dependency: libaio.so.1(LIBAIO_0.4)(64bit) for package: 1:mariadb-server-5.5.64-1.el7.x86_64
--> Processing Dependency: libaio.so.1(LIBAIO_0.1)(64bit) for package: 1:mariadb-server-5.5.64-1.el7.x86_64
--> Processing Dependency: libaio.so.1()(64bit) for package: 1:mariadb-server-5.5.64-1.el7.x86_64
--> Running transaction check
---> Package libaio.x86_64 0:0.3.109-13.el7 will be installed
---> Package mariadb-libs.x86_64 1:5.5.60-1.el7_5 will be updated
---> Package mariadb-libs.x86_64 1:5.5.64-1.el7 will be an update
---> Package perl.x86_64 4:5.16.3-294.el7_6 will be installed
---> Package perl-Net-Daemon.noarch 0:0.48-5.el7 will be installed
---> Package perl-Pod-Escapes.noarch 1:1.04-294.el7_6 will be installed
---> Package perl-Pod-Perldoc.noarch 0:3.20-4.el7 will be installed
--> Processing Dependency: perl(parent) for package: perl-Pod-Perldoc-3.20-4.el7.noarch
--> Processing Dependency: perl(HTTP::Tiny) for package: perl-Pod-Perldoc-3.20-4.el7.noarch
---> Package perl-podlators.noarch 0:2.5.1-3.el7 will be installed
--> Running transaction check
---> Package perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7 will be installed
---> Package perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7 will be installed
---> Package perl-HTTP-Tiny.noarch 0:0.033-3.el7 will be installed
---> Package perl-parent.noarch 1:0.225-244.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository
Size
================================================================================
Installing:
mariadb x86_64 1:5.5.64-1.el7 base 8.7 M
mariadb-server x86_64 1:5.5.64-1.el7 base 11 M
Download and Setup
Next, Need to download the latest version of NextCloud into the /tmp folder.
cd /tmp/
wget https://download.nextcloud.com/server/releases/latest.tar.bz2
output:
[root@vps ~]# cd /tmp/
[root@vps tmp]# wget https://download.nextcloud.com/server/releases/latest.tar.bz2
--2019-01-14 10:12:43-- https://download.nextcloud.com/server/releases/latest.tar.bz2
Resolving download.nextcloud.com (download.nextcloud.com)... 88.198.160.133
Connecting to download.nextcloud.com (download.nextcloud.com)|88.198.160.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 36224830 (35M) [application/x-bzip2]
Extract the Nextcloud archive using the tar command.
tar -jxvf latest.tar.bz2
output:
nextcloud/3rdparty/aws/aws-sdk-php/src/CloudWatchEvents/Exception/CloudWatchEventsException.php
nextcloud/3rdparty/aws/aws-sdk-php/src/CodeCommit/
nextcloud/3rdparty/aws/aws-sdk-php/src/CodeCommit/Exception/
nextcloud/3rdparty/aws/aws-sdk-php/src/CodeCommit/Exception/CodeCommitException.php
nextcloud/3rdparty/aws/aws-sdk-php/src/CodeCommit/CodeCommitClient.php
nextcloud/3rdparty/aws/aws-sdk-php/src/DAX/
Move the extracted files to Apache’s document root and then create a data directory to hold the user data.
mv nextcloud /var/www/html/
mkdir /var/www/html/nextcloud/data
output:
[root@vps tmp]# mv nextcloud /var/www/html/
[root@vps tmp]# mkdir /var/www/html/nextcloud/data
Set the ownership of the files inside the NextCloud directory so that apache user can write the data into it.
chown -R apache:apache /var/www/html/nextcloud/
output:
[root@vps tmp]# chown -R apache:apache /var/www/html/nextcloud/
Start the Apache and MariaDB/MySQL service
systemctl start httpd
systemctl start mariadb
output:
[root@vps tmp]# systemctl start mariadb
[root@vps tmp]# systemctl start httpd
Enable both Apache and MySQL/MariaDB service to start automatically at system start-up.
systemctl enable httpd
systemctl enable mariadb
output:
[root@vps tmp]# systemctl enable httpd
[root@vps tmp]# systemctl enable mariadb
Create Database
After the installation, login as a root user to MySQL console and create a new database for Nextcloud.
mysql -u root -p
output:
root@vps:~# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Create a database called nextclouddb.
create database nextclouddb;
output:
MariaDB [(none)]> create database nextclouddb;
Query OK, 1 row affected (0.00 sec)
Grant permission to nextclouduser on the nextclouddb database on the localhost with a predefined password.
Change the PASSWORD to a secure and strong password of your choice.
grant all on nextclouddb.* to 'nextcloud'@'localhost' identified by 'p@ssword';
output:
MariaDB [(none)]> grant all on nextclouddb.* to 'nextcloud'@'localhost' identified by 'p@ssword';
Query OK, 0 rows affected (0.00 sec)
Exit from the MariaDB prompt.
quit
Firewall
Create a firewall rule to allow access from external machines to the Nextcloud.
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
firewall-cmd --reload
output:
[root@vps ~]# firewall-cmd --permanent --add-service=http
success
[root@vps ~]# firewall-cmd --permanent --add-service=https
success
[root@vps ~]# firewall-cmd --reload
success
Configure NextCloud
From your web browser, open the URL: http://IP_Address/nextcloud
From here, you will have to configure and setup the nextcloud using the web interface.
CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME
for 10% off!
1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month
Available Locations: LAX | MIA | ATL | FRA | AMS