wiki:seafile
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| Beide Seiten der vorigen RevisionVorhergehende ÜberarbeitungNächste Überarbeitung | Vorhergehende Überarbeitung | ||
| wiki:seafile [2022/08/21 01:08] – Externe Bearbeitung 127.0.0.1 | wiki:seafile [2022/08/22 18:10] (aktuell) – mho | ||
|---|---|---|---|
| Zeile 1: | Zeile 1: | ||
| + | < | ||
| apt update && apt install mariadb-server mariadb-client | apt update && apt install mariadb-server mariadb-client | ||
| + | </ | ||
| mysql_secure_installation | mysql_secure_installation | ||
| Zeile 10: | Zeile 11: | ||
| Reload privilege tables now? [Y/n] y | Reload privilege tables now? [Y/n] y | ||
| + | < | ||
| mysql -u root -p | mysql -u root -p | ||
| - | CREATE USER 'mycloud' | + | CREATE USER 'seafile' |
| CREATE DATABASE ccnet_server; | CREATE DATABASE ccnet_server; | ||
| CREATE DATABASE seafile_server; | CREATE DATABASE seafile_server; | ||
| CREATE DATABASE seahub_server; | CREATE DATABASE seahub_server; | ||
| - | GRANT ALL ON seafile_server.* TO 'mycloud' | + | GRANT ALL ON seafile_server.* TO 'seafile' |
| - | GRANT ALL ON ccnet_server.* TO 'mycloud' | + | GRANT ALL ON ccnet_server.* TO 'seafile' |
| - | GRANT ALL ON seahub_server.* TO 'mycloud' | + | GRANT ALL ON seahub_server.* TO 'seafile' |
| quit; | quit; | ||
| Zeile 41: | Zeile 42: | ||
| bash setup-seafile-mysql.sh | bash setup-seafile-mysql.sh | ||
| + | </ | ||
| [ server name ] Seafile | [ server name ] Seafile | ||
| - | [ This server' | + | [ This server' |
| - | [ default "/ | + | [ default "/ |
| [ default " | [ default " | ||
| [2] Use existing ccnet/ | [2] Use existing ccnet/ | ||
| - | [ mysql user for seafile ] mycloud | + | [ mysql user for seafile ] seafile |
| [ ccnet database ] ccnet_server | [ ccnet database ] ccnet_server | ||
| Zeile 56: | Zeile 57: | ||
| [ seahub database ] seahub_server | [ seahub database ] seahub_server | ||
| + | < | ||
| echo " | echo " | ||
| echo " | echo " | ||
| echo " | echo " | ||
| source ~/.bashrc | source ~/.bashrc | ||
| + | </ | ||
| Configuring the Apache Web Server | Configuring the Apache Web Server | ||
| Zeile 67: | Zeile 68: | ||
| To begin forwarding requests, you will need to enable the proxy_http module in the Apache configuration. This module provides features for proxying HTTP and HTTPS requests. The following command will enable the module: | To begin forwarding requests, you will need to enable the proxy_http module in the Apache configuration. This module provides features for proxying HTTP and HTTPS requests. The following command will enable the module: | ||
| + | < | ||
| sudo a2enmod proxy_http | sudo a2enmod proxy_http | ||
| + | </ | ||
| Note: The Apache rewrite and ssl modules are also required for this setup. You have already enabled these modules as part of configuring Let’s Encrypt in the second Apache tutorial listed in the prerequisites section. | Note: The Apache rewrite and ssl modules are also required for this setup. You have already enabled these modules as part of configuring Let’s Encrypt in the second Apache tutorial listed in the prerequisites section. | ||
| Zeile 75: | Zeile 76: | ||
| Open the configuration file in a text editor: | Open the configuration file in a text editor: | ||
| + | < | ||
| sudo nano / | sudo nano / | ||
| + | </ | ||
| The lines from ServerAdmin to SSLCertificateKeyFile are part of the initial Apache and Let’s Encrypt configuration that you set up in the prerequisite tutorials. Add the highlighted content, beginning at Alias and ending with the ProxyPassReverse directive: | The lines from ServerAdmin to SSLCertificateKeyFile are part of the initial Apache and Let’s Encrypt configuration that you set up in the prerequisite tutorials. Add the highlighted content, beginning at Alias and ending with the ProxyPassReverse directive: | ||
| / | / | ||
| + | < | ||
| < | < | ||
| < | < | ||
| Zeile 95: | Zeile 96: | ||
| SSLCertificateKeyFile / | SSLCertificateKeyFile / | ||
| - | Alias / | + | Alias / |
| < | < | ||
| Require all granted | Require all granted | ||
| Zeile 112: | Zeile 113: | ||
| </ | </ | ||
| </ | </ | ||
| + | </ | ||
| The Alias directive maps the URL path your_domain/ | The Alias directive maps the URL path your_domain/ | ||
| Zeile 132: | Zeile 133: | ||
| Open ccnet.conf in a text editor: | Open ccnet.conf in a text editor: | ||
| - | nano /home/sammy/ | + | nano /home/< |
| Near the top of the file, within the [General] block, is the SERVICE_URL directive. It will look like this: | Near the top of the file, within the [General] block, is the SERVICE_URL directive. It will look like this: | ||
| - | Update /home/sammy/ | + | Update /home/< |
| . . . | . . . | ||
| Zeile 166: | Zeile 167: | ||
| Now you can start the Seafile service and the Seahub interface: | Now you can start the Seafile service and the Seahub interface: | ||
| - | cd / | + | cd / |
| ./ | ./ | ||
| ./seahub.sh start | ./seahub.sh start | ||
| Zeile 193: | Zeile 194: | ||
| Login screen of the Seafile web interface | Login screen of the Seafile web interface | ||
| - | Once logged in successfully, | + | Once logged in successfully, |
| Now that you have verified the web interface is working correctly, you can enable these services to start automatically at system boot in the next step. | Now that you have verified the web interface is working correctly, you can enable these services to start automatically at system boot in the next step. | ||
| Zeile 211: | Zeile 212: | ||
| After=network.target mysql.service | After=network.target mysql.service | ||
| + | < | ||
| [Service] | [Service] | ||
| Type=forking | Type=forking | ||
| - | ExecStart=/ | + | ExecStart=/ |
| - | ExecStop=/ | + | ExecStop=/ |
| - | User=sammy | + | User=< |
| - | Group=sammy | + | Group=< |
| [Install] | [Install] | ||
| WantedBy=multi-user.target | WantedBy=multi-user.target | ||
| + | </ | ||
| Here, the ExectStart and ExecStop lines indicate the commands that run to start and stop the Seafile service. The service will run with sammy as the User and Group. The After line specifies that the Seafile service will start after the networking and MariaDB service has started. | Here, the ExectStart and ExecStop lines indicate the commands that run to start and stop the Seafile service. The service will run with sammy as the User and Group. The After line specifies that the Seafile service will start after the networking and MariaDB service has started. | ||
| Zeile 226: | Zeile 228: | ||
| Create a systemd service file for the Seahub web interface: | Create a systemd service file for the Seahub web interface: | ||
| + | < | ||
| sudo nano / | sudo nano / | ||
| + | </ | ||
| This is similar to the Seafile service. The only difference is that the web interface is started after the Seafile service. Add the following content to this file: | This is similar to the Seafile service. The only difference is that the web interface is started after the Seafile service. Add the following content to this file: | ||
| + | < | ||
| Create / | Create / | ||
| Zeile 238: | Zeile 241: | ||
| [Service] | [Service] | ||
| Type=forking | Type=forking | ||
| - | ExecStart=/ | + | ExecStart=/ |
| - | ExecStop=/ | + | ExecStop=/ |
| - | User=sammy | + | User=< |
| - | Group=sammy | + | Group=< |
| [Install] | [Install] | ||
| WantedBy=multi-user.target | WantedBy=multi-user.target | ||
| + | </ | ||
| Save seahub.service and exit. | Save seahub.service and exit. | ||
| Zeile 251: | Zeile 254: | ||
| Finally, to enable both the Seafile and Seahub services to start automatically at boot, run the following commands: | Finally, to enable both the Seafile and Seahub services to start automatically at boot, run the following commands: | ||
| + | < | ||
| sudo systemctl enable seafile.service | sudo systemctl enable seafile.service | ||
| sudo systemctl enable seahub.service | sudo systemctl enable seahub.service | ||
| + | </ | ||
| When the server is rebooted, Seafile will start automatically. | When the server is rebooted, Seafile will start automatically. | ||
| At this point, you have completed setting up the server, and can now test each of the services. | At this point, you have completed setting up the server, and can now test each of the services. | ||
| - | Step 7 — Testing File Syncing and Sharing Functionality | + | |
| + | ***** Testing File Syncing and Sharing Functionality | ||
| In this step, you will test the file synchronization and sharing functionality of the server you have set up and ensure they are working correctly. To do this, you will need to install the Seafile client program on a separate computer and/or a mobile device. | In this step, you will test the file synchronization and sharing functionality of the server you have set up and ensure they are working correctly. To do this, you will need to install the Seafile client program on a separate computer and/or a mobile device. | ||
| Zeile 284: | Zeile 288: | ||
| Click on Share next to the file to generate a download link for this file that you can share. | Click on Share next to the file to generate a download link for this file that you can share. | ||
| - | You have verified that the file synchronization is working correctly and that you can use Seafile to sync and share files and folders from multiple devices. | + | Enabling HTTPS with Apache¶ |
| - | Conclusion | + | |
| - | In this tutorial you set up a private instance | + | After completing the installation |
| - | When a new release of the server is available, please consult | + | HTTPS requires |
| + | A second requirement is a reverse proxy supporting SSL. Apache, a popular web server and reverse proxy, is a good option. The full documentation of Apache is available at https:// | ||
| + | The recommended reverse proxy is Nginx. You find instructions for enabling HTTPS with Nginx here. | ||
| + | Setup¶ | ||
| + | The setup of Seafile using Apache as a reverse proxy with HTTPS is demonstrated using the sample host name seafile.example.com. | ||
| + | This manual assumes the following requirements: | ||
| + | Seafile Server Community Edition/ | ||
| + | A host name points at the IP address of the server and the server is available on port 80 and 443 | ||
| + | If your setup differs from thes requirements, | ||
| + | The setup proceeds in two steps: First, Apache is installed. Second, a SSL certificate is integrated in the Apache configuration. | ||
| + | Installing Apache¶ | ||
| + | Install and enable apache modules: | ||
| + | < | ||
| + | sudo a2enmod rewrite | ||
| + | sudo a2enmod proxy_http | ||
| + | </ | ||
| + | Important: Due to the security advisory published by Django team, we recommend to disable GZip compression to mitigate BREACH attack. No version earlier than Apache 2.4 should be used. | ||
| + | Configuring Apache¶ | ||
| + | |||
| + | Modify Apache config file. For CentOS, this is vhost.conf. For Debian/ | ||
| + | < | ||
| + | < | ||
| + | ServerName seafile.example.com | ||
| + | # Use " | ||
| + | # Use " | ||
| + | DocumentRoot /var/www | ||
| + | Alias / | ||
| + | |||
| + | AllowEncodedSlashes On | ||
| + | |||
| + | RewriteEngine On | ||
| + | |||
| + | < | ||
| + | Require all granted | ||
| + | </ | ||
| + | |||
| + | # | ||
| + | # seafile fileserver | ||
| + | # | ||
| + | ProxyPass /seafhttp http:// | ||
| + | ProxyPassReverse /seafhttp http:// | ||
| + | RewriteRule ^/seafhttp - [QSA,L] | ||
| + | |||
| + | # | ||
| + | # seahub | ||
| + | # | ||
| + | SetEnvIf Authorization " | ||
| + | ProxyPreserveHost On | ||
| + | ProxyPass / http:// | ||
| + | ProxyPassReverse / http:// | ||
| + | </ | ||
| + | </ | ||
| + | Getting a Let's Encrypt certificate¶ | ||
| + | |||
| + | Getting a Let's Encrypt certificate is straightforward thanks to Certbot. Certbot is a free, open source software tool for requesting, receiving, and renewing Let's Encrypt certificates. | ||
| + | |||
| + | First, go to the Certbot website and choose your web server and OS. | ||
| + | Second, follow the detailed instructions then shown. | ||
| + | |||
| + | We recommend that you get just a certificate and that you modify the Apache configuration yourself: | ||
| + | < | ||
| + | sudo certbot --apache certonly | ||
| + | </ | ||
| + | Follow the instructions on the screen. | ||
| + | |||
| + | Upon successful verification, | ||
| + | Adjusting Apache configuration¶ | ||
| + | |||
| + | To use HTTPS, you need to enable mod_ssl: | ||
| + | < | ||
| + | sudo a2enmod ssl | ||
| + | </ | ||
| + | Then modify your Apache configuration file. Here is a sample: | ||
| + | < | ||
| + | < | ||
| + | ServerName seafile.example.com | ||
| + | DocumentRoot /var/www | ||
| + | |||
| + | SSLEngine On | ||
| + | SSLCertificateFile / | ||
| + | SSLCertificateKeyFile / | ||
| + | |||
| + | Alias / | ||
| + | |||
| + | < | ||
| + | Require all granted | ||
| + | </ | ||
| + | |||
| + | RewriteEngine On | ||
| + | |||
| + | # | ||
| + | # seafile fileserver | ||
| + | # | ||
| + | ProxyPass /seafhttp http:// | ||
| + | ProxyPassReverse /seafhttp http:// | ||
| + | RewriteRule ^/seafhttp - [QSA,L] | ||
| + | |||
| + | # | ||
| + | # seahub | ||
| + | # | ||
| + | SetEnvIf Authorization " | ||
| + | ProxyPreserveHost On | ||
| + | ProxyPass / http:// | ||
| + | ProxyPassReverse / http:// | ||
| + | </ | ||
| + | </ | ||
| + | Finally, make sure the virtual host file does not contain syntax errors and restart Apache for the configuration changes to take effect: | ||
| + | < | ||
| + | sudo service apache2 restart | ||
| + | </ | ||
| + | Modifying ccnet.conf¶ | ||
| + | The SERVICE_URL in ccnet.conf informs Seafile about the chosen domain, protocol and port. Change the SERVICE_URLso as to account for the switch from HTTP to HTTPS and to correspond to your host name (the http://must not be removed): | ||
| + | SERVICE_URL = https:// | ||
| + | Note: TheSERVICE_URL can also be modified in Seahub via System Admininstration > Settings. If SERVICE_URL is configured via System Admin and in ccnet.conf, the value in System Admin will take precedence. | ||
| + | Modifying seahub_settings.py¶ | ||
| + | The FILE_SERVER_ROOT in seahub_settings.py informs Seafile about the location of and the protocol used by the file server. Change the FILE_SERVER_ROOTso as to account for the switch from HTTP to HTTPS and to correspond to your host name (the trailing /seafhttp must not be removed): | ||
| + | FILE_SERVER_ROOT = ' | ||
| + | Note: TheFILE_SERVER_ROOT can also be modified in Seahub via System Admininstration > Settings. If FILE_SERVER_ROOT is configured via System Admin and in seahub_settings.py, | ||
| + | Modifying seafile.conf (optional)¶ | ||
| + | To improve security, the file server should only be accessible via Apache. | ||
| + | Add the following line in the [fileserver] block on seafile.conf in / | ||
| + | < | ||
| + | host = 127.0.0.1 | ||
| + | </ | ||
| + | After his change, the file server only accepts requests from Apache. | ||
| + | Starting Seafile and Seahub¶ | ||
| + | Restart the seaf-server and Seahub for the config changes to take effect: | ||
| + | < | ||
| + | su seafile | ||
| + | cd / | ||
| + | ./ | ||
| + | ./seahub.sh restart | ||
| + | </ | ||
wiki/seafile.1661036905.txt.gz · Zuletzt geändert: 2022/08/21 01:08 von 127.0.0.1