nextcloud搭建私有云

 

  • 解决一些依赖性

yum install -y epel-release yum-utils unzip curl wget bash-completion policycoreutils-python mlocate bzip2
  • 安装Apache web服务

yum install -y httpd
  • 编写nextcloud的配置文件

vim /etc/httpd/conf.d/nextcloud.conf

  DocumentRoot /var/www/html/
  ServerName  your.server.com


  Require all granted
  AllowOverride All
  Options FollowSymLinks MultiViews

  • 设置web服务开机自启动并且手动运行

systemctl enable httpd.service
systemctl start httpd.service
  • 安装PHP模块

yum install -y centos-release-scl
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
  • 创建一些必要的链接

ln -s /opt/rh/httpd24/root/etc/httpd/conf.d/rh-php72-php.conf /etc/httpd/conf.d/
ln -s /opt/rh/httpd24/root/etc/httpd/conf.modules.d/15-rh-php72-php.conf /etc/httpd/conf.modules.d/
ln -s /opt/rh/httpd24/root/etc/httpd/modules/librh-php72-php7.so /etc/httpd/modules/
ln -s /opt/rh/rh-php72/root/bin/php /usr/bin/php
  • 安装数据库

yum install -y mariadb mariadb-server
  • 设计数据库开机自启动,并且手动启动数据库

systemctl enable mariadb.service
systemctl start mariadb.service
  • 下载nextcloud的相关文件

官方下载:nextcloud-15.0.5 

解压并移动到web服务目录下:

unzip nextcloud-15.0.5.zip
cd nextcloud
cp -R * /var/www/html/

创建数据文件目录:

mkdir /var/www/html/data
  • 对目录设置权限确保web可以正常访问:

chown -R apache:apache /var/www/html
systemctl restart httpd.service   #重启web服务

设置防火墙:
firewall-cmd --zone=public --add-service=http --permanent
firewall-cmd --reload
  • 设置SELinux安全上下文

semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/data(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/config(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/apps(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/.htaccess'
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/.user.ini'
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/3rdparty/aws/aws-sdk-php/src/data/logs(/.*)?'

restorecon -R '/var/www/html/'
setsebool -P httpd_can_network_connect on

 

你可能感兴趣的:(linux运维笔记)