︿
Top

CentOS 7.4下安裝 NextCloud 雲端硬碟

因為一些緣故,好用的owncloud已經由其出走團隊開發出新的分支NextCloud來接替,此篇將紀錄在CentOS 7.4x64下安裝NextCloud Version 12.0.2的做法。


1. 安裝MariaDB
安裝mariadb相關套件、預設開機啟用mariadb服務並初始化MySQL
[root@centos7 ~]# yum install mariadb-server mariadb
[root@centos7 ~]# systemctl start mariadb
[root@centos7 ~]# systemctl enable mariadb
[root@centos7 ~]# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE 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
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 直接按Enter跳過
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] 按Y設定MySQL的root密碼
New password: 輸入新密碼
Re-enter new password: 再次輸入確認新密碼
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without 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 should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] 按Y移除anonymous users
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] 按Y禁止root從遠端登入MySQL
 ... Success!

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] 按Y移除預設建立好的test database
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] 按Y重新載入資料表權限
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

為NextCloud創建資料庫nextcloud_db、資料庫用戶nextcloud與資料庫用戶密碼
[root@centos7 ~]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 10
Server version: 5.5.56-MariaDB MariaDB Server

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

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

MariaDB [(none)]> CREATE DATABASE nextcloud_db;
MariaDB [(none)]> GRANT ALL ON nextcloud_db.* TO 'nextcloud'@'localhost' IDENTIFIED BY '12345678';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> exit


2. 安裝apache、php
安裝php程序語言
[root@centos7 ~]# rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
[root@centos7 ~]# rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
[root@centos7 ~]# yum -y install php71w php71w-devel php71w-mysqlnd php71w-xml php71w-mbstring php71w-gd

優化php.ini設定檔(增加php可接受最大傳送檔案容量的上限)

  • upload_max_filesize = 100M
  • post_max_size = 100M
安裝apache
[root@centos7 ~]# yum -y install httpd
[root@centos7 ~]# systemctl start httpd
[root@centos7 ~]# systemctl enable httpd

防火牆放行網頁規則
[root@centos7 ~]# firewall-cmd --permanent --zone=public --add-service=http
[root@centos7 ~]# firewall-cmd --permanent --zone=public --add-service=https
[root@centos7 ~]# firewall-cmd --reload


3. 安裝NextCloud
下載NextCloud軟體
[root@centos7 ~]# wget https://download.nextcloud.com/server/releases/nextcloud-12.0.2.tar.bz2
[root@centos7 ~]# tar -jxpvf nextcloud-12.0.2.tar.bz2 -C /var/www/html/

更改權限以符合http權限需求
許多用戶在安裝V12版時經常會出現無法登入redreict的問題,就是因為沒有注意到session目錄的權限[issues 3714]。
[root@centos7 ~]# setenforce 0
[root@centos7 ~]# nano /etc/sysconfig/selinux
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled

[root@centos7 ~]# chown -R apache:apache /var/www/html/nextcloud
[root@centos7 ~]# chown root:apache /var/lib/php/session


4. 設定NextCloud
瀏覽器連線至http://yourip/nextcloud







接下來就可以透過PC或是手機app的方式來同步存取我們專屬的雲端資料囉!



本文內容參考自WTF Daily BlogCSDN博客Drupal Documentation

tomy

來自台灣的系統工程師,一直熱衷於 Open source 相關技術的學習、建置、應用與分享。

  • Image
  • Image
  • Image
  • Image
  • Image

0 Comments:

張貼留言