系统是基于Centos7.2
1.更改yum源:
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backupwget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repoyum clean allyum makecachesetenforce 0 #将selinux临时关闭,需要修改/etc/selinux/config,将SELINUX=enforcing修改为SELINUX=disabledsystemctl stop firewalldsystemctl disable firewalld
2.更新(可选):
yum update
3.安装软件包:
yum install -y httpd mariadb-server mariadbyum install http://repo.webtatic.com/yum/el7/x86_64/RPMS/webtatic-release-7-3.noarch.rpmrpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpmyum install php70w-fpm php70w-cli php70w-json php70w-mcrypt php70w-pear php70w-mysql php70w-xml php70w-gd php70w-mbstring php70w-pdo php70w-dom php70w -y
4.启动服务:
systemctl start httpd.servicesystemctl start mariadb.servicesystemctl enable httpd.servicesystemctl enable mariadb.service
5.配置数据库:
mysql_secure_installationMariaDB> create database owncloud;MariaDB> CREATE USER 'owncloud'@'localhost'IDENTIFIED BY 'owncloud';MariaDB> grant all privileges on owncloud.* to 'owncloud'@localhost identified by 'ownclound';MariaDB> set password for 'owncloud'@'localhost'=password('owncloud');MariaDB> flush privileges;MariaDB> show databases; MariaDB> exit
6.添加虚拟主机:
vim /etc/httpd/conf.d/owncloud.conf ####添加####Alias /owncloud /var/www/html/owncloudOptions Indexes FollowSymLinksAllowOverride All Order allow,denyallow from all ####重启服务####systemctl restart httpd.servicesystemctl restart mariadb.service
7.下载Owncloud软件包:
rpm --import https://download.owncloud.org/download/repositories/production/CentOS_7/repodata/repomd.xml.key wget http://download.owncloud.org/download/repositories/production/CentOS_7/ce:stable.repo -O /etc/yum.repos.d/ce:stable.repo yum clean expire-cache yum install owncloud-files #安装好后会在/var/www/html/owncloud生成网页文件
8.配置owncloud
http://你的ip地址/owncloud #打开 数据目录:填上你要放数据的目录 #创建目录要执行:chown -R apache:apache /创建的目录 数据库用户:owncloud 数据库密码:owncloud 数据库名:owncloud
一、改变存储目录:
vi /var/www/html/owncloud/config/config.sample.php将'datadirectory' => '/var/www/owncloud/data'更改为'datadirectory' => '/media/disk/data'chown -R apache:apache /media/disk/datachmod 777 /media/disk/data在配置owncloud的界面把目录写进去
二、更改ownCloud的上传文件大小限制
vi /var/www/html/owncloud/.htaccess修改以下几行:php_value upload_max_filesize 10240Mphp_value post_max_size 10240Mphp_value memory_limit 10240Mvi /etc/php.ini修改以下几行:upload_max_filesize = 10240Mpost_max_size = 10240Msystemctl restart httpd.servicesystemctl restart mariadb.servic