之前的ownCloud安装过程中,因为SELinux会对apache的读写进行限制,所以直接禁用掉。为了提高安全度,建议开启SELinux。
安装policycoreutils-python
CentOS系统默认没有安装policycoreutils-python,所以无法使用semanage命令yum install policycoreutils-python -y semanage
[caption width=“598” id=“attachment_1154” align=“alignnone”] 安装截图[/caption]
设置SELinux
执行:semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/data(/.*)?' semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/config(/.*)?' semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/apps(/.*)?' semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/assets(/.*)?' semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/.htaccess' semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/.user.ini'
重置SELinux配置信息:
restorecon -Rv '/var/www/html/owncloud/'
如果要卸载ownCloud,执行以下命令修改SEliunx配置
semanage fcontext -d '/var/www/html/owncloud/data(/.*)?' semanage fcontext -d '/var/www/html/owncloud/config(/.*)?' semanage fcontext -d '/var/www/html/owncloud/apps(/.*)?' semanage fcontext -d '/var/www/html/owncloud/assets(/.*)?' semanage fcontext -d '/var/www/html/owncloud/.htaccess' semanage fcontext -d '/var/www/html/owncloud/.user.ini'
仅当启用了JavaScript和CSS资源管理时,才需要配置assets文件夹
通过网页更新ownCloud
在开启SELinux的情况下,需要进行配置才能通过网页更新ownCloud命令:
setsebool httpd_unified on
完成更新后,最好再禁用掉:
setsebool -p httpd_unified off