关闭防火墙
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld
[root@localhost ~]#
安装软件
[root@localhost ~]# yum install -y unzip curl wget bash-completion bzip2
设置Selinux
[root@localhost ~]# cat /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=permissive
# SELINUXTYPE= can take one of three values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
[root@localhost ~]#
安装httpd并设置
[root@localhost ~]# yum install httpd -y
[root@localhost ~]# yum update -y
[root@localhost ~]# cat /etc/httpd/conf.d/nextcloud.conf
<VirtualHost *:80>
DocumentRoot /var/www/html/
ServerName 127.0.0.1
<Directory "/var/www/html/">
Require all granted
AllowOverride All
Options FollowSymLinks MultiViews
</Directory>
</VirtualHost>
[root@localhost ~]#
[root@localhost ~]# systemctl start httpd.service
[root@localhost ~]# systemctl enable httpd.service
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
[root@localhost ~]#
安装软件并创建链接
[root@localhost ~]# yum install -y centos-release-scl
[root@localhost ~]# yum install -y rh-php72 rh-php72-php rh-php72-php-gd rh-php72-php-mbstring rh-php72-php-intl rh-php72-php-pecl-apcu rh-php72-php-mysqlnd rh-php72-php-pecl-redis rh-php72-php-opcache rh-php72-php-imagick
[root@localhost ~]# ln -s /opt/rh/httpd24/root/etc/httpd/conf.d/rh-php72-php.conf /etc/httpd/conf.d/
[root@localhost ~]# ln -s /opt/rh/httpd24/root/etc/httpd/conf.modules.d/15-rh-php72-php.conf /etc/httpd/conf.modules.d/
[root@localhost ~]# ln -s /opt/rh/httpd24/root/etc/httpd/modules/librh-php72-php7.so /etc/httpd/modules/
[root@localhost ~]# ln -s /opt/rh/rh-php72/root/bin/php /usr/bin/php
[root@localhost ~]#
安装mariadb并设置
[root@localhost ~]# yum install -y mariadb mariadb-server
[root@localhost ~]# systemctl start mariadb.service
[root@localhost ~]# systemctl enable mariadb.service
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
[root@localhost ~]#
[root@localhost ~]# mysql -u root
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.68-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> CREATE DATABASE nextcloud;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> create user nextcloud@localhost identified by '123456';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> grant all on *.* to 'nextcloud'@'localhost' identified by '123456' with grant option;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> exit
Bye
[root@localhost ~]# systemctl restart mariadb.service
[root@localhost ~]#
下载nextcloud并设置
[root@localhost ~]# yum install wget -y
[root@localhost ~]# wget https://download.nextcloud.com/server/releases/nextcloud-20.0.2.zip
--2021-09-03 10:49:53-- https://download.nextcloud.com/server/releases/nextcloud-20.0.2.zip
正在解析主机 download.nextcloud.com (download.nextcloud.com)... 95.217.64.181
正在连接 download.nextcloud.com (download.nextcloud.com)|95.217.64.181|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:141988942 (135M) [application/zip]
正在保存至: “nextcloud-20.0.2.zip”
100%[=============================================>] 141,988,942 228KB/s 用时 6m 51s
2021-09-03 10:56:45 (337 KB/s) - 已保存 “nextcloud-20.0.2.zip” [141988942/141988942])
[root@localhost ~]#
解压
[root@localhost ~]# unzip nextcloud-20.0.2.zip
[root@localhost ~]# ls
anaconda-ks.cfg nextcloud nextcloud-20.0.2.zip
[root@localhost ~]# cp -r nextcloud /var/www/html/
[root@localhost ~]# mkdir /var/www/html/data
[root@localhost ~]# chown -R apache:apache /var/www/html
[root@localhost ~]# systemctl restart httpd.service
[root@localhost ~]#
WEB网页
打开web页面 http://192.168.100.10/nextcloud