【Nextcloud适用】centos7安装owncloud9.0

  • A+
所属分类:owncloud 私有云

ownCloud  is a software system for File hosting. it is released under AGPLv3 license, so you can setup own cloud storage server without any additional cost.  It has a good  web suite that provides a cloud storage over the network, data can be uploaded via web browser or using software client. The project is based on PHP and a SQLite, MySQL, Oracle or PostgreSQL database, so it can run on all platforms that meet these requirements.  In this tutorial, we will install ownCloud 7 on CentOS 7.

Initial setup

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 

Set SELinux to allow OwnCloud to write the data:

setsebool -P httpd_unified 1

Allow web traffic through the firewall:

firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload

Start Apache using the following command:

systemctl start httpd.service

Start  MariaDBby issuing this command:

systemctl start mariadb.service
Auto start the service at system start-up:
systemctl enable httpd.service
systemctl enable mariadb.service

Installation

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;

Apache server configuration

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的安装目录,

如果发现有.htaccess设置不正确的提示,可以这样:

打开httpd.conf(在那里? APACHE目录的CONF目录里面),用vim打开后,查找

Options FollowSymLinks

AllowOverride None

改为

Options FollowSymLinks

AllowOverride All

然后去掉下面的注释

LoadModule rewrite_modulemodules/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

OwnCloud configuration

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.

 

下面是中文版:

OwnCloud 一款文件主机服务软件,就是我们平时使用的云存储,不过这个在自己主机的服务器上建立属于自己的私有云,OwnCloud 使用AGPLv3协议发布。本项目是基于PHP和SQLite,MySQL,Oracle或PostgreSQL数据库,所以它可以运行在所有的平台上,本教程将教大家如何在 CentOS 7 上安装 OwnCloud 7。

初始设置

安装CentOS 7默认最小配置然后安装目前所有的更新:

yum -y update

接下来,我们需要安装PHP,Apache Web服务器和MySQL服务器和PHP扩展:

yum install httpd php php-mysql mariadb-server mariadb sqlite php-dom php-mbstring php-gd php-pdo wget vim

设置SELinux允许owncloud写数据:

setsebool -P httpd_unified 1

防火墙设置:

firewall-cmd --permanent --zone=public --add-service=http

firewall-cmd --permanent --zone=public --add-service=https

firewall-cmd --reload

使用下面的命令启动Apache:

systemctl start httpd.service

通过此命令启动MariaDB:

systemctl start mariadb.service

自动启动的服务在系统启动:

systemctl enable httpd.service

systemctl enable mariadb.service

安装

首先,我们需要从官方网站下载owncloud。运行以下命令:

wget https://download.owncloud.org/community/owncloud-7.0.0.tar.bz2

解压文件:

tar -jxvf owncloud-7.0.0.tar.bz2 -C /var/www/html/

接下来我们需要为Web服务器上文件目录设置读写权限:

chown -R apache.apache /var/www/html/owncloud/

数据库配置

配置MariaDB实例:

mysql_secure_installation;

在设置过程这都输入 Y 并回车。

创建 owncloud 数据库和用户。

登录到MySQL服务器,使用以下命令:

mysql -u root -p

接下来,我们需要创建owncloud用户和权限:

mysql> create database owncloud;

mysql> create user ‘owncloud’@’localhost’ identified by’somedatabasepassword';

mysql> grant all on owncloud.* to ‘owncloud’@’localhost';

mysql> flush privileges;

mysql> quit;

Apache服务器配置

打开你最喜爱的编辑器编辑 owncloud 外部配置文件,我用vim:

vim /etc/httpd/conf.d/owncloud.conf

在配置文件中添加以下行:

Alias /owncloud /var/www/html/owncloud

Options Indexes FollowSymLinks

AllowOverride All

Order allow,deny

allow from all

启动Apache和MariaDB服务:

systemctl start httpd.service

systemctl start mariadb.service

owncloud配置

打开你喜欢的浏览器访问 http://你的 ip 地址/owncloud 或者 http://你的域名/owncloud。它将显示初始owncloud设置页。必须要活在配置。

  • 我的微信
  • 这是我的微信扫一扫
  • weinxin
  • 我的微信公众号
  • 我的微信公众号扫一扫
  • weinxin
avatar

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: