Menu Close

Installing NextCloud 17 on CentOS 7

Step 1: Yum update

  • # yum update

Step 2 : Install Web Server

Install Apache Web Server

  • # yum install httpd

Enable Apache to boot and start the service

  • # systemctl enable httpd
  • # systemctl start httpd

Step 3 : Install PHP 7

By default CentOS 7 ships with PHP 5.4 which is not supported for NextCloud17

  • Check PHP version # php -v or # rpm -qa | grep php

To install PHP 7, you have to install and enable EPEL and Remi repository on CentOS 7 system first:

  • # yum install epel-release
  • # rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-7.rpm

Enable Remi PHP 7 repo:

  • # yum install yum-utils
  • # yum-config-manager –enable remi-php70

Install PHP 7 and required modules

Verify PHP version # php -v

Step 4 : Install MariaDB 5.5 server

Enable MariaDB repository – Create a repository file named MariaDB.repo and add the below content:

https://downloads.mariadb.org/mariadb/repositories/#distro=CentOS&distro_release=centos7-amd64–centos7&mirror=osuosl&version=10.4

  • # vim /etc/yum.repos.d/MariaDB.repo
# MariaDB 10.3 CentOS repository list - created 2018-05-25 19:02 UTC
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.3/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

Install MariaDB 5.5 server and client

  • # yum install mariadb-server mariadb-client
  • # systemctl start mariadb
  • # systemctl enable mariadb

Run the following to create root password, remove the test database, remove the anonymous user and reload the priviledges:

  • # mysql_secure_installation
 [root@aliyun /]# mysql_secure_installation  

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

 In order to log into MariaDB to secure it, we'll need the current
 password for the root user.  If you've just installed MariaDB, and
 you haven't set the root password yet, the password will be blank,
 so you should just press enter here.
 
 Enter current password for root (enter for none): 
 OK, successfully used password, moving on...
 
 Setting the root password ensures that nobody can log into the MariaDB
 root user without the proper authorisation.
 
 Set root password? [Y/n] Y
 New password: 
 Re-enter new password: 
 Password updated successfully!
 Reloading privilege tables..
  ... Success!
 
 By default, a MariaDB installation has an anonymous user, allowing anyone
 to log into MariaDB without having to have a user account created for
 them.  This is intended only for testing, and to make the installation
 go a bit smoother.  You should remove them before moving into a
 production environment.
 
 Remove anonymous users? [Y/n] y
  ... Success!
 
 Normally, root should only be allowed to connect from 'localhost'.  This
 ensures that someone cannot guess at the root password from the network.
 
 Disallow root login remotely? [Y/n] y
  ... Success!
 
 By default, MariaDB comes with a database named 'test' that anyone can
 access.  This is also intended only for testing, and should be removed
 before moving into a production environment.
 
 Remove test database and access to it? [Y/n] y
  - Dropping test database...
  ... Success!
  - Removing privileges on test database...
  ... Success!
 
 Reloading the privilege tables will ensure that all changes made so far
 will take effect immediately.
 
 Reload privilege tables now? [Y/n] y
  ... Success!
 
 Cleaning up...
 
 All done!  If you've completed all of the above steps, your MariaDB
 installation should now be secure.
 
 Thanks for using MariaDB! 

Step 5 : Create a database

# mysql -uroot -p -e "CREATE DATABASE nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci"
# mysql -uroot -p -e "GRANT ALL on nextcloud.* to nextcloud@localhost identified by 'password'"
# mysql -uroot -p -e "FLUSH privileges"

Step 6 : Configure Web Server

Create a virtual host configuration file for the domain to host NextCloud

  • # vim /etc/httpd/conf.d/domain.com.conf
<VirtualHost *:80>

ServerAdmin admin@domain.com
DocumentRoot /var/www/html/nextcloud
ServerName domain.com
ServerAlias www.domain.com

<Directory /var/www/html/nextcloud>
Options +FollowSymlinks
AllowOverride All

<IfModule mod_dav.c>
Dav off
</IfModule>

SetEnv HOME /var/www/html/nextcloud
SetEnv HTTP_HOME /var/www/html/nextcloud
</Directory>

ErrorLog /var/log/httpd/nextcloud-error_log
CustomLog /var/log/httpd/nextcloud-access_log common

</VirtualHost>

Download NextCloud 17 from office website

  • # wget https://download.nextcloud.com/server/releases/nextcloud-17.0.0.zip
  • # unzip nextcloud-17.0.0.zip /var/www/html
  • create a data directory # mkdir /var/www/html/nextcloud/data

Set permission to apache user and restart httpd

  • # chown -R apache:apache /var/www/html/nextcloud
  • # systemctl restart httpd.

Continue the setup via web installation on http://domain.com

Leave a Reply

Your email address will not be published. Required fields are marked *