Debian10安裝seafile-pro-6.x記錄
一、Debian安裝配置
-
Debian最小安裝(只安裝ssh服務)
-
安裝完成先設置網絡
root賬戶登陸,輸入# nano /etc/network/interfaces
改爲如下設置
# The loopback network interface auto lo iface lo inet loopback # The primary network interface # iface enp3s0 inet dhcp allow-hotplug enp3s0 auto enp3s0 iface enp3s0 inet static address 192.168.1.200 netmask 255.255.255.0 gateway 192.168.1.1
附 nano簡單操作:
操作 指令 刪除行 Ctrl + k 保存 Ctrl + o 退出 Ctrl + x 設置dns比較麻煩些,後來發現在路由器中,通過指定MAC分配IP更爲方便。
-
使用自建用戶usera遠程登陸debian主機:
ssh [email protected]
切換 root 用戶後開始配置。
-
配置國內 apt 源;
# nano /etc/apt/sources.list
進入後,粘貼如下內容
deb http://mirrors.tuna.tsinghua.edu.cn/debian/ buster main non-free contrib deb http://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main non-free contrib deb http://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main non-free contrib deb http://mirrors.tuna.tsinghua.edu.cn/debian-security/ buster/updates main non-free contrib deb-src http://mirrors.tuna.tsinghua.edu.cn/debian/ buster main non-free contrib deb-src http://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main non-free contrib deb-src http://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main non-free contrib deb-src http://mirrors.tuna.tsinghua.edu.cn/debian-security/ buster/updates main non-free contrib
-
將自建用戶加入sudo用戶組:
先安裝sudo工具;# apt update # apt-get install sudo
修改 /etc/sudoers 文件屬性爲可寫
# chmod +w /etc/sudoers
編輯 /etc/sudoers 在
root ALL=(ALL:ALL) ALL
後,添加如下行
usera ALL=(ALL:ALL) ALL
-
配置ssh爲自建用戶可遠程登陸;
# nano /etc/ssh/sshd_config
修改
#PermitRootLogin prohibit-password
爲
PermitRootLogin yes
-
安裝防火牆配置工具ufw;
# apt install ufw
# ufw disable
重啓Debian主機。
-
安裝配置FTP工具vsftpd;
$ sudo apt install vsftpd
$ sudo nano /etc/vsftpd.conf
修改爲
listen=YES #listen_ipv6=YES write_enable=YES
重啓vsftpd服務
$ sudo /etc/init.d/./vsftpd restart
二、下載所需軟件
- seafile下載
歷史版本 中找到 seafile-pro-server_6.3.14_x86-64.tar.gz 下載; - java下載
下載jdk8版本,Linux x64 Compressed Archive 版; - FTP上傳以上軟件包到usera目錄;
三、安裝Java
- 將usera目錄下的jdk-8u241-linux-x64.tar.gz複製到/usr/lib/jvm目錄,解壓後刪除:
$ sudo mkdir /usr/lib/jvm $ sudo cp ~/jdk-8u241-linux-x64.tar.gz /usr/lib/jvm/ $ cd /usr/lib/jvm $ sudo tar xvf jdk-8u241-linux-x64.tar.gz $ sudo rm jdk-8u241-linux-x64.tar.gz
- 配置環境變量
在最後添加$ nano ~/.profile
保存關閉,使用source更新下export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_241 export JRE_HOME=${JAVA_HOME}/jre export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib export PATH=${JAVA_HOME}/bin:$PATH
使用env命令察看JAVA_HOME的值$ source ~/.profile
如果JAVA_HOME=/usr/lib/jvm/jdk1.8.0_241,說明配置成功。$ env
- 修改系統默認的jdk
$ sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.8.0_241/bin/java 300 $ sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.8.0_241/bin/javac 300 $ sudo update-alternatives --config java $ sudo update-alternatives --config javac
- 查看是否配置成功
輸出如下信息,說明成功:$ java -version
java version "1.8.0_241" Java(TM) SE Runtime Environment (build 1.8.0_241-b07) Java HotSpot(TM) 64-Bit Server VM (build 25.241-b07, mixed mode)
四、安裝NMP
- apt安裝nginx:
$ sudo apt install nginx
- apt安裝mariadb-server:
$ sudo apt install mariadb-server
- 初始化mariadb安全設置
根據提示,設置數據庫root密碼。$ sudo mysql_secure_installation
- apt安裝python2.7環境
$ sudo apt-get install python2.7 python-setuptools python-mysqldb python-urllib3 python-ldap -y
五、安裝Seafile
- 添加seafile安裝運行目錄
$ sudo mkdir /opt/seafile_rt
- 將usera目錄下的seafile-pro-server_6.3.14_x86-64.tar.gz複製到/opt/seafile_rt錄,解壓:
$ sudo cp ~/seafile-pro-server_6.3.14_x86-64.tar.gz /opt/seafile_rt/ $ cd /opt/seafile_rt $ sudo tar xvf seafile-pro-server_6.3.14_x86-64.tar.gz $ sudo mkdir installed $ sudo mv seafile-pro-server_6.3.14_x86-64.tar.gz installed/
- 運行seafile初始化配置
$ cd seafile-pro-server-6.3.14/ $ sudo ./setup-seafile-mysql.sh
- 提示缺少依賴軟件
安裝之python-imaging is not installed, Please install it first.
又提示sudo apt-get install python-imaging
那就安裝python-pil吧沒有可用的軟件包 python-imaging,但是它被其它的軟件包引用了。 然而下列軟件包會取代它: python-pil
sudo apt install python-pil
- 再次運行seafile初始化配置
提示成功:$ sudo ./setup-seafile-mysql.sh
----------------------------------------------------------------- Your seafile server configuration has been finished successfully. ----------------------------------------------------------------- run seafile server: ./seafile.sh { start | stop | restart } run seahub server: ./seahub.sh { start <port> | stop | restart <port> } ----------------------------------------------------------------- If you are behind a firewall, remember to allow input/output of these tcp ports: ----------------------------------------------------------------- port of seafile fileserver: 8082 port of seahub: 8000 When problems occur, Refer to https://github.com/haiwen/seafile/wiki for information.
六、Nginx配置
- 配置seafile的代理
粘貼以下內容$ sudo nano /etc/nginx/sites-available/seafile.conf #此處seafile官網有錯誤,/etc/nginx/sites-*** 錯寫成了/etc/nginx/site-***
刪除nginx默認代理配置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_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; error_log /var/log/nginx/seahub.error.log; } # If you are using [FastCGI](http://en.wikipedia.org/wiki/FastCGI), # which is not recommended, you should use the following config for location `/`. # # location / { # 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; # fastcgi_param REMOTE_ADDR $remote_addr; # fastcgi_read_timeout 36000; # # client_max_body_size 0; # # access_log /var/log/nginx/seahub.access.log; # 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; proxy_send_timeout 36000s; send_timeout 36000s; } location /media { root /opt/seafile_rt/seafile-server-latest/seahub; } }
創建符號鏈接$ sudo rm /etc/nginx/sites-enabled/default
$ sudo ln -s /etc/nginx/sites-available/seafile.conf /etc/nginx/sites-enabled/seafile.conf
七、啓動seafile
- 啓動 Seafile
報錯$ sudo ./seafile.sh start
安裝缺少的庫文件** Message: seafile-controller.c(1155): loading seafdav config from /opt/seafile_rt/conf/seafdav.conf ccnet-server: error while loading shared libraries: libssl3.so: cannot open shared object file: No such file or directory failed to run "ccnet-server -t"
再次啓動seafile,成功。$ sudo apt install libnss3
- 繼續啓動seahub
報錯$ sudo ./seahub.sh start
seahub 服務提供一種類似於 debug 的啓動方式,可詳細展現 seahub 服務啓動的過程,方法是在 seafile server 部署路徑下執行如下命令:/opt/seafile_rt/ccnet/seafile.ini not found. Now quit
得到./seahub.sh start-fastcgi
缺少libpython2.7的依賴,安裝之LC_ALL is not set in ENV, set to en_US.UTF-8 ./seahub.sh:行231: 警告:setlocale:LC_ALL:無法改變區域選項 (en_US.UTF-8):沒有那個文件或目錄 Starting seahub (fastcgi) at 127.0.0.1:8000 ... …… ImportError: libpython2.7.so.1.0: cannot open shared object file: No such file or directory Error:Seahub failed to start.
再次啓動seahub,成功。sudo apt install libpython2.7