Install CentOS 7 with default Minimal configuration then install all current updates:
yum -y update
Next, we need to install PHP, Apache web server and MySQL server and some php extensions:
yum install httpd php php-mysql mariadb-server mariadb sqlite php-dom php-mbstring php-gd php-pdo
setsebool -P httpd_unified 1
firewall-cmd --permanent --zone=public --add-service=http firewall-cmd --permanent --zone=public --add-service=https firewall-cmd --reload
systemctl start httpd.service
Start MariaDBby issuing this command:
systemctl start mariadb.service
systemctl enable httpd.service systemctl enable mariadb.service
First, we need to download ownCloud from official website. Run the following command.
wget https://download.owncloud.org/community/owncloud-9.0.0.tar.bz2
Extract the archive we just downloaded.
tar -jxvf owncloud-7.0.0.tar.bz2 -C /var/www/html/
Next we need to assign the permission for web server to read and write the files on cloud directory.
chown -R apache.apache /var/www/html/owncloud/
DataBase configuration
Configure the mariadb instance.
mysql_secure_installation;
Hit enter on any of these that have the capital Y .
Set root password?[Y/n]New password: databaserootpassword Re-enter new password: databaserootpassword Remove anonymous users?[Y/n]Y Disallow root login remotely?[Y/n]Y Remove test database and access to it?[Y/n]Y Reload privilege tables now?[Y/n]
Create the ownCloud database and user.
Login to mysql server, Using the following command
mysql -u root -p
Next, we need to Create DataBase for ownCloud and grand permission for ownCloud user.
mysql> create database owncloud; mysql> create user 'owncloud'@'LOCALHOST' identified by'YOUR-DATABASE-PASSWORD'; mysql> grant all on owncloud.* to 'owncloud'@'LOCALHOST'; mysql> flush privileges; mysql> quit;
Open an external configuration file for ownCloud in your favorite editor, I’m using vim.
vim /etc/httpd/conf.d/owncloud.conf
Add the following lines in the config file.
<IfModule mod_alias.c> Alias /owncloud /var/www/html/owncloud </IfModule> <Directory “/var/www/html/owncloud”> Options Indexes FollowSymLinks AllowOverride All Order allow,deny allow from all </Directory>
如果要检查apache有没有安装,可以用命令检查apache的安装包是否安装上。
# rpm -qa | grep httpd
如果想看安装的运行级别。
# chkconfig --list httpd
如果想看有没有启动。
# service httpd status
etc/httpd是apache的安装目录,
打开httpd.conf(在那里? APACHE目录的CONF目录里面),用vim打开后,查找
Options FollowSymLinks
AllowOverride None
改为
Options FollowSymLinks
AllowOverride All
然后去掉下面的注释
LoadModule rewrite_module modules/mod_rewrite.so
.htaccess可以更改上传文件大小,默认的是2M
上传大小限制(设置成10G)
编辑文件:/var/www/html/owncloud/.htaccess
php_value upload_max_filesize 10240M
php_value post_max_size 10240M
php_value memory_limit 2048M
Restart all apache and mariaDB services:
systemctl start httpd.service systemctl start mariadb.service
Open up your favorite browser and paste http://your_ip_address/owncloud or http://your_Domain.com/owncloud . It will shows the initial owncloud setup page. it must be configured before going to live.