现在差不多云盘都倒闭了,百度云感觉一点都不好用,所以尝试自己搭了。

部署前准备工作

  1. 我的硬件环境及开发环境请移步about
  2. 确认你的电脑开启VT-x或者AMD-V
  3. CentOS 7镜像使用 DVD ISO 下载地址
  4. SSH链接工具使用PuTTY或其它你喜欢的工具

开始部署

更新系统

1
2
#yum makecache      //建立元数据库
#yum update -y //系统更新

安装常用工具

1
2
3
4
#yum install vim -y //个人习惯的的编辑器
#yum install bzip2 -y //bzip2 工具
#yum install unzip -y //zip 解压工具
#yum install wget -y //下载工具

安装Apache

1
2
3
4
5
#yum install httpd -y    //安装Apache
#httpd -V //查看Apache版本
#systemctl start httpd //启动Apache
#systemctl enable httpd //设置开机启动
#systemctl status httpd //查看Apache运行状态

安装PHP7

1
2
3
4
5
6
7
8
9
10
11
12
#yum install epel-release -y    //安装 epel-release 仓库
#rpm -Uvh https://centos7.iuscommunity.org/ius-release.rpm //安装 RPM 包
#yum makecache //再次建立元数据库 加快安装速度
#yum install php70u -y //安装PHP主要文件 会自动安装 CLI COMMON 组件
#yum install php70u-fpm -y // FastCGI 进程管理器
#yum install php70u-gd -y // GD 图形库
#yum install php70u-mbstring -y // Mbstring 编码库
#yum install php70u-mysql -y // MySQL 组件 会自动安装PDO组件
#yum install php70u-posix -y // POSIX 组件
#yum install php70u-xml -y // XML 组件
#yum install php70u-ldap -y // LDAP 组件
#php -v //查看PHP 版本号

安装MariaDB

1
2
3
4
5
#yum install mariadb-server -y  //安装MariaDB
#mysql -V //查看MariaDB 版本号
#systemctl start mariadb
#systemctl enable mariadb
#systemctl status mariadb

初始化Mariadb

1
#mysql_secure_installation;

初始化开始

  1. 初始化提示

    NOTE: RUNING ALL PARTS OF THIS SCRIPT LS RECOMMENDED FOR AKK MariadDB
        SERVERS IN PRODUCTION USE! FLEASE READ EACH STEP CAREFULLY!
     
    In order to log into MariaDB to secure it, we’ll need the current
    password for the root user. if you’ve just installed MariaDB, and
    so you should just press enter here.
     
    Enter current password for root (enter for none): Enter

  2. 设置密码

    Setting the root password ensures that nobody can log into the MariaDB
    root user without the proper authorisation.
     
    Set root password? [Y/n] Enter
    New password: Password
    Re-enter new password: Password

  3. 是否删除匿名用户

    By Default, a MariaDB installation has an anonymouse user, allowing anyone
    to log into MariDB witout having to have a user account created for
    them. This is intended only for testing, and to make the installation
    go a bit smoother. You shold remove them berfore moving into a
    production enviroment.
     
    Remove anonymous users? [Y/n] Enter

  4. 是否禁止root远程访问

    Normally, root should only be allowed to connect form ‘localhost’. This
    ensures that someone cannot guess at the root password from the network.
     
    Disallow root login remotely? [Y/n] Enter

  5. 是否删除测试数据库

    By default, MariaDB comes with a database named ‘test’ that anyone can
    access. This is also intended only for testing, and should be removed
    before moving into a production environment.
     
    Remove test database and access to it? [Y/n] Enter

  6. 是否刷新权限表

    Reloading the privilege tables will ensure that all changes mode so far
    will take effect immediately
     
    Reload privilege tables now? [Y/n] Enter

  7. 显示创建成功

    All done! If you’ve completed all of the above steps, your MariaDB
    installation should now be secure
     
    Thanks for using MariaDB!

  8. 登陆MariaDB

    1
    #mysql -u root -p //按Enter后输入你设置的密码
  9. 创建表单

    1
    2
    3
    4
    5
    MariDB [(none)]> create database owncloud; 
    MariDB [(none)]> create user 'owncloud'@'localhost' identified by'password';
    MariDB [(none)]> grant all on owncloud.* to 'owncloud'@'localhost';
    MariDB [(none)]> flush privileges;
    MariDB [(none)]> quit;

ownCloud 部署

下载ownCloud

1
#wget https://download.owncloud.org/community/owncloud-10.0.3.tar.bz2 //下载ownCloud到当前目录

解压ownCloud

1
#tar -jxvf owncloud-10.0.3.tar.bz2 -C /var/www/html //解压ownCloud 到 /var/www/html 目录下

赋予用户和组权限

1
#chown -R apache.apache /var/www/html // R 表示递归 apache.apache 分别表示用户和组

配置Firewall

1
2
3
#firewall-cmd --permanent --zone=public --add-service=http //永久开放Public 区域的 http 服务端口
#firewall-cmd --permanent --zone=public --add-service=https
#firewall-cmd --reload //因为firewall-cmd 是动态 所以需要重新载入

配置SELinux

1
2
3
#setenforce 0 //临时改变重启失效
#getenforce //查看SELinux 状态
#vim /etc/selinux/config //永久改变
  • 找到SELINUX=enforcing改成SELINUX=disabled
  • Esc : wq Enter 即可保存退出

修改存储位置

1
2
#mkdir /var/ownclouddata //创建文件夹
#chown -R apache.apache /var/ownclouddata

访问ownCloud页面

然后根据提示配置简单信息即可正常访问