作者:【吴业亮】云计算开发工程师
博客:http://blog.csdn.net/wylfengyujiancheng
前言
ownCloud 是一个开源免费专业的私有云存储项目,它能帮你快速在个人电脑或服务器上架设一套专属的私有云文件同步网盘,可以像 Dropbox 那样实现文件跨平台同步、共享、版本控制、团队协作等等。ownCloud 能让你将所有的文件掌握在自己的手中,只要你的设备性能和空间充足,那么用其来几乎没有任何限制。
owncloud不仅有windows客户端,还有手机端
手机端:
[root@owncloud ~]# yum -y install httpd
2、删除欢迎词
[root@owncloud ~]# rm -f /etc/httpd/conf.d/welcome.conf
3、修改配置文件
[root@owncloud ~]# vi /etc/httpd/conf/httpd.conf
# line 86: change to admin's email address
ServerAdmin [email protected]
# line 95: change to your server's name
ServerName www.srv.world:80
# line 151: change
AllowOverride All
# line 164: add file name that it can access only with directory's name
DirectoryIndex index.html index.cgi index.php
# 在后面新增
# server's response header
ServerTokens Prod
# keepalive is ON
KeepAlive On
4、启动服务并设置开机启动
[root@owncloud ~]# systemctl start httpd
[root@owncloud ~]# systemctl enable httpd
5、设置防火墙
[root@owncloud ~]# firewall-cmd --add-service=http --permanent
success
[root@owncloud ~]# firewall-cmd --reload
Success
6、写入测试文件
[root@owncloud ~]# vi /var/www/html/index.html
<html>
<body>
<div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;">
Test Page
div>
body>
html>
测试
二、安装PHP
1、安装软件包
[root@owncloud ~]# yum -y install php php-mbstring php-pear
修改配置文件
[root@owncloud ~]# vi /etc/php.ini
# line 878: 修改时区
date.timezone = "Asia/Shanghai"
2、重启http服务
[root@owncloud ~]# systemctl restart httpd
3、创建测试文件
[root@owncloud ~]# vi /var/www/html/index.php
<html>
<body>
<div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;">
print Date("Y/m/d");
?>
div>
body>
html>
4、测试
三、安装数据库
1、安装软件包
[root@owncloud ~]# yum -y install mariadb-server
2、修改配置文件
[root@owncloud ~]# vi /etc/my.cnf
# add follows within [mysqld] section
[mysqld]
character-set-server=utf8
3、启动服务并设置开机启动
[root@owncloud ~]# systemctl start mariadb
[root@owncloud ~]# systemctl enable mariadb
4、初始化数据库
[root@owncloud ~]# 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):
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
Set root password? [Y/n] y
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
Remove anonymous users? [Y/n] y
... 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
Disallow root login remotely? [Y/n] y
... 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
Remove test database and access to it? [Y/n] y
- 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
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!
5、连接数据库
[root@owncloud ~]# mysql -u root -p
Enter password: # MariaDB root password you set
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 5.5.37-MariaDB MariaDB Server
Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
6、查看用户
MariaDB [(none)]> select user,host,password from mysql.user;
+------+-----------+-------------------------------------------+
| user | host | password |
+------+-----------+-------------------------------------------+
| root | localhost | *xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
| root | 127.0.0.1 | *xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
| root | ::1 | *xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
+------+-----------+-------------------------------------------+
3 rows in set (0.00 sec)
7、显示数据库
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
+--------------------+
3 rows in set (0.00 sec)
MariaDB [(none)]> exit
Bye
8、配置防火墙
[root@owncloud ~]# firewall-cmd --add-service=mysql --permanent
success
[root@owncloud ~]# firewall-cmd --reload
Success
四、安装owncloud
1、安装软件包
[root@owncloud ~]# yum --enablerepo=epel -y install php-pear-MDB2-Driver-mysqli php-pear-Net-Curl
2、下载网络源
[root@owncloud ~]# wget http://download.owncloud.org/download/repositories/stable/CentOS_7/ce:stable.repo -P /etc/yum.repos.d
3、安装owncloud
[root@owncloud ~]# yum -y install owncloud
4、重启http
[root@owncloud ~]# systemctl restart httpd
5、创建ownclou数据库及用户
[root@owncloud ~]# 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.47-MariaDB MariaDB Server
Copyright (c) 2000, 2015, 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 'Changeme_123'; #创建用户
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> exit
Bye
6、配selinux
[root@owncloud ~]# semanage fcontext -a -t httpd_sys_rw_content_t /var/www/html/owncloud/apps
[root@owncloud ~]# semanage fcontext -a -t httpd_sys_rw_content_t /var/www/html/owncloud/config
[root@owncloud ~]# restorecon /var/www/html/owncloud/apps
[root@owncloud ~]# restorecon /var/www/html/owncloud/config
9、登录界面
http://IP/owncloud
参考:
https://owncloud.org/