centos8搭建nextcloud和onlyoffice
时间: 2024-02-07 19:03:20 浏览: 176
Centos8 搭建DNS服务器
下面是在 CentOS 8 上搭建 Nextcloud 和 OnlyOffice 的步骤:
## 安装 Nextcloud
1. 安装 PHP 和 Apache
```
sudo dnf install php php-gd php-mysqlnd php-json php-xml php-mbstring php-zip php-intl php-apcu php-curl
sudo dnf install httpd
```
2. 安装 MariaDB
```
sudo dnf install mariadb-server
sudo systemctl enable --now mariadb
sudo mysql_secure_installation
```
3. 创建 Nextcloud 数据库
```
sudo mysql -u root -p
CREATE DATABASE nextcloud;
GRANT ALL ON nextcloud.* TO 'nextclouduser'@'localhost' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
EXIT;
```
4. 安装 Nextcloud
```
sudo dnf install https://download.nextcloud.com/server/releases/nextcloud-22.1.1.tar.bz2
sudo tar -xjf nextcloud-22.1.1.tar.bz2 -C /var/www/
sudo chown -R apache:apache /var/www/nextcloud/
sudo chmod -R 755 /var/www/nextcloud/
```
5. 配置 Apache
```
sudo nano /etc/httpd/conf.d/nextcloud.conf
```
在文件中添加以下内容:
```
<VirtualHost *:80>
ServerAdmin admin@example.com
DocumentRoot /var/www/nextcloud/
ServerName example.com
ServerAlias www.example.com
<Directory /var/www/nextcloud/>
Require all granted
AllowOverride All
Options FollowSymLinks MultiViews
SetEnv HOME /var/www/nextcloud
SetEnv HTTP_HOME /var/www/nextcloud
</Directory>
ErrorLog /var/log/httpd/nextcloud_error.log
CustomLog /var/log/httpd/nextcloud_access.log combined
</VirtualHost>
```
保存并关闭文件,然后重新启动 Apache:
```
sudo systemctl restart httpd
```
6. 访问 Nextcloud
在浏览器中输入 `http://example.com`,然后根据界面提示完成 Nextcloud 的设置。
## 安装 OnlyOffice
1. 安装 Docker
```
sudo dnf install dnf-plugins-core
sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo dnf install docker-ce docker-ce-cli containerd.io
sudo systemctl start docker
sudo systemctl enable docker
```
2. 安装 OnlyOffice
```
sudo docker run -i -t -d --restart=always --name onlyoffice-document-server \
-v /app/onlyoffice/DocumentServer/data:/var/www/onlyoffice/Data \
-v /app/onlyoffice/DocumentServer/logs:/var/log/onlyoffice \
-e SSL_KEY_PATH=/app/onlyoffice/DocumentServer/data/certs/onlyoffice.key \
-e SSL_CERTIFICATE_PATH=/app/onlyoffice/DocumentServer/data/certs/onlyoffice.crt \
-p 80:80 -p 443:443 onlyoffice/documentserver
```
3. 配置 OnlyOffice
在浏览器中输入 `https://example.com`,然后根据界面提示完成 OnlyOffice 的设置。在 Nextcloud 中启用 OnlyOffice 插件,并将 OnlyOffice 服务地址设置为 `https://example.com`。
完成上述步骤后,您的 Nextcloud 就可以与 OnlyOffice 集成了。
阅读全文