Dry | 4 steps take you to build a complete private cloud disk

Alt

A few years ago the rise of network disk, many of us have become accustomed to will be automatically backed up in the network disk, you can achieve data in the data storage, multi-device synchronization, but these network disk has a problem, that is, data security, on the one hand our data is stored is the review process there is the risk of leakage, and the other in recent years, a number of leading network disk to close, let us be more worried about data security.

Foreword

In order to solve the many problems of public cloud disk, disk article provides a private network construction idea, using the Jingdong cloud VM, OSS and open source software to build their own storage platform, individual or corporate users apply. Jingdong Cloud Object Storage (OSS) standard storage types of users, but also enjoy free storage capacity of 10GB, and if the amount is large, the daily billing, will first be deducted the amount of free, then pay for the excess in accordance with the settlement price details .

As used herein, ownCloud open source software to build a personal network disk, ownCloud is a free and open source cloud storage solution consists of two parts: the server and the client. ownCloud as early as in January 2010, created by the KDE developer Frank Karlitschek, the goal is to become the alternative to commercial cloud service provider. With different commercial cloud storage service, ownCloud freely available without charge, but Accordingly, the user must set up their own ownCloud server, which requires little technical. ownCloud client via a web interface, or to install special client software to use. Of course, any platform web interface is able to open web pages are supported, and the client software also supports quite a few platforms, Windows, Linux, iOS, Android in there. In addition to cloud storage, ownCloud can also be used to synchronize calendar, e-mail contacts, web browser bookmarks; in addition to multiplayer online file synchronization collaboration features (similar to google documents or Duddle, etc.).

First, the preparatory work

1. Create a cloud hosting

Create an operating system for the centos7.4 cloud hosting, cloud Jingdong operating procedures detailed in the documentation, not repeat them here:
https://docs.jdcloud.com/cn/virtual-machines/create-linux-instance .

2. Create OSS storage space

See detailed operating procedures Jingdong cloud Help documentation: https://docs.jdcloud.com/cn/object-storage-service/sign-up-service-2. After the opening of the guidelines by the object storage service, launched successfully in the object storage service, the system does not automatically create and AccessKeySecret AccessKey for the user, the user needs to manually AccessKey management at individual centers of creation .

We create storage space called "owndisk", pay attention, and cloud storage space to create a host in the same area, as were created in the "North China - Beijing" area.
Alt
Alt

3, OSS mounts to the cloud host

We use s3fs command to manually mount the OSS space to the cloud host.

Installation depends

Log in cloud hosting, installation dependencies

#yum install automake fuse fuse-devel gcc-c++ git libcurl-devel libxml2-devel make openssl-devel -y 

Alt
Alt

Installation s3fs

#yum install epel-release s3fs-fuse -y

Alt

Create a password file

#echo Access_Key_ID:Access_Key_Secret > ~/.passwd-s3fs 

Access_Key_ID: Access_Key_Secret Obtaining See: https://uc.jdcloud.com/account/accessKey
~ / .passwd-s3fs the password storage directory may be provided on their own.
Alt
Set the key file permissions

#chmod abc file

Wherein a, b, c are each a number, respectively permissions User, Group, and the Other.
r = 4, w = 2, x = 1
to rwx attribute is 4 + 2 + 1 = 7;
To rw- property is 4 + 2 = 6;
To the attributes rx 1 = 4 + 5.
Modify the permissions of 600
Alt

Mounting

本次的对象存储空间名称为:owndisk
mkdir :创建data文件夹作为本地挂载目录
s3fs :手动挂载命令,其中 bucketname 为bucket名称、 /data 是本地挂载路径、 passwd_file 为密码文件位置、 url 为京东云对象存储Bucket页面的Endpoint地域节点(Endpoint地址分为外网和内网地址,若使用京东云云主机与对象存储在同一个地域,请填写内网地址,其他情况请填写外网地址,不要忘记前面的 https://

创建名为data的目录,修改权限

#mkdir /data
# chown apache data -Rf
# chmod 770 data –Rf

手动执行挂载命令

#s3fs owndisk /data -o passwd_file=~/.passwd-disk -o url="https://s3-internal.cn-north-1.jdcloud-oss.com"

Alt
查看挂载结果

#df -Th

Alt

二、搭建lamp环境

1、安装Apache

# yum -y install httpd*     -安装Apache软件
# rpm -qa | grep httpd     --查看安装的http包

Alt
安装成功后,会产生下面两个文件

/etc/httpd/conf/httpd.conf  # 主配置文件
/var/www/html           # 网站根目录

配置Apache服务开机启动:

# systemctl enable httpd

Alt
启动Apache服务:

# systemctl start httpd
# lsof -i:80         --查看httpd服务是否启动

2、安装数据库mariadb

我们安装mariadb作为主数据库
安装

#yum -y install mariadb mariadb-server
#systemctl start mariadb

系统开启自启动

#systemctl enable mariadb

Alt

3、安装php

# yum -y install php

Alt
查看php版本

#php -v

Owncloud要求php版本高于5.6,如果上述命令查看到的php版本低于5.6,则需要升级版本,升级需要首先把老版本php卸载 , 否则会版本冲突。

#yum -y remove php

运行如下命令检查已经有的php包

#yum list installed | grep php

用yum remove命令一一删除这些包,例如

#yum remove php-mysql.x86_64 0:5.3.3-38.el6

Alt
都删除后运行再次以下命令查看是否删完了,要确保删完了

#yum list installed | grep php

Alt
下载安装5.6.0以上版本的php,这里以7.2版为例
首先,添加更新rpm源
更新源

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

然后,安装相关的包

#yum install -y php72w php72w-opcache php72w-xml php72w-gd php72w-devel php72w-mysql php72w-intl php72w-mbstring

之后要等待安装完毕,安装速度取决于你的云主机网络带宽,安装完毕用查看php版本

#php -v

Alt
安装完毕,重启apache服务

#systemctl restart httpd

三、安装owncloud

1、导入密钥

Import key owncloud rpm package, access keys to view the following address:
https://attic.owncloud.org/download/repositories/10.0/owncloud/
Alt

#rpm --import https://download.owncloud.org/download/repositories/stable/CentOS_7/repodata/repomd.xml.key

2, added a warehouse source

Add owncloud warehouse source.

#curl -L https://download.owncloud.org/download/repositories/stable/CentOS_7/ce:stable.repo -o /etc/yum.repos.d/ownCloud.repo

Alt
Clear local cache source, the source added into force

#yum clean expire-cache

3, installation owncloud

#yum install -y owncloud

Owncloud about 19mb installation package size, speed of installation depends on your cloud host network speed.
Alt
After installation, log on http: // your cloud host ip / owncloud / index.php to see owncloud network disk page .
Alt

Fourth, the configuration database

Owncloud create a database in MariaDB database, set the root password for jdcloud

# mysqladmin  -u root password "jdcloud"
# mysql -u root –p

Mariadb database related commands are:

#systemctl start mariadb  #启动MariaDB
#systemctl stop mariadb  #停止MariaDB
#systemctl restart mariadb  #重启MariaDB
#systemctl enable mariadb  #设置开机启动

Create a database, named owndisk

#create database owndisk;

Login, as shown below:
Alt
Alt

Fifth, log on, use

After setting, automatically jump screen, as shown below:
Alt
a login user name and password set above:
Alt
downloadable desktop or mobile client according to the above guidelines, for storing data, backup and synchronization operations.

Click " Jingdong cloud " is understood Jingdong cloud object storage products
Alt
Alt

Guess you like

Origin www.cnblogs.com/jdclouddeveloper/p/11670452.html