Steps and use of building private open source network disk nextcloud under centos8 (based on lamp)

Time:2020-4-12

Introduction:
Nextcloud is an open-source and free private cloud storage network disk project, which allows you to quickly and easily build a set of cloud synchronization network disk belonging to yourself or your team, so as to realize cross platform and cross device file synchronization, sharing, version control, team collaboration and other functions. Its client covers Windows, Mac, Android, iOS, Linux and other platforms, as well as provides the web side and WebDAV interface, so you can almost access your cloud disk on top of various devices.

 

This installation environment:

1、Apache/2.4.37

2. PHP 7.3.15 (must be > 7.2)

3、Mysql 8.0.17

4、nextcloud-18.0.1

System environment:CentOS Linux release 8.0.1905

 

Start installation

1. Install httpd

 yum -y install httpd

 

2. Install php7.3 and some required plug-ins

#Install the Remi repository first
dnf install dnf-utils http://rpms.remirepo.net/enterprise/remi-release-8.rpm

#Install php7.3 and common software package
DNF module reset PHP
DNF module enable PHP: remi-7.3 ා the default setting is remi-7.3

#Install php7.3
yum -y install php php-mysqlnd php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc php-zip

#Configure php.ini
vim /etc/php.ini
take
#cgi.fix_pathinfo=0
的注释删除掉,并改为0,这一项默认被注释并且值为1,根据官方文档的说明,这里为了当文件不存在时,阻止Webtake请求发送到后端的PHP-FPM模块,从而避免恶意脚本注入的攻击。

Extension:

There are two ways of PHP FPM communication (the second is by default):

1) The first is through port communication, which is usually used when the web and PHP FPM are not in the same server.

2) The second is to use php7.0-fpm.sock file for interconnection communication, which is generally used when the web and PHP FPM are on the same server.

 

3. Verify that httpd can parse. PHP

Systemctl restart httpd.service to start the service
systemctl start php-fpm.service

cd /var/www/html
vim index.php
...

...

Test page: http://localhost/index.php

 

4. Install MySQL

yum -y install mysql-server mysql
chown -R mysql:mysql my.cnf.d/
#If you need to modify the data path, you can modify it yourself

Mysqladmin - uroot password 'root1' -- set the password of root user in MySQL
MySQL - uroot - proot1 login

#Create user and give administrator permission
CREATE USER 'nextcloud'@'localhost' IDENTIFIED BY 'nextcloud1';
GRANT ALL PRIVILEGES ON  *.* TO [email protected];
Flush privileges; refresh permissions

 

5. Install nextcloud

wget https://download.nextcloud.com/server/releases/nextcloud-18.0.1.tar.bz2
#If the download speed of the above method is very slow, you can choose to download to the local area first and upload to the server

Tar jxvf nextcloud-18.0.1.tar.bz2 - C / var / www / HTML / unzip
Chown - R Apache: Apache / var / www / HTML / nextcloud - modify owner
Chmod - R 775 / var / www / HTML / nextcloud / ? modify permission

#############Optional#############
#Create httpd virtual directory. The role of the virtual directory:
#It is known that we put the web application in Apache's default docs directory, and Apache will automatically manage it.
#If we want to put the web application in another directory and Apache can still access it, we need to use Apache's virtual directory function.

vim /etc/httpd/conf.d/vhost.conf
...

    DocumentRoot "/var/www/html"
    ServerName cloud.magedu.com
    ServerAlias cloud.magedu.com
    
         Options FollowSymLinks
         AllowOverride All
         Require all granted
    

...
#########################

 

6. Web page configuration nextcloud

Access successful, start configuration

 

The administrator account password must be memorized~

Data location directory, database database name, etc Look at personal mood settings, come and experience!

If reprinted, please indicate the source. Thank you