在Linux上搭建私有云
目錄
一、前言
二、配置
三、使用
一、前言
1、介紹owncloud
? ? ? ? ownCloud官網(wǎng):https://www.owncloud.com/
? ? ? ? ownCloud是一款私有云存儲的搭建工具。可以在純局域網(wǎng)環(huán)境中使用,也可以搭建在公有云上。分為服務(wù)器和客戶端兩個部分,服務(wù)器以前是支持Windows、Mac OS和Linux的,但是現(xiàn)在的版本只支持Linux了。客戶端則支持Windows、Mac OS、Linux等桌面系統(tǒng)以及iOS、Android和BlackBerry等手機端。
2、準(zhǔn)備工作? ? ?
? ? ? ? 在配置開始之前,需要準(zhǔn)備兩個必要的文件,可以選擇去官網(wǎng)下載
? ? ? ? 鏈接:https://pan.baidu.com/s/1d8ZrMqZHTxMHJ5EeBF5Ixg 提取碼:2hbd
二、配置
1、保證虛擬機可上網(wǎng)(ping baidu)
ping -c4 baidu.com
2、保證yum可用(刷新)
yum repolist
3、關(guān)閉selinux
setenforce 0?
vim /etc/selinux/config
4、查看防火墻狀態(tài)
systemctl status firewalld.service
如果顯示為(running),則關(guān)閉防火墻
systemctl stop firewalld.service
【報錯1】
如果出現(xiàn)Unit firewalld\xc2\xa0.service not loaded這種情況
則在虛擬機上依次輸入以下命令
systemctl disable firewalld.serviceinit 65、安裝軟件(搭建OwnCloud需要LAMP的架構(gòu)支持)
yum install -y httpd php php-mysql mariadb-server mariadb sqlite php-dom php-mbstring php-gd php-pdo
6、啟動服務(wù)(httpd、mariadb)
systemctl start httpd.service
systemctl start mariadb.service
【報錯2】
如果出現(xiàn)Unit not found這種情況
則在虛擬機上依次輸入以下命令
systemctl unmask httpd.serviceinit 67、查看是否可以訪問界面(測試Apache)
8、將owncloud-10.0.4.tar文件上傳到虛擬機
9、將owncloud-10.0.4.tar文件解壓到當(dāng)前目錄
tar -xjvf owncloud-10.0.4.tar.bz2?
10、將owncloud下面的所有文件復(fù)制到/var/www/html中(原因:httpd的首頁文件存放在/var/www/html)
cp -r ~/owncloud/* /var/www/html
11、修改權(quán)限
chown -R apache:apache /var/www/html?
?12、在Mariadb數(shù)據(jù)庫中創(chuàng)建OwnCloud的數(shù)據(jù)庫
(1)給數(shù)據(jù)庫設(shè)置用戶和密碼
mysqladmin -u root password "123456"?(2)登錄數(shù)據(jù)庫
mysql -uroot -p123456(3)創(chuàng)建數(shù)據(jù)庫
MariaDB [(none)]> create database owncloud;(4)查詢數(shù)據(jù)庫
MariaDB [(none)]> show databases;(5)退出當(dāng)前模式
MariaDB [(none)]> quit13、再次刷新界面,顯示如下信息“以下提示當(dāng)前的php版本為5.4.16,要求高于5.6.0,請更新你的php版本”;查看當(dāng)前php的版本信息
14、升級yum倉庫
rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm?
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm?
15、卸載php模塊(php-common)
yum remove php-common?
16、重新安裝php(安裝php5.6)
yum install -y php56w php56w-opcache php56w-xml php56w-mcrypt php56w-gd php56w-devel php56w-mysql php56w-intl php56w-mbstring?
17、查看php版本,確認(rèn)安裝成功
php -v
18、重啟Apache服務(wù)
systemctl restart httpd
19、再次刷新界面
【報錯3】
如果出現(xiàn)“不能寫入配置目錄”這種情況
則在虛擬機上依次輸入以下命令
chown -R apache:apache /var/www/html init 6 setenforce 0 systemctl stop firewalld.service systemctl start httpd.service systemctl start mariadb.service20、在Windows上安裝ownCloud
?點擊“否”,選擇稍后重啟
21、打開ownCloud,輸入虛擬機IP地址,連接服務(wù)器地址
【報錯4】
如果出現(xiàn)“連接超時”的情況,那么將物理機重啟。然后在虛擬機上輸入以下命令,之后再打開訪問界面,最后再重新打開ownCloud進(jìn)行連接
setenforce 0 systemctl stop firewalld.service systemctl start httpd.service systemctl start mariadb.service22、以未加密HTTP方式重試
23、輸入創(chuàng)建的管理賬號和密碼
24、選擇Windows本地文件夾進(jìn)行同步連接
25、連接成功
26、測試(將某個文件拖入Windows本地文件夾中,然后在Linux的ownCloud中查看是否進(jìn)行了同步)
配置完成
三、使用
1、在虛擬機上輸入以下命令
setenforce 0 systemctl stop firewalld.service systemctl start httpd.service systemctl start mariadb.service2、打開訪問界面
3、打開物理機的“_文件夾同步連接”
?The end
總結(jié)
以上是生活随笔為你收集整理的在Linux上搭建私有云的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: django连接mysql数据库_Dja
- 下一篇: Linux ls命令返回结果说明