ownCloud配置与实现

snow chuai汇总、整理、撰写---2020/2/20


1. 安装及配置MariaDB
1) 安装MariaDB v10.2
[root@netdisk ~]# yum install yum-plugin-prioritiesyum centos-release-scl-rh centos-release-scl -y
[root@netdisk ~]# sed -i -e "s/\]$/\]\npriority=10/g" /etc/yum.repos.d/CentOS-SCLo-scl.repo [root@netdisk ~]# sed -i -e "s/\]$/\]\npriority=10/g" /etc/yum.repos.d/CentOS-SCLo-scl-rh.repo
[root@netdisk ~]# sed -i -e "s/enabled=1/enabled=0/g" /etc/yum.repos.d/CentOS-SCLo-scl.repo [root@netdisk ~]# sed -i -e "s/enabled=1/enabled=0/g" /etc/yum.repos.d/CentOS-SCLo-scl-rh.repo<br> [root@netdisk ~]# yum --enablerepo=centos-sclo-rh install rh-mariadb102-mariadb-server -y
1) 加载MariaDB v10.2的shell环境 [root@netdisk ~]# scl enable rh-mariadb102 bash [root@netdisk ~]# mysql -V mysql Ver 15.1 Distrib 10.2.22-MariaDB, for Linux (x86_64) using EditLine wrapper
[root@netdisk ~]# vim /etc/profile.d/mariadb102.sh source /opt/rh/rh-mariadb102/enable export X_SCLS="`scl enable rh-mariadb102 'echo $X_SCLS'`"
[root@netdisk ~]# source /etc/profile.d/mariadb102.sh
[root@netdisk ~]# vim /etc/opt/rh/rh-mariadb102/my.cnf.d/mariadb-server.cnf # 于[mysqld]最尾部追加如下内容: character-set-server=utf8
[root@netdisk ~]# systemctl enable --now rh-mariadb102-mariadb
2) 初始化MariaDB v10.2 [root@netdisk ~]# 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 # 设置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账户 ... 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远程登录 ... 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数据库 - 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 # 重新加载privilege ... 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!
3) 测试MariaDB连接 [root@netdisk ~]# mysql -u root -p Enter password: # 输入密码 Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 16 Server version: 10.2.22-MariaDB MariaDB Server
Copyright (c) 2000, 2018, 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 | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 | | root | 127.0.0.1 | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 | | root | ::1 | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 | +------+-----------+-------------------------------------------+ 3 rows in set (0.00 sec)
MariaDB [(none)]> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | +--------------------+ 3 rows in set (0.00 sec)
MariaDB [(none)]> exit Bye [root@netdisk ~]#
4) 防火墙规则设定 [root@netdisk ~]# firewall-cmd --add-service=mysql --permanent success [root@netdisk ~]# firewall-cmd --reload success
2. 完成LAMP架构,并安装ownCloud
[root@netdisk ~]# yum --enablerepo=centos-sclo-rh install rh-php72 rh-php72-php rh-php72-php-pear \
rh-php72-php-mbstring rh-php72-php-pdo rh-php72-php-intl rh-php72-php-gd rh-php72-php-mysqlnd httpd24 -y
[root@netdisk ~]# wget \ http://download.owncloud.org/download/repositories/stable/CentOS_7/ce:stable.repo \ -P /etc/yum.repos.d
[root@netdisk ~]# yum install owncloud-files -y
[root@netdisk ~]# ln -s /var/www/html/owncloud /opt/rh/httpd24/root/var/www/html/owncloud
[root@netdisk ~]# systemctl enable --now httpd24-httpd
3. 创建ownCloud数据库
[root@netdisk ~]# mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 16
Server version: 10.2.22-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and 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.00 sec)
MariaDB [(none)]> grant all privileges on owncloud.* to owncloud@'localhost' identified by '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
4. SELinux及Firewall设定
[root@netdisk ~]# semanage fcontext -a -t httpd_sys_rw_content_t /var/www/html/owncloud/apps
[root@netdisk ~]# semanage fcontext -a -t httpd_sys_rw_content_t /var/www/html/owncloud/config
[root@netdisk ~]# restorecon /var/www/html/owncloud/apps
[root@netdisk ~]# restorecon /var/www/html/owncloud/config
[root@netdisk ~]# firewall-cmd --add-service={http,https} --permanent success
[root@netdisk ~]# firewall-cmd --reload success
5. 配置ownCloud
[浏览器]==>http://netdisk.1000cc.net/owncloud





# 下载所需要的客户端软件

 

如对您有帮助,请随缘打个赏。^-^

gold