centos 7.9搭建nextcloud详细步骤
时间: 2023-10-03 19:10:02 浏览: 176
nextcloud安装步骤
下面是 CentOS 7.9 搭建 Nextcloud 的详细步骤:
1.更新系统
```
sudo yum update
```
2.安装 Apache 和 PHP
```
sudo yum install epel-release
sudo yum install httpd php php-mysql php-gd php-xml php-mbstring php-intl php-zip
```
3.启动 Apache
```
sudo systemctl start httpd
sudo systemctl enable httpd
```
4.安装 MariaDB
```
sudo yum install mariadb-server
sudo systemctl start mariadb
sudo systemctl enable mariadb
```
5.为 MariaDB 设置密码
```
sudo mysql_secure_installation
```
6.创建 Nextcloud 数据库
```
sudo mysql -u root -p
```
输入密码后进入 MySQL 命令行,创建 Nextcloud 数据库:
```
CREATE DATABASE nextcloud;
CREATE USER 'nextclouduser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextclouduser'@'localhost';
FLUSH PRIVILEGES;
exit;
```
7.安装 Nextcloud
下载 Nextcloud:
```
cd /tmp
wget https://download.nextcloud.com/server/releases/nextcloud-20.0.7.tar.bz2
```
解压 Nextcloud:
```
sudo yum install bzip2
sudo tar -xvf nextcloud-20.0.7.tar.bz2 -C /var/www/html/
```
修改目录权限:
```
sudo chown -R apache:apache /var/www/html/nextcloud/
sudo chmod -R 755 /var/www/html/nextcloud/
```
8.配置 Apache
创建 Nextcloud 配置文件:
```
sudo nano /etc/httpd/conf.d/nextcloud.conf
```
输入以下内容:
```
Alias /nextcloud "/var/www/html/nextcloud/"
<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>
```
保存并退出。
重启 Apache:
```
sudo systemctl restart httpd
```
9.完成安装
在浏览器中访问 `http://your_server_ip/nextcloud`,进入 Nextcloud 安装页面。按照提示完成安装。
完成安装后,请确保删除 `/var/www/html/nextcloud/install` 目录,以保障安全。
以上就是 CentOS 7.9 搭建 Nextcloud 的详细步骤。
阅读全文