Ubuntu18.04 build open source Seafile cloud storage

Ubuntu18.04 build open source Seafile cloud storage

Seafile is an open source file cloud storage platform that solves the problems of centralized file storage, synchronization, and multi-platform access. It focuses on security and performance and supports Windows, Mac, Linux, iOS, and Android platforms. Support file synchronization or directly mount to local access.

Seafile includes the following system components: Seahub: Website interface for users to manage their own data and account information on the server.
Seafile server
provides website support through "gunicorn" (a lightweight Python HTTP server). Seahub runs as an application of gunicorn. Seafile server
(seaf-server): Data service process, handling upload/download/synchronization of original files. Ccnet server (ccnet-server):
Internal RPC service process, connecting multiple components. Controller: Monitor the ccnet and seafile processes, and restart the process if necessary.

Insert picture description here
I don’t know if I have known about Seafile. I also built it under Ubuntu (Of course Linux can also be used) and found it to be really easy to use. However, there are two versions, one free version. Although the functions are limited, the basic usage problems are not Big, what kind of bicycle do you want; one is the professional version, which supports up to three users, and the functions are still very complete. If you are a large enterprise and there are many users, Seafile still needs to be supported in China. It is recommended to use a professional server. There are two official deployment methods: one under Linux, one under Ubuntu, and you can also deploy under docker, depending on your personal situation! The following is what I deployed on Ubuntu. During the period, I also explained the incomprehensibility of the official ones! !

Links used to deploy Seafile
Official document: https://cloud.seafile.com/published/seafile-manual-cn/overview/components.md
Chinese version of the server manual: https://www.seafile.com/download/
Download the server installation package: https://www.seafile.com/download/Download the
server professional version pro: https://download.seafile.com/d/6e5297246c/?p=/pro
install onlyoffice online editing http:// www.zhuodown.com/a/luyouqi/2020/0424/35965.html
If you feel too troublesome, you can also use script installation . But the scripts are all usernames, passwords, and configurations generated by default

1. Deploying Seafile server (using MySQL/MariaDB) If you install and use SQLite, please refer to the official documentation for details (Note for deployment directory structure: it doesn’t matter if you create a directory name here, just create a new one and put it inside. The purpose is for management and subsequent upgrades)

mkdir haiwen
mv seafile-server_* haiwen
cd haiwen
  #将 seafile-server_* 移动到 haiwen 目录下后
tar -xzf seafile-server_*
mkdir installed
mv seafile-server_* installed

The directory is roughly like this:

#tree . -L 2
.
├── installed
│   └── seafile-server_1.4.0_x86-64.tar.gz
└── seafile-server-1.4.0
    ├── reset-admin.sh
    ├── runtime
    ├── seafile
    ├── seafile.sh
    ├── seahub
    ├── seahub.sh
    ├── setup-seafile.sh
    └── upgrade

2. Preparations before installation (note: the professional version 7.1.X or higher must upgrade python to 3 or higher, see the downloaded version clearly to avoid errors)
Seafile 7.0.x

#on Debian/Ubuntu 14.04 server
apt-get update
apt-get install python2.7 libpython2.7 python-setuptools python-imaging python-ldap python-urllib3 sqlite3
#on Ubuntu 16.04 server
#As the default python binary on Ubuntu 16.04 server is python 3, we need to install python (python 2) first.
apt-get update
apt-get install python
apt-get install python2.7 libpython2.7 python-setuptools python-imaging python-ldap python-urllib3 ffmpeg python-pip sqlite3
pip install pillow moviepy
#on CentOS 7
yum -y install epel-release
rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
yum -y install python-imaging MySQL-python python-memcached python-ldap python-urllib3 ffmpeg ffmpeg-devel
pip install pillow moviepy

Seafile 7.1 or above

#on Debian 10/Ubuntu 18.04

apt-get update
apt-get install python3 python3-setuptools python3-pip python3-ldap -y

pip3 install --timeout=3600 Pillow pylibmc captcha jinja2 sqlalchemy psd-tools django-pylibmc django-simple-captcha
#on CentOS 8
yum install python3 python3-setuptools python3-pip python3-ldap -y

pip3 install --timeout=3600 Pillow pylibmc captcha jinja2 sqlalchemy psd-tools django-pylibmc django-simple-captcha

Three, installation

cd seafile-server-*
./setup-seafile.sh           #运行安装脚本并回答预设问题

If one of the above software is not installed in your system, the Seafile initialization script will remind you to install the corresponding software package. (Note: If there is no MySQL library, you still need to install the library. The MySQL root password will be used to create the seafile user later.) The script will ask you some questions in turn, so as to guide you step by step to configure the parameters of Seafile:
here, you You will be asked to choose a way to create the Seafile database:

Please choose a way to initialize seafile databases:


[1] Create new ccnet/seafile/seahub databases
[2] Use existing ccnet/seafile/seahub databases
............................................

If you choose 1, you need to provide the root password. The script program will create the database and user.
If you choose 2, the ccnet/seafile/seahub database should have been created by you (or someone else) in advance.
If the installation is completed correctly, you will see the following output (the new version may be different)

4. Obtain the license certificate (note: the professional version can only support the use of more than 3 people when the certificate is
obtained ) Put the license certificate you got in the top-level directory. For example, in this document page, we use /data/haiwen/ as the top-level directory.

5. Start the Seafile server and Seahub website.
In the seafile-server-latest directory, run the following command

启动 Seafile:
./seafile.sh start # 启动 Seafile 服务
启动 Seahub
./seahub.sh start  # 启动 Seahub 网站 (默认运行在127.0.0.1:8000端口上)

Note: After version 7.0.x, port 8000 is listening on the address 127.0.0.1 by default, which means that you cannot directly access the Seafile service through port 8000. It is recommended that you configure apache reverse proxy.

Enable Apache reverse proxy module

sudo a2enmod rewrite proxy_http

Enable proxy function

sudo a2enmod rewrite proxy_http

Add firewall rules

sudo ufw allow 8000
sudo ufw allow 8082

Modify proxy configuration

cd /etc/apache2/sites-enabled
sudo cp 000-default.conf 000-default.conf.bak
sudo vim 000-default.conf

Modify as follows:

<VirtualHost *:80>
  # ServerName www.myseafile.com 
  ServerAdmin webmaster@localhost
  DocumentRoot /var/www/html
  Alias /media  /home/demo/haiwen/seafile-server-latest/seahub/media
  RewriteEngine On

  <Location /media>
   Require all granted
  </Location>

  #
  # seafile fileserver
  #
  ProxyPass /seafhttp http://127.0.0.1:8082
  ProxyPassReverse /seafhttp http://127.0.0.1:8082
  RewriteRule ^/seafhttp - [QSA,L]

  #
  # seahub
  #
  SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
  ProxyPass / http://127.0.0.1:8000/
  ProxyPassReverse / http://127.0.0.1:8000/
  
  ErrorLog ${APACHE_LOG_DIR}/error.log
  CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

Restart the apache service after modification

sudo /etc/init.d/apache2 restart

At this point, you can log in to Seafile on the web.
Congratulations! Now you have successfully installed the Seafile server.
If you do not want to run Seahub on the default port 8000, but want to run on a custom port (such as 8001), please follow the steps below:
6.3.0 and later In this version, we abandoned the ./seahub.sh start method to make the seahub process listen on other ports. However, you can specify the seahub startup port by modifying the port setting in conf/gunicorn.conf.
Modify conf/gunicorn.conf

#default localhost:8000
bind = "0.0.0.0:8001"

Restart the Seafile server

./seafile.sh start # 启动 Seafile 服务
./seahub.sh start # 启动 Seahub 网站

If you encounter problems that cannot be solved during the deployment process, such as online documents, full-text search, clustering, etc., you can communicate in private messages! !

Guess you like

Origin blog.csdn.net/wlc_1111/article/details/107086627