centos7搭建owncloud私有云

1、更改yum源

[1] 首先备份/etc/yum.repos.d/CentOS-Base.repo

[root@localhostyum.repos.d]# mv /etc/yum.repos.d/CentOS-Base.repo/etc/yum.repos.d/CentOS-Base.repo.backup

[2] 进入yum源配置文件所在文件夹

[root@localhostyum.repos.d]# cd /etc/yum.repos.d/

[3] 下载阿里的yum源配置文件,放入/etc/yum.repos.d/(操作前请做好相应备份)

[root@localhostyum.repos.d]# wget -O/etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

[4] 运行yum makecache生成缓存

[root@localhostyum.repos.d]# yum makecache

2、安装php

rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm

rpm -Uvhhttps://mirror.webtatic.com/yum/el7/webtatic-release.rpm

yum install php70w.x86_64 php70w-cli.x86_64php70w-common.x86_64 php70w-gd.x86_64 php70w-ldap.x86_64 php70w-mbstring.x86_64php70w-mcrypt.x86_64 php70w-mysql.x86_64 php70w-pdo.x86_64 php70w-devel.x86_64gd gd-devel php70w-pear.x86_64 php70w-xmlrpc.x86_64 php70w-imap.x86_64php70w-dom.x86_64 php70w-xmlwriter.x86_64 php70w-mcrypt.x86_64php70w-pecl-imagick.x86_64 php70w-xml.x86_64 php70w-pecl-redis.x86_64

 

yum install php70w-fpm

systemctl enable php-fpm.service

配置php

 vim/etc/php.ini

在php.ini里查找
max_execution_time
默认是30秒.改为
max_execution_time = 0

查找 post_max_size .改为
post_max_size = 10240M

查找upload_max_filesize,默认为8M改为
upload_max_filesize = 10240M

max_input_time = 7200

memory_limit = 10240m

 

3、  安装Mariadb

[root@linuxprobe~]# yum -y install mariadb-server

[root@linuxprobe~]# vi /etc/my.cnf

# add follows within [mysqld] section

[mysqld]

character-set-server=utf8

[root@linuxprobe~]# systemctl start mariadb

[root@linuxprobe~]# systemctl enable mariadb

·        初始化MariaDB

[root@linuxprobe~]# mysql_secure_installation   #MySQL一样,一路y

·        1

·        连接MariaDB

[root@linuxprobe~]# mysql -u root -p

Enter password:

Welcome to theMariaDB monitor.  Commands end with ; or\g.

Your MariaDBconnection id is 1023

Server version:5.5.50-MariaDB MariaDB Server

 

Copyright (c)2000, 2016, Oracle, MariaDB Corporation Ab and others.

 

Type 'help;' or'\h' for help. Type '\c' to clear the current input statement.

 

MariaDB[(none)]> select user,host,password from mysql.user;

+-----------+-----------+-------------------------------------------+

| user      | host      | password                                  |

+-----------+-----------+-------------------------------------------+

| root      | localhost | *F1DAE8BCDFCA7A57F246E0F834AC35830A3D640E|

| root      | 127.0.0.1 |*F1DAE8BCDFCA7A57F246E0F834AC35830A3D640E |

| root      | ::1       |*F1DAE8BCDFCA7A57F246E0F834AC35830A3D640E |

+-----------+-----------+-------------------------------------------+

5 rows in set(0.00 sec)

MariaDB[(none)]> show databases;

+--------------------+

| Database           |

+--------------------+

|information_schema |

| mysql              |

|performance_schema |

+--------------------+

5 rows in set(0.05 sec)

MariaDB[(none)]> exit;

Bye

防火墙开启端口

# 客户端设置

[root@vdevops ~]# firewall-cmd --add-service=mysql--permanent

success

[root@vdevops ~]# firewall-cmd --reload

success

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

#firewall-cmd –reload

 

.配置mariadb实例
#mysql_secure_installation;

Set root password?[Y/n]New password: (输入数据库密码等下需要)
Re-enter new password:
(再次确认密码)
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]Y

 

安装apache

[1]安装 httpd.

[root@linuxprobe ~]# yum -y install httpd

# 删除默认欢迎页面

[root@linuxprobe ~]# rm -f /etc/httpd/conf.d/welcome.conf

[2]配置httpd,将服务器名称替换为您自己的环境

[root@linuxprobe ~]# vi /etc/httpd/conf/httpd.conf

# line 86: 改变管理员的邮箱地址

ServerAdmin root@linuxprobe.org

# line 95: 改变域名信息

ServerName www.linuxprobe.org:80

# line 151: none变成All

AllowOverride All

# line 164: 添加只能使用目录名称访问的文件名

DirectoryIndex index.htmlindex.cgi index.php

# add follows to the end

# server's response header(安全性)

ServerTokens Prod

# keepalive is ON

KeepAlive On

[root@linuxprobe ~]# systemctl start httpd

[root@linuxprobe ~]# systemctl enable httpd

[3]如果Firewalld正在运行,请允许HTTP服务。,HTTP使用80 / TCP

[root@linuxprobe ~]# firewall-cmd --add-service=http--permanent

success

[root@linuxprobe ~]# firewall-cmd --reload

Success

·        安装ownCloud

# install fromEPEL

[root@linuxprobe ~]# yum --enablerepo=epel -y installphp-pear-MDB2-Driver-mysqli php-pear-Net-Curl

[root@linuxprobe ~]# wgethttp://download.owncloud.org/download/repositories/stable/CentOS_7/ce:stable.repo-P /etc/yum.repos.d

[root@linuxprobe ~]# yum -y install owncloud

[root@linuxprobe ~]# systemctl restart httpd

 

·        MariaDB中为ownCloud添加用户和数据库。

[root@linuxprobe~]# mysql -u root -p

Enter password:

ERROR 1045 (28000): Access deniedfor user 'root'@'localhost' (using password: YES)

[root@linuxprobe~]# mysql -u root -p

Enter password:

Welcome to the MariaDB monitor.  Commandsendwith ;or \g.

Your MariaDBconnection id is11

Server version: 5.5.52-MariaDB MariaDB Server

 

Copyright (c) 2000,2016, Oracle, MariaDB Corporation Aband others.

 

Type'help;'or'\h'for help.Type'\c'to clear the current input statement.

 

MariaDB[(none)]> create database owncloud;

Query OK, 1 row affected (0.15 sec)

 

MariaDB[(none)]> grant all privilegeson owncloud.*to owncloud@'localhost' identifiedby'password';

Query OK, 0 rows affected (0.00 sec)

 

MariaDB[(none)]> flush privileges;

Query OK, 0 rows affected (0.00 sec)

 

MariaDB [(none)]>exit

Bye

注:如果系统开启selinux,需设置以下操作:

[root@linuxprobe ~]# semanage fcontext -a -thttpd_sys_rw_content_t /var/www/html/owncloud/apps

[root@linuxprobe ~]# semanage fcontext -a -thttpd_sys_rw_content_t /var/www/html/owncloud/config

[root@linuxprobe ~]# restorecon /var/www/html/owncloud/apps

[root@linuxprobe ~]# restorecon /var/www/html/owncloud/config

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值