Compare commits

...

157 Commits
v5.0 ... master

Author SHA1 Message Date
Daniel Pan ec8775bae1
Update README.md 2024-06-06 14:40:22 +08:00
Daniel Pan d742554a31
Merge pull request #113 from haiwen/rm-unused-settings
rm CLOUD_MODE and COMPRESS_CACHE_BACKEND
2024-05-16 15:14:59 +08:00
lian 8eb1b22aeb rm CLOUD_MODE and COMPRESS_CACHE_BACKEND 2024-05-16 15:03:52 +08:00
Daniel Pan aea4c53fe4
Merge pull request #112 from haiwen/pillow-10.2.-
pillow 10.2.*
2024-02-04 16:37:51 +08:00
skywalker 192410e065 pillow 10.2.* 2024-02-04 15:11:33 +08:00
Daniel Pan 091dafef4a
Merge pull request #111 from haiwen/10.0-captcah-version
10.0 captcah version
2024-02-04 11:32:45 +08:00
skywalker 459837caa9 10.0 captcah version 2024-02-02 17:37:21 +08:00
Daniel Pan 48b9c7685b
Merge pull request #110 from haiwen/update-captcha-version
update captcha version
2024-01-30 17:46:48 +08:00
skywalker 68f84f53cc update captcha version 2024-01-30 14:52:18 +08:00
skywalker 0723c19f61 django==4.2.* 2024-01-11 16:50:05 +08:00
Daniel Pan 9f8e36afec
Merge pull request #109 from haiwen/nginx-http_host
nginx http_host
2023-12-13 14:49:39 +08:00
skywalker 7d43a9ee3b nginx http_host 2023-12-13 11:57:32 +08:00
skywalker beca5368cb add dnsutils 2023-11-17 18:17:46 +08:00
skywalker 7f1b557911 fix pillow version 2023-11-15 17:59:18 +08:00
skywalker e45257c7c1 fix nginx error log 2023-11-15 17:16:41 +08:00
Daniel Pan 8cd221d0ce
Merge pull request #108 from haiwen/nginx-logs-seafileformat
nginx-logs seafileformat
2023-11-01 11:48:06 +08:00
skywalker 9a0eb564c5 nginx-logs seafileformat 2023-11-01 11:41:16 +08:00
skywalker 185f2d13ac python-ldap==3.4.3 2023-10-24 10:42:51 +08:00
欢乐马 b45b411311
Merge pull request #107 from haiwen/pillow-10.0.-
pillow==10.0.*
2023-10-09 03:30:10 -05:00
skywalker 8f8dc44a4d pillow==10.0.* 2023-10-09 16:21:15 +08:00
Daniel Pan 57990f8561
Merge pull request #106 from haiwen/seafile-11.0_ubuntu
Seafile 11.0 ubuntu
2023-08-29 16:24:41 +08:00
skywalker 2777664be3 fix ubuntu version 2023-08-29 16:20:04 +08:00
skywalker 669f989b2b rm libreoffice 2023-08-29 15:00:08 +08:00
skywalker ec9eaf1542 mariadb-server-10.6 2023-08-29 14:47:23 +08:00
skywalker 0b6d0f93d4 seafevents.conf 2023-08-29 10:30:12 +08:00
skywalker fa1e2c7922 seafile-11.0_ubuntu 2023-08-28 16:54:46 +08:00
Daniel Pan 582235733f
Merge pull request #105 from mainboarder/mb-mail
Corrected mailadress
2023-08-26 09:02:49 +08:00
Robin Kloppe aac69d4ba1 Corrected mailadress 2023-08-25 22:30:25 +02:00
Daniel Pan ccacbded6e
Merge pull request #104 from haiwen/seafile10-cffi
seafile10-cffi
2023-03-09 15:53:34 +08:00
skywalker c2ce8b685f seafile10-cffi 2023-03-09 15:39:46 +08:00
欢乐马 97cbea2a41
Merge pull request #101 from haiwen/seafile10-rm-openjdk-8-jre
seafile10 rm openjdk-8-jre
2023-02-23 14:42:15 +08:00
skywalker 67bae644ca seafile10 rm openjdk-8-jre 2023-02-23 14:35:54 +08:00
skywalker 36703b142a fix notification-server nginx conf 2023-02-21 17:19:19 +08:00
skywalker c01f7c2cf8 fix 10.0 nginx conf 2023-02-21 10:46:03 +08:00
Daniel Pan 9fd00e5a0f
Merge pull request #100 from haiwen/seafile10
seafile10
2023-02-13 11:50:01 +08:00
skywalker eef6314471 seafile10 2023-02-10 18:11:08 +08:00
Daniel Pan d28068f662
Merge pull request #98 from mainboarder/patch-1
domain.com -> example.com
2022-11-11 15:39:07 +08:00
mainboarder 65e2ed4ab1
domain.com -> example.com
https://www.iana.org/domains/reserved
2022-10-13 16:13:07 +02:00
lian f1259f1a1a
Update seafile-9.0_ubuntu 2022-08-10 13:57:55 +08:00
Daniel Pan cc52eef96f
Merge pull request #95 from haiwen/markupsafe-2.0.1
markupsafe==2.0.1
2022-05-10 22:31:04 +08:00
skywalker 75c7b2d15f markupsafe==2.0.1 2022-05-10 17:45:58 +08:00
lian 8298cb1239
Update seafile-9.0_ubuntu 2021-12-15 18:20:07 +08:00
lian aa2f62fd2f add pycryptodome installation to seafile-9.0_ubuntu 2021-12-10 11:03:53 +08:00
Daniel Pan ac3bea4035
Merge pull request #93 from haiwen/seafile-9.0-ubuntu
add seafile-9.0_ubuntu
2021-11-10 17:25:57 +08:00
lian 33b7e50be6 add seafile-9.0_ubuntu 2021-11-10 16:04:14 +08:00
Daniel Pan 756aebc62a
Merge pull request #92 from haiwen/update
update
2021-08-25 18:12:19 +08:00
lian cc0b624944 update 2021-08-25 17:58:27 +08:00
lian ad00df1edb
sqlalchemy==1.4.3 2021-04-12 16:10:10 +08:00
lian 1cef223041
sqlalchemy==1.4.3 2021-04-12 16:10:04 +08:00
Daniel Pan 4cfd2be422
Merge pull request #90 from haiwen/repair-sqlalchemy-version
repair sqlalchemy version
2021-03-29 17:50:08 +08:00
王健辉 d6f116a99b repair sqlalchemy version 2021-03-29 17:19:38 +08:00
Daniel Pan e45aed5eea
Merge pull request #89 from haiwen/update-seafile-8.0
update seafile 8.0
2021-03-01 17:26:39 +08:00
skywalker c6a92ee696 update seafile 8.0 2021-03-01 17:14:14 +08:00
Daniel Pan 7be1e5dcb4
Merge pull request #87 from haiwen/fix-7.1-gcc
fix centos7.1 gcc
2021-01-21 10:19:08 +08:00
skywalker 7385be14fb fix centos7.1 gcc 2021-01-21 10:15:28 +08:00
Daniel Pan 9cde46455b
Merge pull request #86 from haiwen/seafile-8.0-pro
seafile-server-8.0-ubuntu-amd64-http
2020-11-25 14:29:53 +08:00
skywalker 727098d07d fix seafile-server-8.0-ubuntu-amd64-http 2020-11-25 11:07:07 +08:00
skywalker d14454c39e seafile-server-8.0-centos-amd64-http 2020-11-23 10:32:36 +08:00
skywalker cdcee17360 seafile-server-8.0-ubuntu-amd64-http 2020-11-20 15:17:03 +08:00
Daniel Pan c385537ff4
Merge pull request #80 from haiwen/fix_centos_es
pkill -9 -u seafile for es
2020-04-03 15:14:01 +08:00
sniper-py 28786f86ac pkill -9 -u seafile for es 2020-04-03 14:16:20 +08:00
Daniel Pan f2e3156c32
Merge pull request #79 from haiwen/fix_sh_run_user
su - seafile -c
2020-03-30 17:40:39 +08:00
sniper-py e14b10fa4b su - seafile -c 2020-03-30 10:38:57 +08:00
Daniel Pan 1d1bd19fd6
Merge pull request #78 from haiwen/fix_es_log_prem
fix es log perm ubuntu
2020-03-28 15:32:16 +08:00
sniper-py 5d2738abc1 kill all process 2020-03-28 11:36:13 +08:00
sniper-py f30d6f27bb fix perm for seafile.sh start 2020-03-27 17:50:14 +08:00
Daniel Pan ae6d8f8a90
Merge pull request #76 from haiwen/start-mariadb
start mariadb
2020-03-19 20:16:38 +08:00
王健辉 d550a45734 start mariadb 2020-03-19 18:46:21 +08:00
Daniel Pan ac38e2e254
Merge pull request #74 from haiwen/remove-django-compressor
remove django-compressor
2019-12-25 10:31:00 +08:00
Hulk 12af02bb77 remove django-compressor 2019-12-25 10:28:00 +08:00
Daniel Pan d84a6d6705
Merge pull request #73 from haiwen/seafile-7.1
for deploy the seafile 7.1
2019-12-24 16:46:35 +08:00
Hulk 638d20e983 for deploy the seafile 7.1 2019-12-24 16:26:24 +08:00
Daniel Pan 452b407257
Merge pull request #72 from haiwen/for-seafile-7.1
For seafile 7.1
2019-12-04 21:07:08 +08:00
Hulk c0319b8828 fix the filename for ubuntu script 2019-12-04 16:37:55 +08:00
Hulk a71c92f648 for seafile-7.1 2019-12-04 16:29:26 +08:00
Jiaqiang Xu d725c5277c
Merge pull request #69 from haiwen/set-request-buffering-on
remove          proxy_request_buffering    off;
2019-11-21 14:09:50 +08:00
Hulk 8cb37a0dab remove proxy_request_buffering off; 2019-11-21 14:07:25 +08:00
Daniel Pan a48cf01871
Merge pull request #65 from haiwen/nginx-logformate
fix nginx logformat
2019-06-14 14:01:42 +08:00
Hulk ed238db4d0 fix nginx logformat 2019-06-14 13:59:00 +08:00
Daniel Pan bfa7f39fe1
Merge pull request #64 from haiwen/for-pro-7.0.2
For pro 7.0.2
2019-06-13 15:54:28 +08:00
Hulk c0b57e5409 update the install scripts. 2019-06-13 15:50:28 +08:00
Hulk a592f51132 update the install scripts. 2019-06-13 15:37:05 +08:00
Daniel Pan a5bf55d221
Merge pull request #63 from haiwen/fix-no-directory
fix the 'no /tmp/seafile-office-output/ file or directory'
2019-06-06 11:27:06 +08:00
Hulk a5dbb80f58 fix the 'no /tmp/seafile-office-output/ file or directory' 2019-06-06 11:16:25 +08:00
Daniel Pan c233b1c3fc
Merge pull request #61 from haiwen/for-pro-7
for pro-7.0.0
2019-05-17 16:42:07 +08:00
Hulk 11830e8bba for pro-7.0.0 2019-05-17 16:31:34 +08:00
Daniel Pan 3ab63f30e7
Merge pull request #59 from haiwen/fix-firewalld-reload
Fix script exit caused by firewalld not running under CentOS7.
2019-02-18 11:29:22 +08:00
Hulk 0b45ed2adf Fix script exit caused by firewalld not running under CentOS7. 2019-02-18 11:25:18 +08:00
Daniel Pan ed0c575530
Merge pull request #57 from haiwen/suport-ubuntu-18
suport the ubuntu 18.04
2019-02-13 15:48:57 +08:00
Hulk ada95ccbef suport the ubuntu 18.04 2019-02-13 15:37:49 +08:00
Daniel Pan 3e212eeb3e
Merge pull request #55 from haiwen/proxy_request_buffering_off
add the 'proxy_request_buffering off;' to nginx's conf.
2018-12-20 18:08:26 +08:00
Hulk 2cc49a3536 add the 'proxy_request_buffering off;' to nginx's conf. 2018-12-20 18:06:52 +08:00
Daniel Pan b4193fa48a
Merge pull request #54 from haiwen/suport_psd
suport the psd onlineview
2018-12-20 15:22:03 +08:00
Hulk 592aff262d suport the psd onlineview 2018-12-10 11:36:39 +08:00
Daniel Pan 480b2d77f4
Merge pull request #53 from haiwen/mem_and_pillow
start memcached and avoid pip timeout error
2018-08-17 11:04:18 +08:00
Hulk 3a012a4fa6 start memcached and avoid pip timeout error 2018-08-17 10:49:45 +08:00
Hulk d7561439f9 the enable defualt is true in seafevents.conf (#50) 2018-08-02 12:11:45 +08:00
Daniel Pan e8ef774861
Merge pull request #49 from haiwen/add_scheme_nginx
add the nginx proxy_header $scheme; the scheme is "http" or "https"
2018-08-02 11:26:35 +08:00
renfeipeng df6f38cf4b add the nginx proxy_header $scheme; the scheme is "http" or "https" 2018-08-02 11:21:57 +08:00
Hulk 219b9ec829 use 'locmem' for cache_backend (#48) 2018-07-09 12:03:43 +08:00
zheng xie bc8c40b1ff
Use Pillow v4.3 instead of python-imaging (#47) 2018-07-09 10:41:32 +08:00
Jiaqiang Xu 48006381dd
Merge pull request #42 from haiwen/http_set_header
add proxy_set_header X-Forwarded-For
2018-04-24 18:07:41 +08:00
renfeipeng cf67bbe7e5 add proxy_set_header X-Forwarded-For 2018-04-23 11:24:16 +08:00
zhengxie 66f27170f3 Revert "Pillow v4.3 (#37)"
This reverts commit ff85f63c8b.
2018-02-05 14:11:10 +08:00
renfeipeng ff85f63c8b Pillow v4.3 (#37)
* Remove python-imaging, use pillow==4.3.0

* modified centos installer
2018-02-03 11:26:49 +08:00
renfeipeng 2a594e5781 memcahed of config modified to pylibmc. (#36)
* memcahed of config modified to pylibmc.

* delete python-memcached

* modified ubuntu installer
2018-02-02 11:41:08 +08:00
Daniel Pan c53e332058
Merge pull request #35 from haiwen/wsgi_proxy_port
Revert "update the nginx_conf of proxy_set_header $server_port"
2017-12-14 17:11:12 +08:00
renfeipeng 4e7f8ca3b7 Revert "update the nginx_conf of proxy_set_header $server_port"
This reverts commit fd9f2d88c3.
2017-12-14 17:03:14 +08:00
Daniel Pan 4e8e73e614
Merge pull request #34 from haiwen/wsgi_proxy_port
update the nginx_conf of proxy_set_header $server_port
2017-12-13 17:30:25 +08:00
renfeipeng fd9f2d88c3 update the nginx_conf of proxy_set_header $server_port 2017-12-13 17:13:58 +08:00
lian e7b1d8fdf8
Merge pull request #32 from haiwen/WSGI_nginx_deploy
nginx from fastcgi to wsgi
2017-11-25 10:39:44 +08:00
renfeipeng ecca90ba11 nginx from fastcgi to wsgi 2017-11-17 17:56:33 +08:00
Daniel Pan a3bd3abc6c Merge pull request #31 from haiwen/update-msg
update message
2017-09-15 11:17:56 +08:00
lian b672ebaa7e update message 2017-09-15 11:13:46 +08:00
Daniel Pan 1c46bc566b Merge pull request #29 from clovertrail/downloadissue
fix the issue of failing to download pkg
2017-07-26 17:20:48 +08:00
Hongjiang Zhang f2726fc541 fix the issue of failing to download pkg 2017-07-26 16:48:55 +08:00
Daniel Pan 2f8d07d238 Merge pull request #28 from haiwen/revert-pillow
Revert "pip install --upgrade Pillow"
2017-06-30 18:46:46 +08:00
lian b95d1b67d5 Revert "pip install --upgrade Pillow"
This reverts commit 9303aa91fb.
2017-06-30 18:45:43 +08:00
Daniel Pan bbdac4875c Merge pull request #25 from haiwen/pillow
pip install --upgrade Pillow
2017-06-13 16:15:37 +08:00
lian 9303aa91fb pip install --upgrade Pillow 2017-06-13 15:56:42 +08:00
Daniel Pan 800e65c5ee Merge pull request #24 from haiwen/remote-addr
add `REMOTE_ADDR` to conf file of nginx
2017-06-13 11:58:18 +08:00
lian 4959775531 add `REMOTE_ADDR` to conf file of nginx 2017-06-13 11:54:06 +08:00
Daniel Pan c932290909 Merge pull request #23 from haiwen/mysql-password
update
2017-06-06 17:45:58 +08:00
lian 00a982da0b update
read mysql password from `.my.cnf` if the file already exists
2017-06-06 17:36:47 +08:00
Daniel Pan e3fd8969a4 Merge pull request #22 from haiwen/update-install-cn
delete some about ubuntu 14.04 on README
2017-06-05 15:27:27 +08:00
hulk d7fae50c2b delete some about ubuntu 14.04 on README 2017-06-05 15:11:54 +08:00
zhengxie 2b556eb7b7 Use 127.0.0.1 instead of `hostname` to avoid errors on some systems 2017-05-03 10:36:48 +08:00
zhengxie 065c50c8e9 Add sleep while create init admin user 2016-12-26 15:48:29 +08:00
zhengxie b4498eec67 No need to acquire the hostname. 2016-12-15 16:43:37 +08:00
xiez 143155ddc2 Merge pull request #18 from haiwen/update-readme
update readme.md
2016-11-08 13:03:53 +08:00
lian 76691fe637 update readme.md 2016-11-08 11:13:20 +08:00
zhengxie edcb4c7edf Update contacts 2016-11-07 10:49:59 +08:00
zhengxie 76c7f6c1f5 Update typos in 1604 2016-11-04 17:55:52 +08:00
Daniel Pan 0f4874b291 Merge pull request #17 from haiwen/requests
add python-requests when install requirements
2016-10-25 13:44:01 +08:00
lian a36481599c add python-requests when install requirements 2016-10-25 13:40:37 +08:00
Daniel Pan 88a1efeb15 Merge pull request #16 from haiwen/update
update README.md
2016-09-24 15:06:14 +08:00
lian be36a09f90 update README.md 2016-09-24 15:05:04 +08:00
xiez a356b56af0 Merge pull request #15 from haiwen/1604
Add installer script for ubuntu 16.04
2016-09-24 13:01:41 +08:00
zhengxie 152ef5775c Add installer script for ubuntu 16.04 2016-09-23 17:29:29 +08:00
Daniel Pan 7262683944 Update seafile-server-centos-7-amd64-http 2016-09-12 17:59:38 +08:00
Daniel Pan 928e893b4e Update README.md 2016-09-12 14:40:00 +08:00
Daniel Pan e7dd175b22 Update README.md 2016-09-12 14:38:43 +08:00
zhengxie cbfd2635df Update Dockerfile 2016-08-18 17:43:49 +08:00
zhengxie 5c1fcf4b6f Add travis badge 2016-08-18 17:37:42 +08:00
zhengxie b6954410d9 Add travis-ci tests and Docker file 2016-08-18 17:25:35 +08:00
yejianguo 25fde48ba8 fix db name 2016-07-28 10:28:15 +08:00
Daniel Pan a96050531f Update seafile-server-ubuntu-14-04-amd64-http 2016-06-13 11:56:24 +08:00
yejianguo ace9f05f26 remove USE_PDFJS = True 2016-05-23 12:11:20 +08:00
Daniel Pan 6ac670b50b Merge pull request #13 from haiwen/fix-seahub-setting
comment email configuration and change log location
2016-05-19 15:02:58 +08:00
yejianguo f4284ee6d7 comment email configuration and change log location 2016-05-19 10:40:26 +08:00
Daniel Pan f2962f5224 Merge pull request #12 from haiwen/centos7
add CentOS7 script
2016-05-17 13:45:01 +08:00
yejianguo 8f6fbd284f add CentOS7 script 2016-05-17 12:11:29 +08:00
Daniel Pan 64e8b2230b Update README.md 2016-05-05 15:44:57 +08:00
Daniel Pan 28e98027d3 Update README.md 2015-12-23 16:49:34 +08:00
Daniel Pan 5fcd645f0a Merge pull request #11 from haiwen/migrate
improve for script
2015-12-23 15:13:53 +08:00
yejianguo d6ac764ea5 update readme and remove change address script 2015-12-23 11:48:53 +08:00
Shuai Lin b261284a6a set HOME env (needed in packer) 2015-12-08 20:14:18 +08:00
13 changed files with 2377 additions and 561 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
*.pyc
*~
*#

View File

@ -1,72 +1,67 @@
# Seafile 安装脚本 # Seafile 安装脚本
这里的安装脚本可以帮助您快速的安装好 Seafile 服务器,并配置好 MariaDB, Memcached, WebDAV, Ngnix 和开机自动启动脚本。 > 从 2024 年开始,一键安装脚本不再维护,请使用 Docker 来安装。
一键安装脚本可以帮助您在 Ubuntu 18.04/20.04 系统上快速的安装好 Seafile 服务器,并配置好 MariaDB, Memcached, WebDAV, Ngnix 和开机自动启动脚本。
### 使用步骤 ## 使用步骤
安装干净的 Ubuntu 14.04 系统并切换成 root 账号 (sudo -i)。 安装干净的 Ubuntu 18.04/20.04,并**做好镜像** (如果安装失败需要还原到镜像)。
获取安装脚本 切换成 root 账号 (`sudo -i`)
```
wget https://raw.githubusercontent.com/haiwen/seafile-server-installer-cn/master/seafile-server-ubuntu-14-04-amd64-http ### 获取安装脚本
适用于 Seafile 8.0.x 及以上版本
```sh
wget https://raw.githubusercontent.com/haiwen/seafile-server-installer-cn/master/seafile-8.0_ubuntu
``` ```
运行安装脚本并指定要安装的版本 (5.0.2) ### 运行安装脚本并指定要安装的版本 (例如 8.0.0)
``` ```
bash seafile-server-ubuntu-14-04-amd64-http 5.0.2 bash seafile-8.0_ubuntu 8.0.0
``` ```
脚本会让选择要安装的版本, 按照提示进行选择即可: 脚本会让选择要安装的版本, 按照提示进行选择即可:
* 如果要安装专业版, 需要先将下载好的专业版的包 `seafile-pro-server_5.0.1_x86-64.tar.gz` 放到 `/opt/` 目录下 * 如果要安装专业版, 需要先将下载好的专业版的包 `seafile-pro-server_8.0.0_x86-64.tar.gz` 放到 `/opt/` 目录下
* 如果是安装开源版,安装脚本在执行过程中会检查**/opt**目录下是否有指定版本号的安装包,如果存在则会安装此包,否则会从 Seafile 网站下载。所以,为了避免因下载失败而导致安装中断,您可以提前下载好安装包放到**/opt/**目录下。 * 如果是安装开源版,安装脚本在执行过程中会检查 `/opt`目录下是否有指定版本号的安装包,如果存在则会安装此包,否则会从 Seafile 网站下载。所以,为了避免因下载失败而导致安装中断,您可以提前下载好安装包放到`/opt/`目录下。
该脚本运行完后会在命令行中打印配置信息和管理员账号密码,请仔细阅读。 该脚本运行完后会在命令行中打印配置信息和管理员账号密码,请仔细阅读。(您也可以查看安装日志`/opt/seafile/aio_seafile-server.log`)MySQL 的 root 用户密码存储在 `/root/.my.cnf`MySQL 的 seafile 用户密码存储在 `/opt/seafile.my.cnf` 中。
#### 通过 Web UI 对服务器进行配置
### 通过 Web UI 对服务器进行配置
安装完成后,您需要通过 Web UI 服务器进行基本的配置,以便能正常的从网页端进行文件的上传和下载: 安装完成后,您需要通过 Web UI 服务器进行基本的配置,以便能正常的从网页端进行文件的上传和下载:
1. 首先在浏览器中输入服务器的地址,并用管理员账号和初始密码登录 1. 首先在浏览器中输入服务器的地址,并用管理员账号和初始密码登录
2. 点击界面的右上角的工具按钮进入管理员界面
2. 点击界面的右上角的头像按钮进入管理员界面
![工具按钮](http://manual-cn.seafile.com/images/tools-button.png) ![管理员入口](./images/system-admin-entrance.png)
3. 进入设置页面填写正确的服务器对外的 SERVICE_URL 和 FILE_SERVER_ROOT比如 3. 进入设置页面填写正确的服务器对外的 SERVICE_URL 和 FILE_SERVER_ROOT比如
```
SERVICE_URL: http://www.example.com
FILE_SERVER_ROOT: http://www.example.com/seafhttp
```
现在您可以退出管理员界面,并进行基本的测试。关于服务器的配置选项介绍和日常运维可以参考 https://cloud.seafile.com/published/seafile-manual-cn/config/README.md
```
SERVICE_URL: http://www.myseafile.com
FILE_SERVER_ROOT: 'http://www.myseafile.com/seafhttp'
```
现在您可以退出管理员界面,并进行基本的测试。关于服务器的配置选项介绍和日常运维可以参考 http://manual-cn.seafile.com/config/index.html
### 如果安装脚本出错 ### 如果安装脚本出错
如果安装脚本出错,您可以用下列命名来清空重试 (或者重置虚拟机) 如果安装脚本出错,您需要重置虚拟机到干净的镜像。
```
rm -rf /opt/seafile
```
## 启动关闭服务 ### 启动关闭服务
自动安装脚本会在系统中安装开机自动启动脚本。您也可以使用该脚本来关闭/启动 Seafile 服务,命令如下: 自动安装脚本会在系统中安装开机自动启动脚本。您也可以使用该脚本来关闭/启动 Seafile 服务,命令如下:
service seafile-server stop ```
service seafile-server start service seafile-server stop
service seafile-server start
## 其他高级配置 ```
### 备份 mysql
* 拷贝 `db-backup` 目录到 `/opt/seafile`
* 修改 `db-backup/db_backup.sh` 中的 `USER` `PASSWD`
* 执行 `crontab -e` 并添加内容 `0 1 * * * * /opt/seafile/db-backup/db_backup.sh` (每天凌晨100进行备份)
### 配置邮件发送
参考 http://manual-cn.seafile.com/config/sending_email.html

View File

@ -1,3 +0,0 @@
ccnet-db
seafile-db
seahub-db

View File

@ -1,20 +0,0 @@
#!/bin/bash
USER=root
PASSWD=aeneinoi
DATE=`date +%Y%m%d%H%M`
IGN_TAB=""
for ign_tab in `cat table-ignore.txt`;
do
IGN_TAB=${IGN_TAB}" --ignore-table=${ign_tab}"
done
for DATABASE in `cat db-list.txt`;
do
mysqldump -u${USER} -p${PASSWD} --opt $DATABASE ${IGN_TAB} > $DATABASE-$DATE.sql
done
# Compress and clean
tar czvf mysql-back-$DATE.tar.gz *.sql
rm -rf *.sql

View File

@ -1,11 +0,0 @@
seahub-db.avatar_uploaded
seahub-db.avatar_avatar
seahub-db.avatar_groupavatar
seahub-db.Event
seahub-db.FileAudit
seahub-db.FileUpdate
seahub-db.PermAudit
seahub-db.UserEvent
seahub-db.UserTrafficStat
seahub-db.VirusFile
seahub-db.VirusScanRecord

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

549
seafile-10.0_ubuntu Normal file
View File

@ -0,0 +1,549 @@
#!/bin/bash
#
# seafile-server-installer-cn/seafile-10.0_ubuntu
#
# Copyright 2015, Alexander Jackson <alexander.jackson@seafile.de>
# Copyright 2016, Zheng Xie <xie.zheng@seafile.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#
if [[ $HOME == "" ]]; then
export HOME=/root
fi
if [[ $SEAFILE_DEBUG != "" ]]; then
set -x
fi
set -e
if [[ "$#" -ne 1 ]]; then
echo "You must specif Seafile version to install"
echo "Like: $0 10.0.0"
exit 1
fi
clear
cat <<EOF
This script installs the community/professional edition of the Seafile Server on a Ubuntu 18.04/20.04 64bit
- Newest Seafile server version, MariaDB, Memcached, NGINX -
-----------------------------------------------------------------
This installer is meant to run on a freshly installed machine
only. If you run it on a production server things can and
probably will go terribly wrong and you will lose valuable
data!
For questions or suggestions please contact us at
support@seafile.com
-----------------------------------------------------------------
Possible options:
1 = Seafile Community (Free) Edition (CE)
2 = Seafile Professional Edition (PRO)
EOF
if [[ ${SEAFILE_PRO} == "" ]]; then
PS3="Which Seafile version would you like to install? "
select SEAFILE_SERVER_VERSION in CE PRO ABORT; do
case "${SEAFILE_SERVER_VERSION}" in
ABORT)
echo "Aborting"
break
;;
"")
echo "$REPLY: Wrong value. Select 1 or 2."
;;
*)
if [[ ${SEAFILE_SERVER_VERSION} = "PRO" ]]; then
SEAFILE_PRO=1
else
SEAFILE_PRO=0
fi
break
esac
done
fi
is_pro() {
if [[ "$SEAFILE_PRO" == "1" ]]; then
return 0
else
return 1
fi
}
echo
if is_pro; then
echo "This script will install Seafile Professional Edition for you."
else
echo "This script will install Seafile Community Edition for you."
fi
echo
# -------------------------------------------
# Vars
# -------------------------------------------
SEAFILE_ADMIN=admin@seafile.local
SEAFILE_SERVER_USER=seafile
SEAFILE_SERVER_HOME=/opt/seafile
IP_OR_DOMAIN=127.0.0.1
SEAFILE_VERSION=$1
TIME_ZONE=Asia/Shanghai
if is_pro; then
SEAFILE_SERVER_PACKAGE=seafile-pro-server_${SEAFILE_VERSION}_x86-64.tar.gz
if [[ ! -e /opt/$SEAFILE_SERVER_PACKAGE ]]; then
echo
echo "You must download \"$SEAFILE_SERVER_PACKAGE\" to the /opt/ folder before running this script!"
echo
exit 1
fi
INSTALLPATH=${SEAFILE_SERVER_HOME}/seafile-pro-server-${SEAFILE_VERSION}/
else
SEAFILE_SERVER_PACKAGE=seafile-server_${SEAFILE_VERSION}_x86-64.tar.gz
SEAFILE_SERVER_PACKAGE_URL=http://seafile-downloads.oss-cn-shanghai.aliyuncs.com/${SEAFILE_SERVER_PACKAGE}
INSTALLPATH=${SEAFILE_SERVER_HOME}/seafile-server-${SEAFILE_VERSION}/
fi
# -------------------------------------------
# Ensure we are running the installer as root
# -------------------------------------------
if [[ $EUID -ne 0 ]]; then
echo " Aborting because you are not root" ; exit 1
fi
# -------------------------------------------
# Abort if directory SEAFILE_SERVER_HOME exists
# -------------------------------------------
if [[ -d "${SEAFILE_SERVER_HOME}" ]] ;
then
echo " Aborting because directory ${SEAFILE_SERVER_HOME} already exist" ; exit 1
fi
# -------------------------------------------
# Abort if seafile user exists
# -------------------------------------------
if getent passwd ${SEAFILE_SERVER_USER} > /dev/null 2>&1 ;
then
echo "Aborting because user ${SEAFILE_SERVER_USER} already exist" ; exit 1
fi
# -------------------------------------------
# Additional requirements
# -------------------------------------------
apt-get update
apt-get install -y python3 python3-setuptools python3-pip python3-ldap memcached \
libmemcached-dev libreoffice-script-provider-python libreoffice pwgen curl nginx libmysqlclient-dev
pip3 install --timeout=3600 django==3.2.* future==0.18.* mysqlclient==2.1.* pymysql pillow==10.2.* pylibmc captcha==0.5.* markupsafe==2.0.1 jinja2 sqlalchemy==1.4.3 psd-tools django-pylibmc django_simple_captcha==0.5.20 djangosaml2==1.5.* pysaml2==7.2.* pycryptodome==3.16.* cffi==1.15.1 lxml
service memcached start
# -------------------------------------------
# Setup Nginx
# -------------------------------------------
rm /etc/nginx/sites-enabled/*
cat > /etc/nginx/sites-available/seafile.conf << EOF
log_format seafileformat '\$http_x_forwarded_for \$remote_addr [\$time_local] "\$request" \$status \$body_bytes_sent "\$http_referer" "\$http_user_agent" \$upstream_response_time';
server {
listen 80;
server_name seafile.example.com;
proxy_set_header X-Forwarded-For \$remote_addr;
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host \$host;
proxy_set_header X-Real-IP \$remote_addr;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host \$server_name;
proxy_set_header X-Forwarded-Proto \$scheme;
proxy_read_timeout 1200s;
# used for view/edit office file via Office Online Server
client_max_body_size 0;
access_log /var/log/nginx/seahub.access.log seafileformat;
error_log /var/log/nginx/seahub.error.log;
}
location /seafhttp {
rewrite ^/seafhttp(.*)$ \$1 break;
proxy_pass http://127.0.0.1:8082;
client_max_body_size 0;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_connect_timeout 36000s;
proxy_read_timeout 36000s;
access_log /var/log/nginx/seafhttp.access.log seafileformat;
error_log /var/log/nginx/seafhttp.error.log;
}
location /notification/ping {
proxy_pass http://127.0.0.1:8083/ping;
access_log /var/log/nginx/notification.access.log seafileformat;
error_log /var/log/nginx/notification.error.log;
}
location /notification {
proxy_pass http://127.0.0.1:8083/;
proxy_http_version 1.1;
proxy_set_header Upgrade \$http_upgrade;
proxy_set_header Connection "upgrade";
access_log /var/log/nginx/notification.access.log seafileformat;
error_log /var/log/nginx/notification.error.log;
}
location /media {
root ${SEAFILE_SERVER_HOME}/seafile-server-latest/seahub;
}
location /seafdav {
proxy_pass http://127.0.0.1:8080/seafdav;
proxy_set_header Host \$host;
proxy_set_header X-Real-IP \$remote_addr;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host \$server_name;
proxy_set_header X-Forwarded-Proto \$scheme;
proxy_read_timeout 1200s;
client_max_body_size 0;
access_log /var/log/nginx/seafdav.access.log seafileformat;
error_log /var/log/nginx/seafdav.error.log;
}
}
EOF
ln -sf /etc/nginx/sites-available/seafile.conf /etc/nginx/sites-enabled/seafile.conf
service nginx restart
# -------------------------------------------
# MariaDB
# -------------------------------------------
if [[ -f "/root/.my.cnf" ]] ;
then
echo "MariaDB installed before, skip this part"
SQLROOTPW=`sed -n 's/password=//p' /root/.my.cnf`
else
DEBIAN_FRONTEND=noninteractive apt-get install -y mariadb-server
service mysql start
SQLROOTPW=$(pwgen)
mysqladmin -u root password $SQLROOTPW
cat > /root/.my.cnf <<EOF
[client]
user=root
password=$SQLROOTPW
EOF
chmod 600 /root/.my.cnf
fi
# -------------------------------------------
# Seafile init script
# -------------------------------------------
cat > /etc/init.d/seafile-server << EOF
#!/bin/bash
### BEGIN INIT INFO
# Provides: seafile-server
# Required-Start: \$remote_fs \$syslog mysql
# Required-Stop: \$remote_fs \$syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Seafile server
# Description: Start Seafile server
### END INIT INFO
# Author: Alexander Jackson <alexander.jackson@seafile.de>
# Change the value of "seafile_dir" to your path of seafile installation
user=${SEAFILE_SERVER_USER}
seafile_dir=${SEAFILE_SERVER_HOME}
script_path=\${seafile_dir}/seafile-server-latest
seafile_init_log=\${seafile_dir}/logs/seafile.init.log
seahub_init_log=\${seafile_dir}/logs/seahub.init.log
case "\$1" in
start)
sudo -u \${user} \${script_path}/seafile.sh start >> \${seafile_init_log}
sudo -u \${user} \${script_path}/seahub.sh start >> \${seahub_init_log}
;;
restart)
sudo -u \${user} \${script_path}/seafile.sh restart >> \${seafile_init_log}
sudo -u \${user} \${script_path}/seahub.sh restart >> \${seahub_init_log}
;;
stop)
sudo -u \${user} \${script_path}/seafile.sh \$1 >> \${seafile_init_log}
sudo -u \${user} \${script_path}/seahub.sh \$1 >> \${seahub_init_log}
;;
*)
echo "Usage: /etc/init.d/seafile-server {start|stop|restart}"
exit 1
;;
esac
EOF
chmod +x /etc/init.d/seafile-server
update-rc.d seafile-server defaults
# -------------------------------------------
# Seafile
# -------------------------------------------
mkdir -p ${SEAFILE_SERVER_HOME}/installed
cd ${SEAFILE_SERVER_HOME}
if ! is_pro && [[ ! -e /opt/${SEAFILE_SERVER_PACKAGE} ]]; then
curl -OL ${SEAFILE_SERVER_PACKAGE_URL}
else
cp /opt/${SEAFILE_SERVER_PACKAGE} .
fi
tar xzf ${SEAFILE_SERVER_PACKAGE}
mv ${SEAFILE_SERVER_PACKAGE} installed
# -------------------------------------------
# Seafile DB
# -------------------------------------------
if [[ -f "/opt/seafile.my.cnf" ]] ;
then
echo "MariaDB installed before, skip this part"
SQLSEAFILEPW=`sed -n 's/password=//p' /opt/seafile.my.cnf`
else
SQLSEAFILEPW=$(pwgen)
cat > /opt/seafile.my.cnf <<EOF
[client]
user=seafile
password=$SQLSEAFILEPW
EOF
chmod 600 /opt/seafile.my.cnf
fi
# -------------------------------------------
# Add seafile user
# -------------------------------------------
useradd --system --comment "${SEAFILE_SERVER_USER}" ${SEAFILE_SERVER_USER} --home-dir ${SEAFILE_SERVER_HOME}
# -------------------------------------------
# Go to /opt/seafile/seafile-pro-server-${SEAFILE_VERSION}
# -------------------------------------------
cd $INSTALLPATH
# -------------------------------------------
# Vars - Don't touch these unless you really know what you are doing!
# -------------------------------------------
TOPDIR=$(dirname "${INSTALLPATH}")
DEFAULT_CONF_DIR=${TOPDIR}/conf
SEAFILE_DATA_DIR=${TOPDIR}/seafile-data
DEST_SETTINGS_PY=${TOPDIR}/conf/seahub_settings.py
mkdir -p ${DEFAULT_CONF_DIR}
# -------------------------------------------
# Create ccnet, seafile, seahub conf using setup script
# -------------------------------------------
./setup-seafile-mysql.sh auto -u seafile -w ${SQLSEAFILEPW} -r ${SQLROOTPW}
# -------------------------------------------
# Configure Seafile WebDAV Server(SeafDAV)
# -------------------------------------------
sed -i 's/enabled = .*/enabled = true/' ${DEFAULT_CONF_DIR}/seafdav.conf
sed -i 's/share_name = .*/share_name = \/seafdav/' ${DEFAULT_CONF_DIR}/seafdav.conf
# -------------------------------------------
# Configuring seahub_settings.py
# -------------------------------------------
cat >> ${DEST_SETTINGS_PY} <<EOF
CACHES = {
'default': {
'BACKEND': 'django_pylibmc.memcached.PyLibMCCache',
'LOCATION': '127.0.0.1:11211',
},
}
# EMAIL_USE_TLS = False
# EMAIL_HOST = 'localhost'
# EMAIL_HOST_USER = ''
# EMAIL_HOST_PASSWORD = ''
# EMAIL_PORT = '25'
# DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
# SERVER_EMAIL = EMAIL_HOST_USER
TIME_ZONE = '${TIME_ZONE}'
SITE_BASE = 'http://${IP_OR_DOMAIN}'
SITE_NAME = 'Seafile Server'
SITE_TITLE = 'Seafile Server'
SITE_ROOT = '/'
ENABLE_SIGNUP = False
ACTIVATE_AFTER_REGISTRATION = False
SEND_EMAIL_ON_ADDING_SYSTEM_MEMBER = True
SEND_EMAIL_ON_RESETTING_USER_PASSWD = True
FILE_PREVIEW_MAX_SIZE = 30 * 1024 * 1024
SESSION_COOKIE_AGE = 60 * 60 * 24 * 7 * 2
SESSION_SAVE_EVERY_REQUEST = False
SESSION_EXPIRE_AT_BROWSER_CLOSE = False
SERVICE_URL = 'http://${IP_OR_DOMAIN}'
FILE_SERVER_ROOT = 'http://${IP_OR_DOMAIN}/seafhttp'
EOF
# -------------------------------------------
# Backup check_init_admin.py befor applying changes
# -------------------------------------------
cp ${INSTALLPATH}/check_init_admin.py ${INSTALLPATH}/check_init_admin.py.backup
# -------------------------------------------
# Set admin credentials in check_init_admin.py
# -------------------------------------------
SEAFILE_ADMIN_PW=$(pwgen)
eval "sed -i 's/= ask_admin_email()/= \"${SEAFILE_ADMIN}\"/' ${INSTALLPATH}/check_init_admin.py"
eval "sed -i 's/= ask_admin_password()/= \"${SEAFILE_ADMIN_PW}\"/' ${INSTALLPATH}/check_init_admin.py"
# -------------------------------------------
# Start and stop Seafile eco system. This generates the initial admin user.
# -------------------------------------------
chown ${SEAFILE_SERVER_USER}:${SEAFILE_SERVER_USER} -R ${SEAFILE_SERVER_HOME}
su - seafile -c "${INSTALLPATH}/seafile.sh start"
wait
su - seafile -c "${INSTALLPATH}/seahub.sh start"
wait # sleep for a while, otherwise seahub will not be stopped
su - seafile -c "${INSTALLPATH}/seahub.sh stop"
wait
su - seafile -c "${INSTALLPATH}/seafile.sh stop"
wait
sleep 1
# -------------------------------------------
# Restore original check_init_admin.py
# -------------------------------------------
mv ${INSTALLPATH}/check_init_admin.py.backup ${INSTALLPATH}/check_init_admin.py
if is_pro; then
PRO_PY=${INSTALLPATH}/pro/pro.py
$PYTHON ${PRO_PY} setup --mysql --mysql_host=127.0.0.1 --mysql_port=3306 --mysql_user=seafile --mysql_password=${SQLSEAFILEPW} --mysql_db=seahub_db
fi
# kill all process
sleep 1
service seafile-server stop
wait
sleep 1
# -------------------------------------------
# Fix permissions
# -------------------------------------------
chown ${SEAFILE_SERVER_USER}:${SEAFILE_SERVER_USER} -R ${SEAFILE_SERVER_HOME}
if [[ -d /tmp/seafile-office-output/ ]]; then
chown ${SEAFILE_SERVER_USER}:${SEAFILE_SERVER_USER} -R /tmp/seafile-office-output/
fi
# -------------------------------------------
# Start seafile server
# -------------------------------------------
echo "Starting productive Seafile server"
service seafile-server restart
wait
# -------------------------------------------
# Final report
# -------------------------------------------
cat > ${TOPDIR}/aio_seafile-server.log<<EOF
Your Seafile server is installed
-----------------------------------------------------------------
Server Address: http://${IP_OR_DOMAIN}
Seafile Admin: ${SEAFILE_ADMIN}
Admin Password: ${SEAFILE_ADMIN_PW}
Seafile Data Dir: ${SEAFILE_DATA_DIR}
Seafile DB Credentials: Check /opt/seafile.my.cnf
Root DB Credentials: Check /root/.my.cnf
This report is also saved to ${TOPDIR}/aio_seafile-server.log
Next you should manually complete the following steps
-----------------------------------------------------------------
1) Log in to Seafile and configure your server domain via the system
admin area if applicable.
2) If this server is behind a firewall, you need to ensure that
tcp port 80 is open.
3) Check https://manual.seafile.com/config/sending_email/
for instructions on how to use an existing email account to send email via SMTP.
Optional steps
-----------------------------------------------------------------
1) Check seahub_settings.py and customize it to fit your needs. Consult
https://manual.seafile.com/config/seahub_settings_py/ for possible switches.
2) Setup NGINX with official SSL certificate, we suggest you use Lets Encrypt. Check
https://manual.seafile.com/deploy/https_with_nginx/
3) Secure server with iptables based firewall. For instance: UFW or shorewall
4) Implement a backup routine for your Seafile server.
Seafile support options
-----------------------------------------------------------------
For free community support visit: https://bbs.seafile.com
For paid commercial support visit: https://seafile.com
EOF
chmod 600 ${TOPDIR}/aio_seafile-server.log
clear
cat ${TOPDIR}/aio_seafile-server.log

551
seafile-11.0_ubuntu Normal file
View File

@ -0,0 +1,551 @@
#!/bin/bash
#
# seafile-server-installer-cn/seafile-11.0_ubuntu
#
# Copyright 2015, Alexander Jackson <alexander.jackson@seafile.de>
# Copyright 2016, Zheng Xie <xie.zheng@seafile.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#
if [[ $HOME == "" ]]; then
export HOME=/root
fi
if [[ $SEAFILE_DEBUG != "" ]]; then
set -x
fi
set -e
if [[ "$#" -ne 1 ]]; then
echo "You must specif Seafile version to install"
echo "Like: $0 11.0.0"
exit 1
fi
clear
cat <<EOF
This script installs the community/professional edition of the Seafile Server on a Ubuntu 20.04/22.04 64bit
- Newest Seafile server version, MariaDB, Memcached, NGINX -
-----------------------------------------------------------------
This installer is meant to run on a freshly installed machine
only. If you run it on a production server things can and
probably will go terribly wrong and you will lose valuable
data!
For questions or suggestions please contact us at
support@seafile.com
-----------------------------------------------------------------
Possible options:
1 = Seafile Community (Free) Edition (CE)
2 = Seafile Professional Edition (PRO)
EOF
if [[ ${SEAFILE_PRO} == "" ]]; then
PS3="Which Seafile version would you like to install? "
select SEAFILE_SERVER_VERSION in CE PRO ABORT; do
case "${SEAFILE_SERVER_VERSION}" in
ABORT)
echo "Aborting"
break
;;
"")
echo "$REPLY: Wrong value. Select 1 or 2."
;;
*)
if [[ ${SEAFILE_SERVER_VERSION} = "PRO" ]]; then
SEAFILE_PRO=1
else
SEAFILE_PRO=0
fi
break
esac
done
fi
is_pro() {
if [[ "$SEAFILE_PRO" == "1" ]]; then
return 0
else
return 1
fi
}
echo
if is_pro; then
echo "This script will install Seafile Professional Edition for you."
else
echo "This script will install Seafile Community Edition for you."
fi
echo
# -------------------------------------------
# Vars
# -------------------------------------------
SEAFILE_ADMIN=admin@seafile.local
SEAFILE_SERVER_USER=seafile
SEAFILE_SERVER_HOME=/opt/seafile
IP_OR_DOMAIN=127.0.0.1
SEAFILE_VERSION=$1
TIME_ZONE=Asia/Shanghai
if is_pro; then
SEAFILE_SERVER_PACKAGE=seafile-pro-server_${SEAFILE_VERSION}_x86-64.tar.gz
if [[ ! -e /opt/$SEAFILE_SERVER_PACKAGE ]]; then
echo
echo "You must download \"$SEAFILE_SERVER_PACKAGE\" to the /opt/ folder before running this script!"
echo
exit 1
fi
INSTALLPATH=${SEAFILE_SERVER_HOME}/seafile-pro-server-${SEAFILE_VERSION}/
else
SEAFILE_SERVER_PACKAGE=seafile-server_${SEAFILE_VERSION}_x86-64.tar.gz
SEAFILE_SERVER_PACKAGE_URL=http://seafile-downloads.oss-cn-shanghai.aliyuncs.com/${SEAFILE_SERVER_PACKAGE}
INSTALLPATH=${SEAFILE_SERVER_HOME}/seafile-server-${SEAFILE_VERSION}/
fi
# -------------------------------------------
# Ensure we are running the installer as root
# -------------------------------------------
if [[ $EUID -ne 0 ]]; then
echo " Aborting because you are not root" ; exit 1
fi
# -------------------------------------------
# Abort if directory SEAFILE_SERVER_HOME exists
# -------------------------------------------
if [[ -d "${SEAFILE_SERVER_HOME}" ]] ;
then
echo " Aborting because directory ${SEAFILE_SERVER_HOME} already exist" ; exit 1
fi
# -------------------------------------------
# Abort if seafile user exists
# -------------------------------------------
if getent passwd ${SEAFILE_SERVER_USER} > /dev/null 2>&1 ;
then
echo "Aborting because user ${SEAFILE_SERVER_USER} already exist" ; exit 1
fi
# -------------------------------------------
# Additional requirements
# -------------------------------------------
apt-get update
apt-get install -y python3 python3-dev python3-setuptools python3-pip python3-ldap memcached \
libmemcached-dev pwgen curl nginx libmysqlclient-dev ldap-utils libldap2-dev dnsutils
pip3 install --timeout=3600 django==4.2.* future==0.18.* mysqlclient==2.1.* pymysql pillow==10.2.* pylibmc captcha==0.5.* markupsafe==2.0.1 jinja2 sqlalchemy==2.0.18 psd-tools django-pylibmc django_simple_captcha==0.6.* djangosaml2==1.5.* pysaml2==7.2.* pycryptodome==3.16.* cffi==1.15.1 python-ldap==3.4.3 lxml \
-i https://pypi.tuna.tsinghua.edu.cn/simple/
service memcached start
# -------------------------------------------
# Setup Nginx
# -------------------------------------------
rm /etc/nginx/sites-enabled/*
cat > /etc/nginx/sites-available/seafile.conf << EOF
log_format seafileformat '\$http_x_forwarded_for \$remote_addr [\$time_local] "\$request" \$status \$body_bytes_sent "\$http_referer" "\$http_user_agent" \$upstream_response_time';
server {
listen 80;
server_name seafile.example.com;
proxy_set_header X-Forwarded-For \$remote_addr;
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host \$http_host;
proxy_set_header X-Real-IP \$remote_addr;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host \$server_name;
proxy_set_header X-Forwarded-Proto \$scheme;
proxy_read_timeout 1200s;
# used for view/edit office file via Office Online Server
client_max_body_size 0;
access_log /var/log/nginx/seahub.access.log seafileformat;
error_log /var/log/nginx/seahub.error.log;
}
location /seafhttp {
rewrite ^/seafhttp(.*)$ \$1 break;
proxy_pass http://127.0.0.1:8082;
client_max_body_size 0;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_connect_timeout 36000s;
proxy_read_timeout 36000s;
access_log /var/log/nginx/seafhttp.access.log seafileformat;
error_log /var/log/nginx/seafhttp.error.log;
}
location /notification/ping {
proxy_pass http://127.0.0.1:8083/ping;
access_log /var/log/nginx/notification.access.log seafileformat;
error_log /var/log/nginx/notification.error.log;
}
location /notification {
proxy_pass http://127.0.0.1:8083/;
proxy_http_version 1.1;
proxy_set_header Upgrade \$http_upgrade;
proxy_set_header Connection "upgrade";
access_log /var/log/nginx/notification.access.log seafileformat;
error_log /var/log/nginx/notification.error.log;
}
location /media {
root ${SEAFILE_SERVER_HOME}/seafile-server-latest/seahub;
}
location /seafdav {
proxy_pass http://127.0.0.1:8080/seafdav;
proxy_set_header Host \$host;
proxy_set_header X-Real-IP \$remote_addr;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host \$server_name;
proxy_set_header X-Forwarded-Proto \$scheme;
proxy_read_timeout 1200s;
client_max_body_size 0;
access_log /var/log/nginx/seafdav.access.log seafileformat;
error_log /var/log/nginx/seafdav.error.log;
}
}
EOF
ln -sf /etc/nginx/sites-available/seafile.conf /etc/nginx/sites-enabled/seafile.conf
service nginx restart
# -------------------------------------------
# MariaDB
# -------------------------------------------
if [[ -f "/root/.my.cnf" ]] ;
then
echo "MariaDB installed before, skip this part"
SQLROOTPW=`sed -n 's/password=//p' /root/.my.cnf`
else
# https://mariadb.com/kb/en/mariadb-package-repository-setup-and-usage/
curl -LsS https://r.mariadb.com/downloads/mariadb_repo_setup | sudo bash -s -- --mariadb-server-version="mariadb-10.6"
DEBIAN_FRONTEND=noninteractive apt-get install -y mariadb-server-10.6
service mysql start
SQLROOTPW=$(pwgen)
mysqladmin -u root password $SQLROOTPW
cat > /root/.my.cnf <<EOF
[client]
user=root
password=$SQLROOTPW
EOF
chmod 600 /root/.my.cnf
fi
# -------------------------------------------
# Seafile init script
# -------------------------------------------
cat > /etc/init.d/seafile-server << EOF
#!/bin/bash
### BEGIN INIT INFO
# Provides: seafile-server
# Required-Start: \$remote_fs \$syslog mysql
# Required-Stop: \$remote_fs \$syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Seafile server
# Description: Start Seafile server
### END INIT INFO
# Author: Alexander Jackson <alexander.jackson@seafile.de>
# Change the value of "seafile_dir" to your path of seafile installation
user=${SEAFILE_SERVER_USER}
seafile_dir=${SEAFILE_SERVER_HOME}
script_path=\${seafile_dir}/seafile-server-latest
seafile_init_log=\${seafile_dir}/logs/seafile.init.log
seahub_init_log=\${seafile_dir}/logs/seahub.init.log
case "\$1" in
start)
sudo -u \${user} \${script_path}/seafile.sh start >> \${seafile_init_log}
sudo -u \${user} \${script_path}/seahub.sh start >> \${seahub_init_log}
;;
restart)
sudo -u \${user} \${script_path}/seafile.sh restart >> \${seafile_init_log}
sudo -u \${user} \${script_path}/seahub.sh restart >> \${seahub_init_log}
;;
stop)
sudo -u \${user} \${script_path}/seafile.sh \$1 >> \${seafile_init_log}
sudo -u \${user} \${script_path}/seahub.sh \$1 >> \${seahub_init_log}
;;
*)
echo "Usage: /etc/init.d/seafile-server {start|stop|restart}"
exit 1
;;
esac
EOF
chmod +x /etc/init.d/seafile-server
update-rc.d seafile-server defaults
# -------------------------------------------
# Seafile
# -------------------------------------------
mkdir -p ${SEAFILE_SERVER_HOME}/installed
cd ${SEAFILE_SERVER_HOME}
if ! is_pro && [[ ! -e /opt/${SEAFILE_SERVER_PACKAGE} ]]; then
curl -OL ${SEAFILE_SERVER_PACKAGE_URL}
else
cp /opt/${SEAFILE_SERVER_PACKAGE} .
fi
tar xzf ${SEAFILE_SERVER_PACKAGE}
mv ${SEAFILE_SERVER_PACKAGE} installed
# -------------------------------------------
# Seafile DB
# -------------------------------------------
if [[ -f "/opt/seafile.my.cnf" ]] ;
then
echo "MariaDB installed before, skip this part"
SQLSEAFILEPW=`sed -n 's/password=//p' /opt/seafile.my.cnf`
else
SQLSEAFILEPW=$(pwgen)
cat > /opt/seafile.my.cnf <<EOF
[client]
user=seafile
password=$SQLSEAFILEPW
EOF
chmod 600 /opt/seafile.my.cnf
fi
# -------------------------------------------
# Add seafile user
# -------------------------------------------
useradd --system --comment "${SEAFILE_SERVER_USER}" ${SEAFILE_SERVER_USER} --home-dir ${SEAFILE_SERVER_HOME}
# -------------------------------------------
# Go to /opt/seafile/seafile-pro-server-${SEAFILE_VERSION}
# -------------------------------------------
cd $INSTALLPATH
# -------------------------------------------
# Vars - Don't touch these unless you really know what you are doing!
# -------------------------------------------
TOPDIR=$(dirname "${INSTALLPATH}")
DEFAULT_CONF_DIR=${TOPDIR}/conf
SEAFILE_DATA_DIR=${TOPDIR}/seafile-data
DEST_SETTINGS_PY=${TOPDIR}/conf/seahub_settings.py
mkdir -p ${DEFAULT_CONF_DIR}
# -------------------------------------------
# Create ccnet, seafile, seahub conf using setup script
# -------------------------------------------
./setup-seafile-mysql.sh auto -u seafile -w ${SQLSEAFILEPW} -r ${SQLROOTPW}
# -------------------------------------------
# Configure Seafile WebDAV Server(SeafDAV)
# -------------------------------------------
sed -i 's/enabled = .*/enabled = true/' ${DEFAULT_CONF_DIR}/seafdav.conf
sed -i 's/share_name = .*/share_name = \/seafdav/' ${DEFAULT_CONF_DIR}/seafdav.conf
# -------------------------------------------
# Configuring seahub_settings.py
# -------------------------------------------
cat >> ${DEST_SETTINGS_PY} <<EOF
CACHES = {
'default': {
'BACKEND': 'django_pylibmc.memcached.PyLibMCCache',
'LOCATION': '127.0.0.1:11211',
},
}
# EMAIL_USE_TLS = False
# EMAIL_HOST = 'localhost'
# EMAIL_HOST_USER = ''
# EMAIL_HOST_PASSWORD = ''
# EMAIL_PORT = '25'
# DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
# SERVER_EMAIL = EMAIL_HOST_USER
TIME_ZONE = '${TIME_ZONE}'
SITE_BASE = 'http://${IP_OR_DOMAIN}'
SITE_NAME = 'Seafile Server'
SITE_TITLE = 'Seafile Server'
SITE_ROOT = '/'
ENABLE_SIGNUP = False
ACTIVATE_AFTER_REGISTRATION = False
SEND_EMAIL_ON_ADDING_SYSTEM_MEMBER = True
SEND_EMAIL_ON_RESETTING_USER_PASSWD = True
FILE_PREVIEW_MAX_SIZE = 30 * 1024 * 1024
SESSION_COOKIE_AGE = 60 * 60 * 24 * 7 * 2
SESSION_SAVE_EVERY_REQUEST = False
SESSION_EXPIRE_AT_BROWSER_CLOSE = False
SERVICE_URL = 'http://${IP_OR_DOMAIN}'
FILE_SERVER_ROOT = 'http://${IP_OR_DOMAIN}/seafhttp'
EOF
# -------------------------------------------
# Backup check_init_admin.py befor applying changes
# -------------------------------------------
cp ${INSTALLPATH}/check_init_admin.py ${INSTALLPATH}/check_init_admin.py.backup
# -------------------------------------------
# Set admin credentials in check_init_admin.py
# -------------------------------------------
SEAFILE_ADMIN_PW=$(pwgen)
eval "sed -i 's/= ask_admin_email()/= \"${SEAFILE_ADMIN}\"/' ${INSTALLPATH}/check_init_admin.py"
eval "sed -i 's/= ask_admin_password()/= \"${SEAFILE_ADMIN_PW}\"/' ${INSTALLPATH}/check_init_admin.py"
# -------------------------------------------
# Start and stop Seafile eco system. This generates the initial admin user.
# -------------------------------------------
chown ${SEAFILE_SERVER_USER}:${SEAFILE_SERVER_USER} -R ${SEAFILE_SERVER_HOME}
su - seafile -c "${INSTALLPATH}/seafile.sh start"
wait
su - seafile -c "${INSTALLPATH}/seahub.sh start"
wait # sleep for a while, otherwise seahub will not be stopped
su - seafile -c "${INSTALLPATH}/seahub.sh stop"
wait
su - seafile -c "${INSTALLPATH}/seafile.sh stop"
wait
sleep 1
# -------------------------------------------
# Restore original check_init_admin.py
# -------------------------------------------
mv ${INSTALLPATH}/check_init_admin.py.backup ${INSTALLPATH}/check_init_admin.py
# seafevents.conf
PRO_PY=${INSTALLPATH}/pro/pro.py
$PYTHON ${PRO_PY} setup --mysql --mysql_host=127.0.0.1 --mysql_port=3306 --mysql_user=seafile --mysql_password=${SQLSEAFILEPW} --mysql_db=seahub_db
# kill all process
sleep 1
service seafile-server stop
wait
sleep 1
# -------------------------------------------
# Fix permissions
# -------------------------------------------
chown ${SEAFILE_SERVER_USER}:${SEAFILE_SERVER_USER} -R ${SEAFILE_SERVER_HOME}
if [[ -d /tmp/seafile-office-output/ ]]; then
chown ${SEAFILE_SERVER_USER}:${SEAFILE_SERVER_USER} -R /tmp/seafile-office-output/
fi
# -------------------------------------------
# Start seafile server
# -------------------------------------------
echo "Starting productive Seafile server"
service seafile-server restart
wait
# -------------------------------------------
# Final report
# -------------------------------------------
cat > ${TOPDIR}/aio_seafile-server.log<<EOF
Your Seafile server is installed
-----------------------------------------------------------------
Server Address: http://${IP_OR_DOMAIN}
Seafile Admin: ${SEAFILE_ADMIN}
Admin Password: ${SEAFILE_ADMIN_PW}
Seafile Data Dir: ${SEAFILE_DATA_DIR}
Seafile DB Credentials: Check /opt/seafile.my.cnf
Root DB Credentials: Check /root/.my.cnf
This report is also saved to ${TOPDIR}/aio_seafile-server.log
Next you should manually complete the following steps
-----------------------------------------------------------------
1) Log in to Seafile and configure your server domain via the system
admin area if applicable.
2) If this server is behind a firewall, you need to ensure that
tcp port 80 is open.
3) Check https://manual.seafile.com/config/sending_email/
for instructions on how to use an existing email account to send email via SMTP.
Optional steps
-----------------------------------------------------------------
1) Check seahub_settings.py and customize it to fit your needs. Consult
https://manual.seafile.com/config/seahub_settings_py/ for possible switches.
2) Setup NGINX with official SSL certificate, we suggest you use Lets Encrypt. Check
https://manual.seafile.com/deploy/https_with_nginx/
3) Secure server with iptables based firewall. For instance: UFW or shorewall
4) Implement a backup routine for your Seafile server.
Seafile support options
-----------------------------------------------------------------
For free community support visit: https://bbs.seafile.com
For paid commercial support visit: https://seafile.com
EOF
chmod 600 ${TOPDIR}/aio_seafile-server.log
clear
cat ${TOPDIR}/aio_seafile-server.log

View File

@ -1,8 +1,9 @@
#!/bin/bash #!/bin/bash
# #
# seafile-server-installer/seafile-server-ce-ubuntu-14-04-amd64 # seafile-server-installer/seafile-server-ubuntu-16-04-amd64
# #
# Copyright 2015, Alexander Jackson <alexander.jackson@seafile.de> # Copyright 2015, Alexander Jackson <alexander.jackson@seafile.de>
# Copyright 2016, Zheng Xie <xie.zheng@seafile.com>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
@ -19,6 +20,10 @@
# #
# #
if [[ $HOME == "" ]]; then
export HOME=/root
fi
if [[ $SEAFILE_DEBUG != "" ]]; then if [[ $SEAFILE_DEBUG != "" ]]; then
set -x set -x
fi fi
@ -26,14 +31,14 @@ set -e
if [[ "$#" -ne 1 ]]; then if [[ "$#" -ne 1 ]]; then
echo "You must specif Seafile version to install" echo "You must specif Seafile version to install"
echo "Like: $0 4.4.2" echo "Like: $0 7.1.0"
exit 1 exit 1
fi fi
clear clear
cat <<EOF cat <<EOF
This script installs the community edition of the Seafile Server on a Ubuntu 14.04 (Trusty) 64bit This script installs the community edition of the Seafile Server on a Ubuntu 16.04 (Xenial) 64bit
- Newest Seafile server version, MariaDB, Memcached, NGINX - - Newest Seafile server version, MariaDB, Memcached, NGINX -
----------------------------------------------------------------- -----------------------------------------------------------------
@ -95,11 +100,9 @@ echo
# Vars # Vars
# ------------------------------------------- # -------------------------------------------
SEAFILE_ADMIN=admin@seafile.local SEAFILE_ADMIN=admin@seafile.local
SEAFILE_USER=seafile SEAFILE_SERVER_USER=seafile
SERVER_NAME=$(hostname -s) SEAFILE_SERVER_HOME=/opt/seafile
IP_OR_DOMAIN=$(hostname -i) IP_OR_DOMAIN=127.0.0.1
HOSTNAME=$(hostname -i)
FILESERVER_PORT=8082
SEAFILE_VERSION=$1 SEAFILE_VERSION=$1
TIME_ZONE=Asia/Shanghai TIME_ZONE=Asia/Shanghai
@ -111,11 +114,11 @@ if is_pro; then
echo echo
exit 1 exit 1
fi fi
INSTALLPATH=/opt/seafile/seafile-pro-server-${SEAFILE_VERSION}/ INSTALLPATH=${SEAFILE_SERVER_HOME}/seafile-pro-server-${SEAFILE_VERSION}/
else else
SEAFILE_SERVER_PACKAGE=seafile-server_${SEAFILE_VERSION}_x86-64.tar.gz SEAFILE_SERVER_PACKAGE=seafile-server_${SEAFILE_VERSION}_x86-64.tar.gz
SEAFILE_SERVER_PACKAGE_URL=http://download-cn.seafile.com/${SEAFILE_SERVER_PACKAGE} SEAFILE_SERVER_PACKAGE_URL=http://seafile-downloads.oss-cn-shanghai.aliyuncs.com/${SEAFILE_SERVER_PACKAGE}
INSTALLPATH=/opt/seafile/seafile-server-${SEAFILE_VERSION}/ INSTALLPATH=${SEAFILE_SERVER_HOME}/seafile-server-${SEAFILE_VERSION}/
fi fi
@ -128,70 +131,85 @@ fi
# ------------------------------------------- # -------------------------------------------
# Abort if directory /opt/seafile/ exists # Abort if directory SEAFILE_SERVER_HOME exists
# ------------------------------------------- # -------------------------------------------
if [[ -d "/opt/seafile/" ]] ; if [[ -d "${SEAFILE_SERVER_HOME}" ]] ;
then then
echo " Aborting because directory /opt/seafile/ already exist" ; exit 1 echo " Aborting because directory ${SEAFILE_SERVER_HOME} already exist" ; exit 1
fi fi
# ------------------------------------------- # -------------------------------------------
# Additional requirements # Additional requirements
# ------------------------------------------- # -------------------------------------------
apt-get update apt-get update
apt-get install -y sudo python-pip python-setuptools python-imaging python-mysqldb python-ldap \
openjdk-7-jre memcached python-memcache pwgen curl openssl poppler-utils libpython2.7 libreoffice \ # apt-get install -y python2.7 sudo python-setuptools python-mysqldb python-ldap python-urllib3 \
libreoffice-script-provider-python ttf-wqy-microhei ttf-wqy-zenhei xfonts-wqy nginx # openjdk-8-jre memcached libmemcached-dev zlib1g-dev pwgen curl openssl poppler-utils libpython2.7 libreoffice \
# libreoffice-script-provider-python ttf-wqy-microhei ttf-wqy-zenhei xfonts-wqy nginx
apt-get install -y python3 python3-setuptools python3-pip python3-ldap memcached openjdk-8-jre \
libmemcached-dev libreoffice-script-provider-python libreoffice pwgen curl nginx
pip3 install --timeout=3600 Pillow pylibmc captcha jinja2 sqlalchemy==1.3.8 psd-tools \
django-pylibmc django-simple-captcha
service memcached start
rm /etc/nginx/sites-enabled/* rm /etc/nginx/sites-enabled/*
cat > /etc/nginx/sites-available/seafile.conf <<'EOF' cat > /etc/nginx/sites-available/seafile.conf << EOF
log_format seafileformat '\$http_x_forwarded_for \$remote_addr [\$time_local] "\$request" \$status \$body_bytes_sent "\$http_referer" "\$http_user_agent" \$upstream_response_time';
server { server {
listen 80; listen 80;
server_name ""; server_name seafile.example.com;
location / { proxy_set_header X-Forwarded-For \$remote_addr;
fastcgi_pass 127.0.0.1:8000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
access_log /var/log/nginx/seahub.access.log; location / {
error_log /var/log/nginx/seahub.error.log; proxy_pass http://127.0.0.1:8000;
} proxy_set_header Host \$host;
location /seafhttp { proxy_set_header X-Real-IP \$remote_addr;
rewrite ^/seafhttp(.*)$ $1 break; proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:8082; proxy_set_header X-Forwarded-Host \$server_name;
client_max_body_size 0; proxy_set_header X-Forwarded-Proto \$scheme;
proxy_connect_timeout 36000s; proxy_read_timeout 1200s;
proxy_read_timeout 36000s;
} # used for view/edit office file via Office Online Server
location /media { client_max_body_size 0;
root /opt/seafile/seafile-server-latest/seahub;
} access_log /var/log/nginx/seahub.access.log seafileformat;
location /seafdav { error_log /var/log/nginx/seahub.error.log;
fastcgi_pass 127.0.0.1:8080; }
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name; location /seafhttp {
fastcgi_param SERVER_PROTOCOL $server_protocol; rewrite ^/seafhttp(.*)$ \$1 break;
fastcgi_param QUERY_STRING $query_string; proxy_pass http://127.0.0.1:8082;
fastcgi_param REQUEST_METHOD $request_method; client_max_body_size 0;
fastcgi_param CONTENT_TYPE $content_type; proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
fastcgi_param CONTENT_LENGTH $content_length; proxy_connect_timeout 36000s;
fastcgi_param SERVER_ADDR $server_addr; proxy_read_timeout 36000s;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name; access_log /var/log/nginx/seafhttp.access.log seafileformat;
error_log /var/log/nginx/seafhttp.error.log;
}
location /media {
root ${SEAFILE_SERVER_HOME}/seafile-server-latest/seahub;
}
location /seafdav {
proxy_pass http://127.0.0.1:8080/seafdav;
proxy_set_header Host \$host;
proxy_set_header X-Real-IP \$remote_addr;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host \$server_name;
proxy_set_header X-Forwarded-Proto \$scheme;
proxy_read_timeout 1200s;
client_max_body_size 0; client_max_body_size 0;
access_log /var/log/nginx/seafdav.access.log; access_log /var/log/nginx/seafdav.access.log seafileformat;
error_log /var/log/nginx/seafdav.error.log; error_log /var/log/nginx/seafdav.error.log;
} }
} }
@ -208,8 +226,10 @@ service nginx restart
if [[ -f "/root/.my.cnf" ]] ; if [[ -f "/root/.my.cnf" ]] ;
then then
echo "MariaDB installed before, skip this part" echo "MariaDB installed before, skip this part"
SQLROOTPW=`sed -n 's/password=//p' /root/.my.cnf`
else else
DEBIAN_FRONTEND=noninteractive apt-get install -y mariadb-server DEBIAN_FRONTEND=noninteractive apt-get install -y mariadb-server
service mysql start
SQLROOTPW=$(pwgen) SQLROOTPW=$(pwgen)
@ -224,61 +244,43 @@ EOF
chmod 600 /root/.my.cnf chmod 600 /root/.my.cnf
fi fi
# ------------------------------------------- # -------------------------------------------
# Seafile init script # Seafile init script
# ------------------------------------------- # -------------------------------------------
cat > /etc/init.d/seafile-server <<'EOF' cat > /etc/init.d/seafile-server << EOF
#!/bin/bash #!/bin/bash
### BEGIN INIT INFO ### BEGIN INIT INFO
# Provides: seafile-server # Provides: seafile-server
# Required-Start: $remote_fs $syslog mysql # Required-Start: \$remote_fs \$syslog mysql
# Required-Stop: $remote_fs $syslog # Required-Stop: \$remote_fs \$syslog
# Default-Start: 2 3 4 5 # Default-Start: 2 3 4 5
# Default-Stop: 0 1 6 # Default-Stop: 0 1 6
# Short-Description: Seafile server # Short-Description: Seafile server
# Description: Start Seafile server # Description: Start Seafile server
### END INIT INFO ### END INIT INFO
# Author: Alexander Jackson <alexander.jackson@seafile.com.de> # Author: Alexander Jackson <alexander.jackson@seafile.de>
#
# Change the value of "user" to your linux user name
user=seafile
# Change the value of "seafile_dir" to your path of seafile installation # Change the value of "seafile_dir" to your path of seafile installation
seafile_dir=/opt/seafile user=${SEAFILE_SERVER_USER}
script_path=${seafile_dir}/seafile-server-latest seafile_dir=${SEAFILE_SERVER_HOME}
seafile_init_log=${seafile_dir}/logs/seafile.init.log script_path=\${seafile_dir}/seafile-server-latest
seahub_init_log=${seafile_dir}/logs/seahub.init.log seafile_init_log=\${seafile_dir}/logs/seafile.init.log
seahub_init_log=\${seafile_dir}/logs/seahub.init.log
# Change the value of fastcgi to true if fastcgi is to be used
fastcgi=true
# Set the port of fastcgi, default is 8000. Change it if you need different.
fastcgi_port=8000
case "$1" in case "\$1" in
start) start)
sudo -u ${user} ${script_path}/seafile.sh start >> ${seafile_init_log} sudo -u \${user} \${script_path}/seafile.sh start >> \${seafile_init_log}
if [ $fastcgi = true ]; sudo -u \${user} \${script_path}/seahub.sh start >> \${seahub_init_log}
then
sudo -u ${user} ${script_path}/seahub.sh start-fastcgi ${fastcgi_port} >> ${seahub_init_log}
else
sudo -u ${user} ${script_path}/seahub.sh start >> ${seahub_init_log}
fi
;; ;;
restart) restart)
sudo -u ${user} ${script_path}/seafile.sh restart >> ${seafile_init_log} sudo -u \${user} \${script_path}/seafile.sh restart >> \${seafile_init_log}
if [ $fastcgi = true ]; sudo -u \${user} \${script_path}/seahub.sh restart >> \${seahub_init_log}
then
sudo -u ${user} ${script_path}/seahub.sh restart-fastcgi ${fastcgi_port} >> ${seahub_init_log}
else
sudo -u ${user} ${script_path}/seahub.sh restart >> ${seahub_init_log}
fi
;; ;;
stop) stop)
sudo -u ${user} ${script_path}/seafile.sh $1 >> ${seafile_init_log} sudo -u \${user} \${script_path}/seafile.sh \$1 >> \${seafile_init_log}
sudo -u ${user} ${script_path}/seahub.sh $1 >> ${seahub_init_log} sudo -u \${user} \${script_path}/seahub.sh \$1 >> \${seahub_init_log}
;; ;;
*) *)
echo "Usage: /etc/init.d/seafile-server {start|stop|restart}" echo "Usage: /etc/init.d/seafile-server {start|stop|restart}"
@ -294,9 +296,8 @@ update-rc.d seafile-server defaults
# ------------------------------------------- # -------------------------------------------
# Seafile # Seafile
# ------------------------------------------- # -------------------------------------------
adduser --system --gecos "${SEAFILE_USER}" ${SEAFILE_USER} --home /opt/seafile mkdir -p ${SEAFILE_SERVER_HOME}/installed
mkdir -p /opt/seafile/installed cd ${SEAFILE_SERVER_HOME}
cd /opt/seafile/
if ! is_pro && [[ ! -e /opt/${SEAFILE_SERVER_PACKAGE} ]]; then if ! is_pro && [[ ! -e /opt/${SEAFILE_SERVER_PACKAGE} ]]; then
curl -OL ${SEAFILE_SERVER_PACKAGE_URL} curl -OL ${SEAFILE_SERVER_PACKAGE_URL}
else else
@ -310,26 +311,26 @@ mv ${SEAFILE_SERVER_PACKAGE} installed
# ------------------------------------------- # -------------------------------------------
# Seafile DB # Seafile DB
# ------------------------------------------- # -------------------------------------------
SQLSEAFILEPW=$(pwgen) if [[ -f "/opt/seafile.my.cnf" ]] ;
then
echo "MariaDB installed before, skip this part"
SQLSEAFILEPW=`sed -n 's/password=//p' /opt/seafile.my.cnf`
else
SQLSEAFILEPW=$(pwgen)
cat > /opt/seafile/.my.cnf <<EOF cat > /opt/seafile.my.cnf <<EOF
[client] [client]
user=seafile user=seafile
password=$SQLSEAFILEPW password=$SQLSEAFILEPW
EOF EOF
chmod 600 /opt/seafile/.my.cnf chmod 600 /opt/seafile.my.cnf
chown -R ${SEAFILE_USER}.nogroup /opt/seafile/ fi
mysql -e "CREATE DATABASE IF NOT EXISTS \`ccnet-db\` character set = 'utf8';"
mysql -e "CREATE DATABASE IF NOT EXISTS \`seafile-db\` character set = 'utf8';"
mysql -e "CREATE DATABASE IF NOT EXISTS \`seahub-db\` character set = 'utf8';"
mysql -e "create user 'seafile'@'localhost' identified by '$SQLSEAFILEPW';"
mysql -e "GRANT ALL PRIVILEGES ON \`ccnet-db\`.* to \`seafile\`@localhost;"
mysql -e "GRANT ALL PRIVILEGES ON \`seafile-db\`.* to \`seafile\`@localhost;"
mysql -e "GRANT ALL PRIVILEGES ON \`seahub-db\`.* to \`seafile\`@localhost;"
mysql seahub-db < ${INSTALLPATH}/seahub/sql/mysql.sql
# -------------------------------------------
# Add seafile user
# -------------------------------------------
useradd --system --comment "${SEAFILE_SERVER_USER}" ${SEAFILE_SERVER_USER} --home-dir ${SEAFILE_SERVER_HOME}
# ------------------------------------------- # -------------------------------------------
# Go to /opt/seafile/seafile-pro-server-${SEAFILE_VERSION} # Go to /opt/seafile/seafile-pro-server-${SEAFILE_VERSION}
@ -340,170 +341,54 @@ cd $INSTALLPATH
# Vars - Don't touch these unless you really know what you are doing! # Vars - Don't touch these unless you really know what you are doing!
# ------------------------------------------- # -------------------------------------------
TOPDIR=$(dirname "${INSTALLPATH}") TOPDIR=$(dirname "${INSTALLPATH}")
SRC_DOCS_DIR=${INSTALLPATH}/seafile/docs/
SEAHUB_SECRET_KEYGEN=${INSTALLPATH}/seahub/tools/secret_key_generator.py
DEFAULT_CCNET_CONF_DIR=${TOPDIR}/ccnet
DEFAULT_SEAFILE_DATA_DIR=${TOPDIR}/seafile-data
DEFAULT_CONF_DIR=${TOPDIR}/conf DEFAULT_CONF_DIR=${TOPDIR}/conf
SEAFILE_DATA_DIR=${TOPDIR}/seafile-data SEAFILE_DATA_DIR=${TOPDIR}/seafile-data
LIBRARY_TEMPLATE_DIR=${SEAFILE_DATA_DIR}/library-template
DEST_SETTINGS_PY=${TOPDIR}/conf/seahub_settings.py DEST_SETTINGS_PY=${TOPDIR}/conf/seahub_settings.py
CCNET_INIT=${INSTALLPATH}/seafile/bin/ccnet-init
SEAF_SERVER_INIT=${INSTALLPATH}/seafile/bin/seaf-server-init
MEDIA_DIR=${INSTALLPATH}/seahub/media
ORIG_AVATAR_DIR=${INSTALLPATH}/seahub/media/avatars
DEST_AVATAR_DIR=${TOPDIR}/seahub-data/avatars
SEAFILE_SERVER_SYMLINK=${TOPDIR}/seafile-server-latest
mkdir -p ${DEFAULT_CONF_DIR} mkdir -p ${DEFAULT_CONF_DIR}
# ------------------------------------------- # -------------------------------------------
# Create ccnet conf # Create ccnet, seafile, seahub conf using setup script
# ------------------------------------------- # -------------------------------------------
export SEAFILE_LD_LIBRARY_PATH=${INSTALLPATH}/seafile/lib/:${INSTALLPATH}/seafile/lib64:${LD_LIBRARY_PATH}
LD_LIBRARY_PATH=$SEAFILE_LD_LIBRARY_PATH "${CCNET_INIT}" -c "${DEFAULT_CCNET_CONF_DIR}" \
--name "${SERVER_NAME}" --host "${IP_OR_DOMAIN}" -F "${DEFAULT_CONF_DIR}"
# Fix service url
eval "sed -i 's/^SERVICE_URL.*/SERVICE_URL = http:\/\/${IP_OR_DOMAIN}/' ${DEFAULT_CONF_DIR}/ccnet.conf"
# -------------------------------------------
# Create seafile conf
# -------------------------------------------
LD_LIBRARY_PATH=$SEAFILE_LD_LIBRARY_PATH ${SEAF_SERVER_INIT} --seafile-dir "${SEAFILE_DATA_DIR}" \
--fileserver-port ${FILESERVER_PORT} -F "${DEFAULT_CONF_DIR}"
# -------------------------------------------
# Write seafile.ini
# -------------------------------------------
echo "${SEAFILE_DATA_DIR}" > "${DEFAULT_CCNET_CONF_DIR}/seafile.ini"
./setup-seafile-mysql.sh auto -u seafile -w ${SQLSEAFILEPW} -r ${SQLROOTPW}
# ------------------------------------------- # -------------------------------------------
# Configure Seafile WebDAV Server(SeafDAV) # Configure Seafile WebDAV Server(SeafDAV)
# ------------------------------------------- # -------------------------------------------
cat > ${DEFAULT_CONF_DIR}/seafdav.conf <<EOF sed -i 's/enabled = .*/enabled = true/' ${DEFAULT_CONF_DIR}/seafdav.conf
[WEBDAV] sed -i 's/fastcgi = .*/fastcgi = true/' ${DEFAULT_CONF_DIR}/seafdav.conf
enabled = true sed -i 's/share_name = .*/share_name = \/seafdav/' ${DEFAULT_CONF_DIR}/seafdav.conf
port = 8080
fastcgi = true
share_name = /seafdav
EOF
# -------------------------------------------
# generate seahub_settings.py
# -------------------------------------------
key=$(python "${SEAHUB_SECRET_KEYGEN}")
echo "SECRET_KEY = \"${key}\"" > "${DEST_SETTINGS_PY}"
# -------------------------------------------
# prepare avatar directory
# -------------------------------------------
mkdir -p "${TOPDIR}/seahub-data"
mv "${ORIG_AVATAR_DIR}" "${DEST_AVATAR_DIR}"
ln -s ../../../seahub-data/avatars ${MEDIA_DIR}
# -------------------------------------------
# create logs directory
# -------------------------------------------
mkdir -p "${TOPDIR}/logs"
# -------------------------------------------
# Create symlink for current server version
# -------------------------------------------
ln -s "$(basename ${INSTALLPATH})" "${SEAFILE_SERVER_SYMLINK}"
# Fix permissions
chmod 0600 "$DEST_SETTINGS_PY"
chmod 0700 "$DEFAULT_CCNET_CONF_DIR"
chmod 0700 "$SEAFILE_DATA_DIR"
chmod 0700 "$DEFAULT_CONF_DIR"
# -------------------------------------------
# copy user manuals to library template
# -------------------------------------------
mkdir -p ${LIBRARY_TEMPLATE_DIR}
cp -f ${SRC_DOCS_DIR}/*.doc ${LIBRARY_TEMPLATE_DIR}
# -------------------------------------------
# Configuring ccnet.conf
# -------------------------------------------
cat >> ${DEFAULT_CONF_DIR}/ccnet.conf <<EOF
[Database]
ENGINE = mysql
HOST = 127.0.0.1
PORT = 3306
USER = seafile
PASSWD = $SQLSEAFILEPW
DB = ccnet-db
CONNECTION_CHARSET = utf8
EOF
# -------------------------------------------
# Configuring seafile.conf
# -------------------------------------------
cat >> ${DEFAULT_CONF_DIR}/seafile.conf <<EOF
[database]
type = mysql
host = 127.0.0.1
port = 3306
user = seafile
password = $SQLSEAFILEPW
db_name = seafile-db
connection_charset = utf8
EOF
# ------------------------------------------- # -------------------------------------------
# Configuring seahub_settings.py # Configuring seahub_settings.py
# ------------------------------------------- # -------------------------------------------
cat >> ${DEST_SETTINGS_PY} <<EOF cat >> ${DEST_SETTINGS_PY} <<EOF
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'seahub-db',
'USER': 'seafile',
'PASSWORD': '$SQLSEAFILEPW',
'HOST': '127.0.0.1',
'PORT': '3306',
'OPTIONS': {
'init_command': 'SET storage_engine=INNODB',
}
}
}
CACHES = { CACHES = {
'default': { 'default': {
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', 'BACKEND': 'django_pylibmc.memcached.PyLibMCCache',
'LOCATION': '127.0.0.1:11211', 'LOCATION': '127.0.0.1:11211',
} },
'locmem': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
},
} }
COMPRESS_CACHE_BACKEND = 'locmem'
EMAIL_USE_TLS = False # EMAIL_USE_TLS = False
EMAIL_HOST = 'localhost' # EMAIL_HOST = 'localhost'
EMAIL_HOST_USER = '' # EMAIL_HOST_USER = ''
EMAIL_HOST_PASSWORD = '' # EMAIL_HOST_PASSWORD = ''
EMAIL_PORT = '25' # EMAIL_PORT = '25'
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER # DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
SERVER_EMAIL = EMAIL_HOST_USER # SERVER_EMAIL = EMAIL_HOST_USER
TIME_ZONE = '${TIME_ZONE}' TIME_ZONE = '${TIME_ZONE}'
SITE_BASE = 'http://${IP_OR_DOMAIN}' SITE_BASE = 'http://${IP_OR_DOMAIN}'
SITE_NAME = 'Seafile Server' SITE_NAME = 'Seafile Server'
SITE_TITLE = 'Seafile Server' SITE_TITLE = 'Seafile Server'
SITE_ROOT = '/' SITE_ROOT = '/'
USE_PDFJS = True
ENABLE_SIGNUP = False ENABLE_SIGNUP = False
ACTIVATE_AFTER_REGISTRATION = False ACTIVATE_AFTER_REGISTRATION = False
SEND_EMAIL_ON_ADDING_SYSTEM_MEMBER = True SEND_EMAIL_ON_ADDING_SYSTEM_MEMBER = True
@ -534,11 +419,15 @@ eval "sed -i 's/= ask_admin_password()/= \"${SEAFILE_ADMIN_PW}\"/' ${INSTALLPATH
# ------------------------------------------- # -------------------------------------------
# Start and stop Seafile eco system. This generates the initial admin user. # Start and stop Seafile eco system. This generates the initial admin user.
# ------------------------------------------- # -------------------------------------------
${INSTALLPATH}/seafile.sh start chown ${SEAFILE_SERVER_USER}:${SEAFILE_SERVER_USER} -R ${SEAFILE_SERVER_HOME}
${INSTALLPATH}/seahub.sh start
${INSTALLPATH}/seahub.sh stop
${INSTALLPATH}/seafile.sh stop
su - seafile -c "${INSTALLPATH}/seafile.sh start"
su - seafile -c "${INSTALLPATH}/seahub.sh start"
wait # sleep for a while, otherwise seahub will not be stopped
su - seafile -c "${INSTALLPATH}/seahub.sh stop"
sleep 1
su - seafile -c "${INSTALLPATH}/seafile.sh stop"
sleep 1
# ------------------------------------------- # -------------------------------------------
# Restore original check_init_admin.py # Restore original check_init_admin.py
@ -547,15 +436,22 @@ mv ${INSTALLPATH}/check_init_admin.py.backup ${INSTALLPATH}/check_init_admin.py
if is_pro; then if is_pro; then
PRO_PY=${INSTALLPATH}/pro/pro.py PRO_PY=${INSTALLPATH}/pro/pro.py
$PYTHON ${PRO_PY} setup --mysql --mysql_host=127.0.0.1 --mysql_port=3306 --mysql_user=seafile --mysql_password=${SQLSEAFILEPW} --mysql_db=seahub-db $PYTHON ${PRO_PY} setup --mysql --mysql_host=127.0.0.1 --mysql_port=3306 --mysql_user=seafile --mysql_password=${SQLSEAFILEPW} --mysql_db=seahub_db
sed -i 's/enabled = false/enabled = true/' ${TOPDIR}/conf/seafevents.conf
fi fi
# kill all process
sleep 1
pkill -9 -u seafile
sleep 1
# ------------------------------------------- # -------------------------------------------
# Fix permissions # Fix permissions
# ------------------------------------------- # -------------------------------------------
chown ${SEAFILE_USER}.nogroup -R /opt/seafile/ chown ${SEAFILE_SERVER_USER}:${SEAFILE_SERVER_USER} -R ${SEAFILE_SERVER_HOME}
if [[ -d /tmp/seafile-office-output/ ]]; then
chown ${SEAFILE_SERVER_USER}:${SEAFILE_SERVER_USER} -R /tmp/seafile-office-output/
fi
# ------------------------------------------- # -------------------------------------------
# Start seafile server # Start seafile server
@ -567,12 +463,11 @@ service seafile-server start
# ------------------------------------------- # -------------------------------------------
# Final report # Final report
# ------------------------------------------- # -------------------------------------------
cat > ${seafile_dir}/aio_seafile-server.log<<EOF cat > ${TOPDIR}/aio_seafile-server.log<<EOF
Your Seafile server is installed Your Seafile server is installed
----------------------------------------------------------------- -----------------------------------------------------------------
Server Name: ${SERVER_NAME}
Server Address: http://${IP_OR_DOMAIN} Server Address: http://${IP_OR_DOMAIN}
Seafile Admin: ${SEAFILE_ADMIN} Seafile Admin: ${SEAFILE_ADMIN}
@ -580,23 +475,26 @@ cat > ${seafile_dir}/aio_seafile-server.log<<EOF
Seafile Data Dir: ${SEAFILE_DATA_DIR} Seafile Data Dir: ${SEAFILE_DATA_DIR}
Seafile DB Credentials: Check /opt/seafile/.my.cnf Seafile DB Credentials: Check /opt/seafile.my.cnf
Root DB Credentials: Check /root/.my.cnf Root DB Credentials: Check /root/.my.cnf
This report is also saved to ${seafile_dir}/aio_seafile-server.log This report is also saved to ${TOPDIR}/aio_seafile-server.log
Next you should manually complete the following steps Next you should manually complete the following steps
----------------------------------------------------------------- -----------------------------------------------------------------
1) Run seafile-server-change-address to add your Seafile servers DNS name 1) Log in to Seafile and configure your server domain via the system
admin area if applicable.
2) If this server is behind a firewall, you need to ensure that 2) If this server is behind a firewall, you need to ensure that
tcp port 80 is open. tcp port 80 is open.
3) Seahub tries to send emails via the local server. Install and 3) Seahub tries to send emails via the local server. Install and
configure Postfix for this to work. configure Postfix for this to work or
check https://manual.seafile.com/config/sending_email.html
for instructions on how to use an existing email account via SMTP.
@ -626,15 +524,13 @@ cat > ${seafile_dir}/aio_seafile-server.log<<EOF
Seafile support options Seafile support options
----------------------------------------------------------------- -----------------------------------------------------------------
For free community support visit: https://forum.seafile-server.org For free community support visit: https://bbs.seafile.com
For paid commercial support visit: https://seafile.com For paid commercial support visit: https://seafile.com
EOF EOF
chmod 600 ${seafile_dir}/aio_seafile-server.log chmod 600 ${TOPDIR}/aio_seafile-server.log
chown -R ${SEAFILE_USER}.nogroup ${seafile_dir}/aio_seafile-server.log
clear clear
cat ${seafile_dir}/aio_seafile-server.log cat ${TOPDIR}/aio_seafile-server.log

539
seafile-8.0_ubuntu Normal file
View File

@ -0,0 +1,539 @@
#!/bin/bash
#
# seafile-server-installer-cn/seafile-8.0_ubuntu
#
# Copyright 2015, Alexander Jackson <alexander.jackson@seafile.de>
# Copyright 2016, Zheng Xie <xie.zheng@seafile.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#
if [[ $HOME == "" ]]; then
export HOME=/root
fi
if [[ $SEAFILE_DEBUG != "" ]]; then
set -x
fi
set -e
if [[ "$#" -ne 1 ]]; then
echo "You must specif Seafile version to install"
echo "Like: $0 8.0.0"
exit 1
fi
clear
cat <<EOF
This script installs the community/professional edition of the Seafile Server on a Ubuntu 18.04/20.04 64bit
- Newest Seafile server version, MariaDB, Memcached, NGINX -
-----------------------------------------------------------------
This installer is meant to run on a freshly installed machine
only. If you run it on a production server things can and
probably will go terribly wrong and you will lose valuable
data!
For questions or suggestions please contact us at
support@seafile.com
-----------------------------------------------------------------
Possible options:
1 = Seafile Community (Free) Edition (CE)
2 = Seafile Professional Edition (PRO)
EOF
if [[ ${SEAFILE_PRO} == "" ]]; then
PS3="Which Seafile version would you like to install? "
select SEAFILE_SERVER_VERSION in CE PRO ABORT; do
case "${SEAFILE_SERVER_VERSION}" in
ABORT)
echo "Aborting"
break
;;
"")
echo "$REPLY: Wrong value. Select 1 or 2."
;;
*)
if [[ ${SEAFILE_SERVER_VERSION} = "PRO" ]]; then
SEAFILE_PRO=1
else
SEAFILE_PRO=0
fi
break
esac
done
fi
is_pro() {
if [[ "$SEAFILE_PRO" == "1" ]]; then
return 0
else
return 1
fi
}
echo
if is_pro; then
echo "This script will install Seafile Professional Edition for you."
else
echo "This script will install Seafile Community Edition for you."
fi
echo
# -------------------------------------------
# Vars
# -------------------------------------------
SEAFILE_ADMIN=admin@seafile.local
SEAFILE_SERVER_USER=seafile
SEAFILE_SERVER_HOME=/opt/seafile
IP_OR_DOMAIN=127.0.0.1
SEAFILE_VERSION=$1
TIME_ZONE=Asia/Shanghai
if is_pro; then
SEAFILE_SERVER_PACKAGE=seafile-pro-server_${SEAFILE_VERSION}_x86-64.tar.gz
if [[ ! -e /opt/$SEAFILE_SERVER_PACKAGE ]]; then
echo
echo "You must download \"$SEAFILE_SERVER_PACKAGE\" to the /opt/ folder before running this script!"
echo
exit 1
fi
INSTALLPATH=${SEAFILE_SERVER_HOME}/seafile-pro-server-${SEAFILE_VERSION}/
else
SEAFILE_SERVER_PACKAGE=seafile-server_${SEAFILE_VERSION}_x86-64.tar.gz
SEAFILE_SERVER_PACKAGE_URL=http://seafile-downloads.oss-cn-shanghai.aliyuncs.com/${SEAFILE_SERVER_PACKAGE}
INSTALLPATH=${SEAFILE_SERVER_HOME}/seafile-server-${SEAFILE_VERSION}/
fi
# -------------------------------------------
# Ensure we are running the installer as root
# -------------------------------------------
if [[ $EUID -ne 0 ]]; then
echo " Aborting because you are not root" ; exit 1
fi
# -------------------------------------------
# Abort if directory SEAFILE_SERVER_HOME exists
# -------------------------------------------
if [[ -d "${SEAFILE_SERVER_HOME}" ]] ;
then
echo " Aborting because directory ${SEAFILE_SERVER_HOME} already exist" ; exit 1
fi
# -------------------------------------------
# Abort if seafile user exists
# -------------------------------------------
if getent passwd ${SEAFILE_SERVER_USER} > /dev/null 2>&1 ;
then
echo "Aborting because user ${SEAFILE_SERVER_USER} already exist" ; exit 1
fi
# -------------------------------------------
# Additional requirements
# -------------------------------------------
apt-get update
apt-get install -y python3 python3-setuptools python3-pip python3-ldap memcached openjdk-8-jre \
libmemcached-dev libreoffice-script-provider-python libreoffice pwgen curl nginx libmysqlclient-dev
pip3 install --timeout=3600 django==2.2.* future mysqlclient pymysql Pillow pylibmc captcha markupsafe==2.0.1 jinja2 sqlalchemy==1.4.3 \
psd-tools django-pylibmc django-simple-captcha
service memcached start
# -------------------------------------------
# Setup Nginx
# -------------------------------------------
rm /etc/nginx/sites-enabled/*
cat > /etc/nginx/sites-available/seafile.conf << EOF
log_format seafileformat '\$http_x_forwarded_for \$remote_addr [\$time_local] "\$request" \$status \$body_bytes_sent "\$http_referer" "\$http_user_agent" \$upstream_response_time';
server {
listen 80;
server_name seafile.example.com;
proxy_set_header X-Forwarded-For \$remote_addr;
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host \$host;
proxy_set_header X-Real-IP \$remote_addr;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host \$server_name;
proxy_set_header X-Forwarded-Proto \$scheme;
proxy_read_timeout 1200s;
# used for view/edit office file via Office Online Server
client_max_body_size 0;
access_log /var/log/nginx/seahub.access.log seafileformat;
error_log /var/log/nginx/seahub.error.log;
}
location /seafhttp {
rewrite ^/seafhttp(.*)$ \$1 break;
proxy_pass http://127.0.0.1:8082;
client_max_body_size 0;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_connect_timeout 36000s;
proxy_read_timeout 36000s;
access_log /var/log/nginx/seafhttp.access.log seafileformat;
error_log /var/log/nginx/seafhttp.error.log;
}
location /media {
root ${SEAFILE_SERVER_HOME}/seafile-server-latest/seahub;
}
location /seafdav {
proxy_pass http://127.0.0.1:8080/seafdav;
proxy_set_header Host \$host;
proxy_set_header X-Real-IP \$remote_addr;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host \$server_name;
proxy_set_header X-Forwarded-Proto \$scheme;
proxy_read_timeout 1200s;
client_max_body_size 0;
access_log /var/log/nginx/seafdav.access.log seafileformat;
error_log /var/log/nginx/seafdav.error.log;
}
}
EOF
ln -sf /etc/nginx/sites-available/seafile.conf /etc/nginx/sites-enabled/seafile.conf
service nginx restart
# -------------------------------------------
# MariaDB
# -------------------------------------------
if [[ -f "/root/.my.cnf" ]] ;
then
echo "MariaDB installed before, skip this part"
SQLROOTPW=`sed -n 's/password=//p' /root/.my.cnf`
else
DEBIAN_FRONTEND=noninteractive apt-get install -y mariadb-server
service mysql start
SQLROOTPW=$(pwgen)
mysqladmin -u root password $SQLROOTPW
cat > /root/.my.cnf <<EOF
[client]
user=root
password=$SQLROOTPW
EOF
chmod 600 /root/.my.cnf
fi
# -------------------------------------------
# Seafile init script
# -------------------------------------------
cat > /etc/init.d/seafile-server << EOF
#!/bin/bash
### BEGIN INIT INFO
# Provides: seafile-server
# Required-Start: \$remote_fs \$syslog mysql
# Required-Stop: \$remote_fs \$syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Seafile server
# Description: Start Seafile server
### END INIT INFO
# Author: Alexander Jackson <alexander.jackson@seafile.de>
# Change the value of "seafile_dir" to your path of seafile installation
user=${SEAFILE_SERVER_USER}
seafile_dir=${SEAFILE_SERVER_HOME}
script_path=\${seafile_dir}/seafile-server-latest
seafile_init_log=\${seafile_dir}/logs/seafile.init.log
seahub_init_log=\${seafile_dir}/logs/seahub.init.log
case "\$1" in
start)
sudo -u \${user} \${script_path}/seafile.sh start >> \${seafile_init_log}
sudo -u \${user} \${script_path}/seahub.sh start >> \${seahub_init_log}
;;
restart)
sudo -u \${user} \${script_path}/seafile.sh restart >> \${seafile_init_log}
sudo -u \${user} \${script_path}/seahub.sh restart >> \${seahub_init_log}
;;
stop)
sudo -u \${user} \${script_path}/seafile.sh \$1 >> \${seafile_init_log}
sudo -u \${user} \${script_path}/seahub.sh \$1 >> \${seahub_init_log}
;;
*)
echo "Usage: /etc/init.d/seafile-server {start|stop|restart}"
exit 1
;;
esac
EOF
chmod +x /etc/init.d/seafile-server
update-rc.d seafile-server defaults
# -------------------------------------------
# Seafile
# -------------------------------------------
mkdir -p ${SEAFILE_SERVER_HOME}/installed
cd ${SEAFILE_SERVER_HOME}
if ! is_pro && [[ ! -e /opt/${SEAFILE_SERVER_PACKAGE} ]]; then
curl -OL ${SEAFILE_SERVER_PACKAGE_URL}
else
cp /opt/${SEAFILE_SERVER_PACKAGE} .
fi
tar xzf ${SEAFILE_SERVER_PACKAGE}
mv ${SEAFILE_SERVER_PACKAGE} installed
# -------------------------------------------
# Seafile DB
# -------------------------------------------
if [[ -f "/opt/seafile.my.cnf" ]] ;
then
echo "MariaDB installed before, skip this part"
SQLSEAFILEPW=`sed -n 's/password=//p' /opt/seafile.my.cnf`
else
SQLSEAFILEPW=$(pwgen)
cat > /opt/seafile.my.cnf <<EOF
[client]
user=seafile
password=$SQLSEAFILEPW
EOF
chmod 600 /opt/seafile.my.cnf
fi
# -------------------------------------------
# Add seafile user
# -------------------------------------------
useradd --system --comment "${SEAFILE_SERVER_USER}" ${SEAFILE_SERVER_USER} --home-dir ${SEAFILE_SERVER_HOME}
# -------------------------------------------
# Go to /opt/seafile/seafile-pro-server-${SEAFILE_VERSION}
# -------------------------------------------
cd $INSTALLPATH
# -------------------------------------------
# Vars - Don't touch these unless you really know what you are doing!
# -------------------------------------------
TOPDIR=$(dirname "${INSTALLPATH}")
DEFAULT_CONF_DIR=${TOPDIR}/conf
SEAFILE_DATA_DIR=${TOPDIR}/seafile-data
DEST_SETTINGS_PY=${TOPDIR}/conf/seahub_settings.py
mkdir -p ${DEFAULT_CONF_DIR}
# -------------------------------------------
# Create ccnet, seafile, seahub conf using setup script
# -------------------------------------------
./setup-seafile-mysql.sh auto -u seafile -w ${SQLSEAFILEPW} -r ${SQLROOTPW}
# -------------------------------------------
# Configure Seafile WebDAV Server(SeafDAV)
# -------------------------------------------
sed -i 's/enabled = .*/enabled = true/' ${DEFAULT_CONF_DIR}/seafdav.conf
sed -i 's/share_name = .*/share_name = \/seafdav/' ${DEFAULT_CONF_DIR}/seafdav.conf
# -------------------------------------------
# Configuring seahub_settings.py
# -------------------------------------------
cat >> ${DEST_SETTINGS_PY} <<EOF
CACHES = {
'default': {
'BACKEND': 'django_pylibmc.memcached.PyLibMCCache',
'LOCATION': '127.0.0.1:11211',
},
'locmem': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
},
}
COMPRESS_CACHE_BACKEND = 'locmem'
# EMAIL_USE_TLS = False
# EMAIL_HOST = 'localhost'
# EMAIL_HOST_USER = ''
# EMAIL_HOST_PASSWORD = ''
# EMAIL_PORT = '25'
# DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
# SERVER_EMAIL = EMAIL_HOST_USER
TIME_ZONE = '${TIME_ZONE}'
SITE_BASE = 'http://${IP_OR_DOMAIN}'
SITE_NAME = 'Seafile Server'
SITE_TITLE = 'Seafile Server'
SITE_ROOT = '/'
ENABLE_SIGNUP = False
ACTIVATE_AFTER_REGISTRATION = False
SEND_EMAIL_ON_ADDING_SYSTEM_MEMBER = True
SEND_EMAIL_ON_RESETTING_USER_PASSWD = True
CLOUD_MODE = False
FILE_PREVIEW_MAX_SIZE = 30 * 1024 * 1024
SESSION_COOKIE_AGE = 60 * 60 * 24 * 7 * 2
SESSION_SAVE_EVERY_REQUEST = False
SESSION_EXPIRE_AT_BROWSER_CLOSE = False
FILE_SERVER_ROOT = 'http://${IP_OR_DOMAIN}/seafhttp'
EOF
# -------------------------------------------
# Backup check_init_admin.py befor applying changes
# -------------------------------------------
cp ${INSTALLPATH}/check_init_admin.py ${INSTALLPATH}/check_init_admin.py.backup
# -------------------------------------------
# Set admin credentials in check_init_admin.py
# -------------------------------------------
SEAFILE_ADMIN_PW=$(pwgen)
eval "sed -i 's/= ask_admin_email()/= \"${SEAFILE_ADMIN}\"/' ${INSTALLPATH}/check_init_admin.py"
eval "sed -i 's/= ask_admin_password()/= \"${SEAFILE_ADMIN_PW}\"/' ${INSTALLPATH}/check_init_admin.py"
# -------------------------------------------
# Start and stop Seafile eco system. This generates the initial admin user.
# -------------------------------------------
chown ${SEAFILE_SERVER_USER}:${SEAFILE_SERVER_USER} -R ${SEAFILE_SERVER_HOME}
su - seafile -c "${INSTALLPATH}/seafile.sh start"
wait
su - seafile -c "${INSTALLPATH}/seahub.sh start"
wait # sleep for a while, otherwise seahub will not be stopped
su - seafile -c "${INSTALLPATH}/seahub.sh stop"
wait
su - seafile -c "${INSTALLPATH}/seafile.sh stop"
wait
sleep 1
# -------------------------------------------
# Restore original check_init_admin.py
# -------------------------------------------
mv ${INSTALLPATH}/check_init_admin.py.backup ${INSTALLPATH}/check_init_admin.py
if is_pro; then
PRO_PY=${INSTALLPATH}/pro/pro.py
$PYTHON ${PRO_PY} setup --mysql --mysql_host=127.0.0.1 --mysql_port=3306 --mysql_user=seafile --mysql_password=${SQLSEAFILEPW} --mysql_db=seahub_db
fi
# kill all process
sleep 1
service seafile-server stop
wait
sleep 1
# -------------------------------------------
# Fix permissions
# -------------------------------------------
chown ${SEAFILE_SERVER_USER}:${SEAFILE_SERVER_USER} -R ${SEAFILE_SERVER_HOME}
if [[ -d /tmp/seafile-office-output/ ]]; then
chown ${SEAFILE_SERVER_USER}:${SEAFILE_SERVER_USER} -R /tmp/seafile-office-output/
fi
# -------------------------------------------
# Start seafile server
# -------------------------------------------
echo "Starting productive Seafile server"
service seafile-server restart
wait
# -------------------------------------------
# Final report
# -------------------------------------------
cat > ${TOPDIR}/aio_seafile-server.log<<EOF
Your Seafile server is installed
-----------------------------------------------------------------
Server Address: http://${IP_OR_DOMAIN}
Seafile Admin: ${SEAFILE_ADMIN}
Admin Password: ${SEAFILE_ADMIN_PW}
Seafile Data Dir: ${SEAFILE_DATA_DIR}
Seafile DB Credentials: Check /opt/seafile.my.cnf
Root DB Credentials: Check /root/.my.cnf
This report is also saved to ${TOPDIR}/aio_seafile-server.log
Next you should manually complete the following steps
-----------------------------------------------------------------
1) Log in to Seafile and configure your server domain via the system
admin area if applicable.
2) If this server is behind a firewall, you need to ensure that
tcp port 80 is open.
3) Check https://manual.seafile.com/config/sending_email/
for instructions on how to use an existing email account to send email via SMTP.
Optional steps
-----------------------------------------------------------------
1) Check seahub_settings.py and customize it to fit your needs. Consult
https://manual.seafile.com/config/seahub_settings_py/ for possible switches.
2) Setup NGINX with official SSL certificate, we suggest you use Lets Encrypt. Check
https://manual.seafile.com/deploy/https_with_nginx/
3) Secure server with iptables based firewall. For instance: UFW or shorewall
4) Implement a backup routine for your Seafile server.
Seafile support options
-----------------------------------------------------------------
For free community support visit: https://bbs.seafile.com
For paid commercial support visit: https://seafile.com
EOF
chmod 600 ${TOPDIR}/aio_seafile-server.log
clear
cat ${TOPDIR}/aio_seafile-server.log

541
seafile-9.0_ubuntu Normal file
View File

@ -0,0 +1,541 @@
#!/bin/bash
#
# seafile-server-installer-cn/seafile-9.0_ubuntu
#
# Copyright 2015, Alexander Jackson <alexander.jackson@seafile.de>
# Copyright 2016, Zheng Xie <xie.zheng@seafile.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#
if [[ $HOME == "" ]]; then
export HOME=/root
fi
if [[ $SEAFILE_DEBUG != "" ]]; then
set -x
fi
set -e
if [[ "$#" -ne 1 ]]; then
echo "You must specif Seafile version to install"
echo "Like: $0 9.0.0"
exit 1
fi
clear
cat <<EOF
This script installs the community/professional edition of the Seafile Server on a Ubuntu 18.04/20.04 64bit
- Newest Seafile server version, MariaDB, Memcached, NGINX -
-----------------------------------------------------------------
This installer is meant to run on a freshly installed machine
only. If you run it on a production server things can and
probably will go terribly wrong and you will lose valuable
data!
For questions or suggestions please contact us at
support@seafile.com
-----------------------------------------------------------------
Possible options:
1 = Seafile Community (Free) Edition (CE)
2 = Seafile Professional Edition (PRO)
EOF
if [[ ${SEAFILE_PRO} == "" ]]; then
PS3="Which Seafile version would you like to install? "
select SEAFILE_SERVER_VERSION in CE PRO ABORT; do
case "${SEAFILE_SERVER_VERSION}" in
ABORT)
echo "Aborting"
break
;;
"")
echo "$REPLY: Wrong value. Select 1 or 2."
;;
*)
if [[ ${SEAFILE_SERVER_VERSION} = "PRO" ]]; then
SEAFILE_PRO=1
else
SEAFILE_PRO=0
fi
break
esac
done
fi
is_pro() {
if [[ "$SEAFILE_PRO" == "1" ]]; then
return 0
else
return 1
fi
}
echo
if is_pro; then
echo "This script will install Seafile Professional Edition for you."
else
echo "This script will install Seafile Community Edition for you."
fi
echo
# -------------------------------------------
# Vars
# -------------------------------------------
SEAFILE_ADMIN=admin@seafile.local
SEAFILE_SERVER_USER=seafile
SEAFILE_SERVER_HOME=/opt/seafile
IP_OR_DOMAIN=127.0.0.1
SEAFILE_VERSION=$1
TIME_ZONE=Asia/Shanghai
if is_pro; then
SEAFILE_SERVER_PACKAGE=seafile-pro-server_${SEAFILE_VERSION}_x86-64.tar.gz
if [[ ! -e /opt/$SEAFILE_SERVER_PACKAGE ]]; then
echo
echo "You must download \"$SEAFILE_SERVER_PACKAGE\" to the /opt/ folder before running this script!"
echo
exit 1
fi
INSTALLPATH=${SEAFILE_SERVER_HOME}/seafile-pro-server-${SEAFILE_VERSION}/
else
SEAFILE_SERVER_PACKAGE=seafile-server_${SEAFILE_VERSION}_x86-64.tar.gz
SEAFILE_SERVER_PACKAGE_URL=http://seafile-downloads.oss-cn-shanghai.aliyuncs.com/${SEAFILE_SERVER_PACKAGE}
INSTALLPATH=${SEAFILE_SERVER_HOME}/seafile-server-${SEAFILE_VERSION}/
fi
# -------------------------------------------
# Ensure we are running the installer as root
# -------------------------------------------
if [[ $EUID -ne 0 ]]; then
echo " Aborting because you are not root" ; exit 1
fi
# -------------------------------------------
# Abort if directory SEAFILE_SERVER_HOME exists
# -------------------------------------------
if [[ -d "${SEAFILE_SERVER_HOME}" ]] ;
then
echo " Aborting because directory ${SEAFILE_SERVER_HOME} already exist" ; exit 1
fi
# -------------------------------------------
# Abort if seafile user exists
# -------------------------------------------
if getent passwd ${SEAFILE_SERVER_USER} > /dev/null 2>&1 ;
then
echo "Aborting because user ${SEAFILE_SERVER_USER} already exist" ; exit 1
fi
# -------------------------------------------
# Additional requirements
# -------------------------------------------
apt-get update
apt-get install -y python3 python3-setuptools python3-pip python3-ldap memcached openjdk-8-jre \
libmemcached-dev libreoffice-script-provider-python libreoffice pwgen curl nginx libmysqlclient-dev
pip3 install --timeout=3600 django==3.2.* future mysqlclient pymysql Pillow==9.4.0 pylibmc captcha markupsafe==2.0.1 jinja2 sqlalchemy==1.4.3 psd-tools django-pylibmc django-simple-captcha pycryptodome==3.12.0 cffi==1.14.0 lxml
service memcached start
# -------------------------------------------
# Setup Nginx
# -------------------------------------------
rm /etc/nginx/sites-enabled/*
cat > /etc/nginx/sites-available/seafile.conf << EOF
log_format seafileformat '\$http_x_forwarded_for \$remote_addr [\$time_local] "\$request" \$status \$body_bytes_sent "\$http_referer" "\$http_user_agent" \$upstream_response_time';
server {
listen 80;
server_name seafile.example.com;
proxy_set_header X-Forwarded-For \$remote_addr;
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host \$host;
proxy_set_header X-Real-IP \$remote_addr;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host \$server_name;
proxy_set_header X-Forwarded-Proto \$scheme;
proxy_read_timeout 1200s;
# used for view/edit office file via Office Online Server
client_max_body_size 0;
access_log /var/log/nginx/seahub.access.log seafileformat;
error_log /var/log/nginx/seahub.error.log;
}
location /seafhttp {
rewrite ^/seafhttp(.*)$ \$1 break;
proxy_pass http://127.0.0.1:8082;
client_max_body_size 0;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_connect_timeout 36000s;
proxy_read_timeout 36000s;
access_log /var/log/nginx/seafhttp.access.log seafileformat;
error_log /var/log/nginx/seafhttp.error.log;
}
location /media {
root ${SEAFILE_SERVER_HOME}/seafile-server-latest/seahub;
}
location /seafdav {
proxy_pass http://127.0.0.1:8080/seafdav;
proxy_set_header Host \$host;
proxy_set_header X-Real-IP \$remote_addr;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host \$server_name;
proxy_set_header X-Forwarded-Proto \$scheme;
proxy_read_timeout 1200s;
client_max_body_size 0;
access_log /var/log/nginx/seafdav.access.log seafileformat;
error_log /var/log/nginx/seafdav.error.log;
}
}
EOF
ln -sf /etc/nginx/sites-available/seafile.conf /etc/nginx/sites-enabled/seafile.conf
service nginx restart
# -------------------------------------------
# MariaDB
# -------------------------------------------
if [[ -f "/root/.my.cnf" ]] ;
then
echo "MariaDB installed before, skip this part"
SQLROOTPW=`sed -n 's/password=//p' /root/.my.cnf`
else
DEBIAN_FRONTEND=noninteractive apt-get install -y mariadb-server
service mysql start
SQLROOTPW=$(pwgen)
mysqladmin -u root password $SQLROOTPW
cat > /root/.my.cnf <<EOF
[client]
user=root
password=$SQLROOTPW
EOF
chmod 600 /root/.my.cnf
fi
# -------------------------------------------
# Seafile init script
# -------------------------------------------
cat > /etc/init.d/seafile-server << EOF
#!/bin/bash
### BEGIN INIT INFO
# Provides: seafile-server
# Required-Start: \$remote_fs \$syslog mysql
# Required-Stop: \$remote_fs \$syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Seafile server
# Description: Start Seafile server
### END INIT INFO
# Author: Alexander Jackson <alexander.jackson@seafile.com.de>
# Change the value of "seafile_dir" to your path of seafile installation
user=${SEAFILE_SERVER_USER}
seafile_dir=${SEAFILE_SERVER_HOME}
script_path=\${seafile_dir}/seafile-server-latest
seafile_init_log=\${seafile_dir}/logs/seafile.init.log
seahub_init_log=\${seafile_dir}/logs/seahub.init.log
case "\$1" in
start)
sudo -u \${user} \${script_path}/seafile.sh start >> \${seafile_init_log}
sudo -u \${user} \${script_path}/seahub.sh start >> \${seahub_init_log}
;;
restart)
sudo -u \${user} \${script_path}/seafile.sh restart >> \${seafile_init_log}
sudo -u \${user} \${script_path}/seahub.sh restart >> \${seahub_init_log}
;;
stop)
sudo -u \${user} \${script_path}/seafile.sh \$1 >> \${seafile_init_log}
sudo -u \${user} \${script_path}/seahub.sh \$1 >> \${seahub_init_log}
;;
*)
echo "Usage: /etc/init.d/seafile-server {start|stop|restart}"
exit 1
;;
esac
EOF
chmod +x /etc/init.d/seafile-server
update-rc.d seafile-server defaults
# -------------------------------------------
# Seafile
# -------------------------------------------
mkdir -p ${SEAFILE_SERVER_HOME}/installed
cd ${SEAFILE_SERVER_HOME}
if ! is_pro && [[ ! -e /opt/${SEAFILE_SERVER_PACKAGE} ]]; then
curl -OL ${SEAFILE_SERVER_PACKAGE_URL}
else
cp /opt/${SEAFILE_SERVER_PACKAGE} .
fi
tar xzf ${SEAFILE_SERVER_PACKAGE}
mv ${SEAFILE_SERVER_PACKAGE} installed
# -------------------------------------------
# Seafile DB
# -------------------------------------------
if [[ -f "/opt/seafile.my.cnf" ]] ;
then
echo "MariaDB installed before, skip this part"
SQLSEAFILEPW=`sed -n 's/password=//p' /opt/seafile.my.cnf`
else
SQLSEAFILEPW=$(pwgen)
cat > /opt/seafile.my.cnf <<EOF
[client]
user=seafile
password=$SQLSEAFILEPW
EOF
chmod 600 /opt/seafile.my.cnf
fi
# -------------------------------------------
# Add seafile user
# -------------------------------------------
useradd --system --comment "${SEAFILE_SERVER_USER}" ${SEAFILE_SERVER_USER} --home-dir ${SEAFILE_SERVER_HOME}
# -------------------------------------------
# Go to /opt/seafile/seafile-pro-server-${SEAFILE_VERSION}
# -------------------------------------------
cd $INSTALLPATH
# -------------------------------------------
# Vars - Don't touch these unless you really know what you are doing!
# -------------------------------------------
TOPDIR=$(dirname "${INSTALLPATH}")
DEFAULT_CONF_DIR=${TOPDIR}/conf
SEAFILE_DATA_DIR=${TOPDIR}/seafile-data
DEST_SETTINGS_PY=${TOPDIR}/conf/seahub_settings.py
mkdir -p ${DEFAULT_CONF_DIR}
# -------------------------------------------
# Create ccnet, seafile, seahub conf using setup script
# -------------------------------------------
./setup-seafile-mysql.sh auto -u seafile -w ${SQLSEAFILEPW} -r ${SQLROOTPW}
# -------------------------------------------
# Configure Seafile WebDAV Server(SeafDAV)
# -------------------------------------------
sed -i 's/enabled = .*/enabled = true/' ${DEFAULT_CONF_DIR}/seafdav.conf
sed -i 's/share_name = .*/share_name = \/seafdav/' ${DEFAULT_CONF_DIR}/seafdav.conf
# -------------------------------------------
# Configuring seahub_settings.py
# -------------------------------------------
cat >> ${DEST_SETTINGS_PY} <<EOF
CACHES = {
'default': {
'BACKEND': 'django_pylibmc.memcached.PyLibMCCache',
'LOCATION': '127.0.0.1:11211',
},
'locmem': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
},
}
COMPRESS_CACHE_BACKEND = 'locmem'
# EMAIL_USE_TLS = False
# EMAIL_HOST = 'localhost'
# EMAIL_HOST_USER = ''
# EMAIL_HOST_PASSWORD = ''
# EMAIL_PORT = '25'
# DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
# SERVER_EMAIL = EMAIL_HOST_USER
TIME_ZONE = '${TIME_ZONE}'
SITE_BASE = 'http://${IP_OR_DOMAIN}'
SITE_NAME = 'Seafile Server'
SITE_TITLE = 'Seafile Server'
SITE_ROOT = '/'
ENABLE_SIGNUP = False
ACTIVATE_AFTER_REGISTRATION = False
SEND_EMAIL_ON_ADDING_SYSTEM_MEMBER = True
SEND_EMAIL_ON_RESETTING_USER_PASSWD = True
CLOUD_MODE = False
FILE_PREVIEW_MAX_SIZE = 30 * 1024 * 1024
SESSION_COOKIE_AGE = 60 * 60 * 24 * 7 * 2
SESSION_SAVE_EVERY_REQUEST = False
SESSION_EXPIRE_AT_BROWSER_CLOSE = False
SERVICE_URL = 'http://${IP_OR_DOMAIN}'
FILE_SERVER_ROOT = 'http://${IP_OR_DOMAIN}/seafhttp'
EOF
# -------------------------------------------
# Backup check_init_admin.py befor applying changes
# -------------------------------------------
cp ${INSTALLPATH}/check_init_admin.py ${INSTALLPATH}/check_init_admin.py.backup
# -------------------------------------------
# Set admin credentials in check_init_admin.py
# -------------------------------------------
SEAFILE_ADMIN_PW=$(pwgen)
eval "sed -i 's/= ask_admin_email()/= \"${SEAFILE_ADMIN}\"/' ${INSTALLPATH}/check_init_admin.py"
eval "sed -i 's/= ask_admin_password()/= \"${SEAFILE_ADMIN_PW}\"/' ${INSTALLPATH}/check_init_admin.py"
# -------------------------------------------
# Start and stop Seafile eco system. This generates the initial admin user.
# -------------------------------------------
chown ${SEAFILE_SERVER_USER}:${SEAFILE_SERVER_USER} -R ${SEAFILE_SERVER_HOME}
su - seafile -c "${INSTALLPATH}/seafile.sh start"
wait
su - seafile -c "${INSTALLPATH}/seahub.sh start"
wait # sleep for a while, otherwise seahub will not be stopped
su - seafile -c "${INSTALLPATH}/seahub.sh stop"
wait
su - seafile -c "${INSTALLPATH}/seafile.sh stop"
wait
sleep 1
# -------------------------------------------
# Restore original check_init_admin.py
# -------------------------------------------
mv ${INSTALLPATH}/check_init_admin.py.backup ${INSTALLPATH}/check_init_admin.py
if is_pro; then
PRO_PY=${INSTALLPATH}/pro/pro.py
$PYTHON ${PRO_PY} setup --mysql --mysql_host=127.0.0.1 --mysql_port=3306 --mysql_user=seafile --mysql_password=${SQLSEAFILEPW} --mysql_db=seahub_db
fi
# kill all process
sleep 1
service seafile-server stop
wait
sleep 1
# -------------------------------------------
# Fix permissions
# -------------------------------------------
chown ${SEAFILE_SERVER_USER}:${SEAFILE_SERVER_USER} -R ${SEAFILE_SERVER_HOME}
if [[ -d /tmp/seafile-office-output/ ]]; then
chown ${SEAFILE_SERVER_USER}:${SEAFILE_SERVER_USER} -R /tmp/seafile-office-output/
fi
# -------------------------------------------
# Start seafile server
# -------------------------------------------
echo "Starting productive Seafile server"
service seafile-server restart
wait
# -------------------------------------------
# Final report
# -------------------------------------------
cat > ${TOPDIR}/aio_seafile-server.log<<EOF
Your Seafile server is installed
-----------------------------------------------------------------
Server Address: http://${IP_OR_DOMAIN}
Seafile Admin: ${SEAFILE_ADMIN}
Admin Password: ${SEAFILE_ADMIN_PW}
Seafile Data Dir: ${SEAFILE_DATA_DIR}
Seafile DB Credentials: Check /opt/seafile.my.cnf
Root DB Credentials: Check /root/.my.cnf
This report is also saved to ${TOPDIR}/aio_seafile-server.log
Next you should manually complete the following steps
-----------------------------------------------------------------
1) Log in to Seafile and configure your server domain via the system
admin area if applicable.
2) If this server is behind a firewall, you need to ensure that
tcp port 80 is open.
3) Check https://manual.seafile.com/config/sending_email/
for instructions on how to use an existing email account to send email via SMTP.
Optional steps
-----------------------------------------------------------------
1) Check seahub_settings.py and customize it to fit your needs. Consult
https://manual.seafile.com/config/seahub_settings_py/ for possible switches.
2) Setup NGINX with official SSL certificate, we suggest you use Lets Encrypt. Check
https://manual.seafile.com/deploy/https_with_nginx/
3) Secure server with iptables based firewall. For instance: UFW or shorewall
4) Implement a backup routine for your Seafile server.
Seafile support options
-----------------------------------------------------------------
For free community support visit: https://bbs.seafile.com
For paid commercial support visit: https://seafile.com
EOF
chmod 600 ${TOPDIR}/aio_seafile-server.log
clear
cat ${TOPDIR}/aio_seafile-server.log

View File

@ -1,55 +0,0 @@
#/bin/bash
#set -x
# -------------------------------------------
# Save at /usr/local/sbin/seafile-server-change-address and set permissions with
# chmod 600 /usr/local/sbin/seafile-server-change-address
# -------------------------------------------
# -------------------------------------------
# Vars
# -------------------------------------------
HOSTNAME=$(hostname -f)
SEAFILE_DIR=/opt/seafile
# -------------------------------------------
# Intro
# -------------------------------------------
clear
echo "Enter the new IP address or domain"
read -e -p "New domain address:" -i " ${HOSTNAME}" URL
cat <<EOF
New domain address is: ${URL}
-------------------------------------------
Continue with ENTER. Stop with CTRL-C...
EOF
read dummy
clear
# -------------------------------------------
# Change address in seahub_settings.py und ccnet.conf
# -------------------------------------------
sed -i "s/^FILE_SERVER_ROOT.*/FILE_SERVER_ROOT = '\http:\/\/${URL}\/seafhttp\'/g" ${SEAFILE_DIR}/seahub_settings.py
sed -i "s/^SERVICE_URL.*/SERVICE_URL = http:\/\/${URL}/g" ${SEAFILE_DIR}/ccnet/ccnet.conf
# -------------------------------------------
# restart seafile-server
# -------------------------------------------
service seafile-server restart
cat <<EOF
Finished! The seafile server restarted.
Now can visit seahub by http://${URL}.
EOF

View File

@ -1,169 +0,0 @@
#!/bin/bash
#
# seafile-server-installer/startssl-certificate-generator
#
# Copyright 2015, Alexander Jackson <alexander.jackson@seafile.de>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#
#set -x
# -------------------------------------------
# Vars
# -------------------------------------------
CLASS_DEFAULT=1
RSA=4096
# -------------------------------------------
# About
# -------------------------------------------
cat << EOF
StartSSL certificate creator for NGINX
Go to https://www.startssl.com and sign up. Decide
if the free class1 certs are good enough or if you
need paid class2 or class3 certificates. Class1
certificates are the default after signing up. You
don't need to do anything else to issue class1 certs.
For questions or suggestions please contact me at
alexander.jackson@seafile.de
-----------------------------------------------------------------
Hit return to proceed or CTRL-C to abort.
EOF
read dummy
# -------------------------------------------
# Start working
# -------------------------------------------
read -p "New certs class? [$CLASS_DEFAULT]" CLASS
CLASS="${CLASS:-$CLASS_DEFAULT}"
if [[ $CLASS > 3 ]]; then
echo Wrong class type. Select 1, 2 or 3. Aborting.. ; exit 1
fi
read -p "New certs domain name? " DOMAIN
CERT_DIR=$(pwd)/certs/${DOMAIN}
# -------------------------------------------
# Abort if CERT_DIR exists
# -------------------------------------------
if [[ -d "${CERT_DIR}" ]] ;
then
echo " Aborting because directory ${CERT_DIR} already exist" ; exit 1
fi
mkdir -p ${CERT_DIR}
# -------------------------------------------
# Create certificate signing request and private key in batch mode
# -------------------------------------------
openssl req -new -nodes -keyout ${CERT_DIR}/${DOMAIN}.key -out ${CERT_DIR}/${DOMAIN}.csr -newkey rsa:${RSA} -batch
# -------------------------------------------
# Print instructions
# -------------------------------------------
cat << EOF
Follow these steps next:
1. Go to https://www.startssl.com >
2. Certificates Wizard >
3. Certificate Target: (Web Server SSL/TLS Certificate) > Continue >
4. Generate Private Key > Skip >
5. Submit Certificate Request (CSR) (Paste your csr shown below)
EOF
cat ${CERT_DIR}/${DOMAIN}.csr
# -------------------------------------------
# Print more instructions
# -------------------------------------------
cat << EOF
6. Continue >>
7. Certificate Request Received > Continue >>
8. Add Domains: (select your domain)
9. Optionally Add Domains > Add More < (repeat until happy) > Continue >>
10. Ready Processing Certificate > Continue >>
EOF
echo "Hit return when the certificate is displayed."
read dummy
echo "Replace content with certificate, save and exit." > ${CERT_DIR}/${DOMAIN}.crt
nano ${CERT_DIR}/${DOMAIN}.crt
echo "Creating class ${CLASS} chained certificate for NGINX"
# -------------------------------------------
# Create certificate change for usage with NGINX
# -------------------------------------------
cat ${CERT_DIR}/${DOMAIN}.crt > ${CERT_DIR}/${DOMAIN}_chained.crt
if [[ $CLASS -eq 1 ]]; then
wget -O - https://www.startssl.com/certs/class1/sha2/pem/sub.class1.server.sha2.ca.pem >> ${CERT_DIR}/${DOMAIN}_chained.crt
fi
if [[ $CLASS -eq 2 ]]; then
wget -O - https://www.startssl.com/certs/class2/sha2/pem/sub.class2.server.sha2.ca.pem >> ${CERT_DIR}/${DOMAIN}_chained.crt
fi
if [[ $CLASS -eq 3 ]]; then
wget -O - https://www.startssl.com/certs/class3/sha2/pem/sub.class3.server.sha2.ca.pem >> ${CERT_DIR}/${DOMAIN}_chained.crt
fi
wget -O - https://www.startssl.com/certs/ca-sha2.pem >> ${CERT_DIR}/${DOMAIN}_chained.crt
# -------------------------------------------
# List new csr and key for informational value
# -------------------------------------------
echo "Our newly Created files:"
ls -ahl ${CERT_DIR}
# -------------------------------------------
# Print
# -------------------------------------------
cat << EOF
Implementation example for NGINX:
[...]
ssl on;
ssl_certificate ${CERT_DIR}/${DOMAIN}_chained.crt;
ssl_certificate_key ${CERT_DIR}/${DOMAIN}.key;
[...]
Finished!
EOF