linux下安装seafile云盘存储
Seafile安装教程
安装前准备:
- 系统: CentOS-7
- 环境:python 2.7、python-setuptools
- 数据库:Mysql 5.6
- 应用服务包:seafile-pro-server_7.0.14_x86-64.tar
安装步骤:
一、创建目录:
[root@CentOS-7 ~]# mkdir JD-Seafile
在root根目录下创建JD-Seafile目录
[root@CentOS-7 ~]# cd JD-Seafile
进入JD-Seafile目录
[root@CentOS-7 JD-Seafile]# mkdir Seafile-Server
创建Seafile-Server目录
[root@CentOS-7 JD-Seafile]# mkdir installed
创建 installed 目录
[root@CentOS-7 JD-Seafile]# 将 seafile-pro-server_7.0.14_x86-64.tar 安装包上传至此目录下
[root@CentOS-7 JD-Seafile]# mv seafile-pro-server_7.0.14_x86-64.tar.gz installed/
将安装包移动至 installed 目录
[root@CentOS-7 JD-Seafile]# cd installed/
进入 installed 目录
[root@CentOS-7 installed]# tar -xzf seafile-pro-server_7.0.14_x86-64.tar.gz
将安装包解压至 installed 根目录下
[root@CentOS-7 installed]# cd ..
退出返回至 JD-Seafile 目录下
[root@CentOS-7 JD-Seafile]#将 seafile-pro-server_7.0.14_x86-64.tar 安装包复制至此目录下
[root@CentOS-7 JD-Seafile]# tar -xzf seafile-pro-server_7.0.14_x86-64.tar.gz
将安装包解压至 JD-Seafile 根目录下
[root@CentOS-7 JD-Seafile]# mv seafile-pro-server-7.0.14/ Seafile-Server/
将解压出来的文件目录移动至 Seafile-Server 目录下
[root@CentOS-7 ~]# yum -y install tree
安装 tree 命令包
[root@CentOS-7 ~]# tree JD-Seafile -L 2
执行tree命令查看 JD-Seafile 目录的架构
目录显示如下:
JD-Seafile
├── installed
│ ├── seafile-pro-server-7.0.14
│ └── seafile-pro-server_7.0.14_x86-64.tar.gz
├── seafile-pro-server_7.0.14_x86-64.tar.gz
└── Seafile-Server
└── seafile-pro-server-7.0.14
这样设计目录的好处在于:
1.与seafile 相关的配置文件都可以放在 JD-Seafile目录下,便于集中管理.
2.后续升级时,你只需要解压最新的安装包到 JD-Seafile 目录下.
二、安装mysql:
[root@CentOS-7 ~]# wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
下载 mysql 的repo源
[root@CentOS-7 ~]# rpm -ivh mysql-community-release-el7-5.noarch.rpm
安装 mysql-community-release-el7-5.noarch.rpm 包
root@CentOS-7 ~]# yum install mysql-server
安装mysql
[root@CentOS-7 ~]# mysql_install_db --datadir=/var/lib/mysql
初始化Mysql数据库
[root@CentOS-7 ~]# chown mysql:mysql /var/lib/mysql -R
修改Mysql数据库目录的所属用户及其所属组,也就是使用 mysql这个账户启动数据库,默认是root用户
[root@CentOS-7 ~]# service mysqld restart
重新启动mysql
[root@CentOS-7 ~]# mysql -u root
使用root账户进入数据库
mysql> use mysql;
修改 使用mysql账户登录数据库
mysql > update user set password=password('123.com') where user='root';
修改mysql数据的root密码
mysql > exit;
[root@CentOS-7 ~]# mysql -u root -p
当数据库root设置了密码,需执行此命令登录数据库
三、安装seafile
[root@CentOS-7 ~]# cd JD-Seafile/Seafile-Server/seafile-pro-server-7.0.14/
进入安装包所解压的目录
[root@CentOS-7 seafile-pro-server-7.0.14]# ./setup-seafile-mysql.sh
执行安装后,如果系统中缺少组件,seafile会提示:
Checking python on this machine ...
Checking python module: python-mysqldb ...
python-mysqldb is not installed, Please install it first.
On Debian/Ubuntu:
sudo apt-get install python-mysqldb
On CentOS/RHEL:
sudo yum install MySQL-python
Error occured during setup.
Please fix possible problems and run the script again.
[root@CentOS-7 ~]# sudo yum install MySQL-python
按照提示安装缺少的组件
[root@CentOS-7 seafile-pro-server-7.0.14]# ./setup-seafile-mysql.sh
再次执行安装,发现缺少如下组件:
Checking python on this machine ...
Checking python module: python-mysqldb ... Done.
Checking for java ...
Java is not found. install it first.
On Debian/Ubuntu: apt-get install default-jre
On CentOS/RHEL: yum install jre
Error occured during setup.
Please fix possible problems and run the script again.
[root@CentOS-7 ~]# yum install jre
安装缺少的jre组件
[root@CentOS-7 seafile-pro-server-7.0.14]# ./setup-seafile-mysql.sh
再次执行,然后按照提示完成安装流程
安装成功后会有如下显示:
-----------------------------------------------------------------
Your seafile server configuration has been finished successfully.
-----------------------------------------------------------------
run seafile server: ./seafile.sh { start | stop | restart }
run seahub server: ./seahub.sh { start <port> | stop | restart <port> }
-----------------------------------------------------------------
If you are behind a firewall, remember to allow input/output of these tcp ports:
-----------------------------------------------------------------
port of seafile fileserver: 8082
port of seahub: 8000
四、调试Seafile服务
[root@CentOS-7 ~]# cd JD-Seafile/Seafile-Server/conf/
进入安装目录中的conf目录
[root@CentOS-7 ~conf]# vim gunicorn.conf
编辑此配置文件
#bind = “127.0.0.1:8000” 将127.0.0.1 改为 0.0.0.0
[root@CentOS-7 seafile-pro-server-7.0.14]# ./seafile.sh start
进入seafile安装目录,启动seafile服务
[root@CentOS-7 seafile-pro-server-7.0.14]# ./seahub.sh start
启动 Seahub,第一次启动 Seahub时,会提示你创建一个seafile管理员账户
[root@CentOS-7 ~]# systemctl stop firewalld
关闭系统防火墙,否则打不开网站
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原
文连接,否则保留追究法律责任的权利。