我们可以搭建一个自己的个人网盘(私有云盘),常用的开源框架包括ownCloud,Seafile,Nextcloud,本文介绍的是在CentOS 7下基于Nextcloud教你如何搭建一个私有云。
安装MySQL
安装mysql源信息
\[root@xxx ~\]# yum install https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
安装mysql
\[root@xxx ~\]# yum install mysql-community-server
启动mysql
\[root@xxx ~\]# systemctl start mysqld
查看密码
\[root@xxx ~\]# grep 'temporary password' /var/log/mysqld.log
修改密码
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Cby123..'
设置开机自启
\[root@xxx ~\]# systemctl enable mysqld
安装PHP并配置
安装epel
\[root@xxx ~\]# yum install epel\*
安装remi
\[root@xxx ~\]# yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
安装php以及php-fpm
\[root@xxx ~\]# yum install -y php74-php-fpm php74-php-cli php74-php-bcmath php74-php-gd php74-php-json php74-php-mbstring php74-php-mcrypt php74-php-mysqlnd php74-php-opcache php74-php-pdo php74-php-pecl-crypto php74-php-pecl-mcrypt php74-php-pecl-geoip php74-php-recode php74-php-snmp php74-php-soap php74-php-xmll
# 编辑配置文件
\[root@xxx ~\]# vim /etc/php.ini
# 找到
;cgi.fix\_pathinfo=1
# 去掉注释,并将1改成0
cgi.fix\_pathinfo=0
添加开机自启
\[root@xxx ~\]# systemctl enable php74-php-fpm
\[root@xxx ~\]# systemctl restart php74-php-fpm
安装Nginx并设置开启启动
安装Nginx
\[root@xxx ~\]# yum install nginx
启动Nginx
\[root@xxx ~\]# systemctl start nginx
设置开机自启
\[root@xxx ~\]# systemctl enable nginx
安装nextcloud
下载软件包
\[root@xxx ~\]# wget https://download.nextcloud.com/server/releases/nextcloud-18.0.2.tar.bz2
安装解压依赖
\[root@xxx ~\]# yum install lbzip2
进行解压
\[root@xxx ~\]# tar xvf nextcloud-18.0.2.tar.bz2
挪动文件夹
\[root@xxx ~\]# mv nextcloud /var/www/
给文件权限
\[root@xxx ~\]# chmod 777 /var/www/nextcloud -Rf
创建数据库
\# 进入MySQL
mysql -u root -p
# 创建一个名为nextclud\_db的数据库
CREATE DATABASE nextcloud\_db;
# 创建一个名为nextcloud、密码也为nextcloud的用户
CREATE USER 'nextcloud'@'localhost' IDENTIFIED BY 'Cby123..';
# 赋予用户nextcloud对数据库nextcloud\_db的所有操作权限
GRANT ALL PRIVILEGES ON nextcloud\_db.\* TO 'nextcloud'@'localhost';
# 刷新数据库权限
FLUSH PRIVILEGES;
# 退出
exit
评论 (0)