我們可以搭建一個自己的個人網盤(私有雲盤),常用的開源框架包括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