SSL开启需上传证书*.pem,*.key至主机,另需单独配置nginx反向代理配置文件,具体配置参考官方文档。
证书申请可到各大云主机运营商处申请。
如果无固定IP可以考虑使用内网穿透去开放至公网,具体方法自行研究。
上面的其实都是废话,下面开始正式教程
Centos8.3部署 seafile 8.0.2教程 本文我已经发布在吾爱破解了,感兴趣的朋友可以去捧个场…
系统:Centos 8.3 http://mirrors.aliyun.com/centos/8.3.2011/isos/x86_64/CentOS-8.3.2011-x86_64-dvd1.iso
#系统更新,个人习惯,装完系统后就更新:
yum -y install epel-release
yum update –y
##准备工作:
1、 安装 MariaDB
[root@seahub ~]##使用yum安装Mariadb
[root@seahub ~]# yum install -y mariadb mariadb-server
#配置MariaDB
[root@snipeit ~]##初始化并数据库
[root@snipeit ~]# service mariadb start
Redirecting to /bin/systemctl start mariadb.service
[root@snipeit ~]#systemctl enable mariadb.service
[root@snipeit ~]# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none): #直接回车
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
Set root password? [y/n] y #是否设置密码,当然是
New password: PassW0rd #数据库管理密码
Re-enter new password: PassW0rd #确认密码
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [y/n] y
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [y/n] y
... Success!
By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [y/n] y
[object Object]Thanks for using MariaDB!
[root@snipeit ~]##登陆数据库,登陆成功则表示安装完成
[root@snipeit ~]# mysql -u root -p
Enter password:
MariaDB [(none)]> exit
Bye
2、安装依赖环境
yum install tree -y #这个是结构目录
yum install wget –y #组件
yum install vim –y #组件
yum install lsof –y #组件
yum -y install gcc gcc-c++ #必装
yum install python3-devel -y #必装
yum install mariadb-devel -y #必装
yum install python3 python3-setuptools python3-pip python3-ldap -y #必装
pip3 install Pillow pylibmc captcha jinja2 sqlalchemy #必装,一项一项来
pip3 install django-pylibmc django-simple-captcha #必装,一项一项来
pip3 install psd-tools #必装,一项一项来
pip3 install ConfigParser #必装,一项一项来
pip3 install future #必装,一项一项来
pip3 install mysqlclient #必装,一项一项来
#上面的环境安装可能会有多次失败(网络原因),请多次尝试,一项一项过,必须保证所有的组件安装成功
3、 环境部署完成后,有条件的做个整机备份(快照)
[root@seahub ~]# cd /opt/ #进入opt目录
[root@seahub ~]# ls
[root@seahub ~]# mkdir seafile #创建安装目录
[root@seahub ~]# wget https://seafile-downloads.oss-cn-shanghai.aliyuncs.com/seafile-server_8.0.2_x86-64.tar.gz #下载seafile安装包
[root@seahub ~]# ls
seafile seafile-server_8.0.2_x86-64.tar.gz
[root@seahub ~]# cp seafile-server_8.0.2_x86-64.tar.gz seafile #复制一份
[root@seahub ~]# ls
seafile seafile-server_8.0.2_x86-64.tar.gz
[root@seahub ~]# cd seafile/
[root@seahub ~]# ls
seafile-server_8.0.2_x86-64.tar.gz
[root@seahub ~]# tar -xzf seafile-server_8.0.2_x86-64.tar.gz #解压安装包
[root@seahub ~]# ls
seafile-server-8.0.2 seafile-server_8.0.2_x86-64.tar.gz
[root@seahub ~]# mkdir installd
[root@seahub ~]# mv seafile-server_8.0.2_x86-64.tar.gz installd/ #将压缩包归档,本人强迫症,不需要的略过…
4、 安装包下载完成,目录结构准备ok,EMM…有条件的做备份(快照)
[root@seahub ~]#cd seafile-server-8.0.2/ #进去安装目录
[root@seahub ~]#./setup-seafile-mysql.sh #开始安装
Checking python on this machine ...
This script will guide you to setup your seafile server using MySQL.
Make sure you have read seafile server manual at
https://download.seafile.com/published/seafile-manual/home.md
Press ENTER to continue #回车开始安装
What is the name of the server? It will be displayed on the client.
3 - 15 letters or digits
[ server name ] seahub #服务器名,随便输也可以
What is the ip or domain of the server?
For example: www.mycompany.com, 192.168.1.101
[ this server's ip or domain ] 192.168.1.3 #IP地址或域名
Which port do you want to use for the seafile fileserver?
[ default "8082" ] #端口默认即可
Please choose a way to initialize seafile databases:
[1] Create new ccnet/seafile/seahub databases
[2] Use existing ccnet/seafile/seahub databases
[ 1 or 2 ] 1 #选择1
What is the host of mysql server?
[ default "localhost" ] #数据库地址,无特殊需求,默认
What is the port of mysql server?
[ default "3306" ] #数据库端口,无特殊需求默认
What is the password of the mysql root user?
[ root password ]PassW0rd #上面设置的数据库管理密码
verifying password of user root ... done
Enter the name for mysql user of seafile. It would be created if not exists.
[ default "seafile" ] #默认,直接回车
Enter the password for mysql user "seafile":
[ password for seafile ] #设置Seafile的数据库密码,建议复杂一些,只需输入一次即可
Enter the database name for ccnet-server:
[ default "ccnet-db" ] #默认,直接回车
Enter the database name for seafile-server:
[ default "seafile-db" ] #默认,直接回车
Enter the database name for seahub:
[ default "seahub-db" ] #默认,直接回车
This is your configuration
[object Object]
Press ENTER to continue, or Ctrl-C to abort #确认上述信息无误,直接回车
Generating ccnet configuration ...
Generating seafile configuration ...
done
Generating seahub configuration ...
Now creating ccnet database tables ...
Now creating seafile database tables ...
Now creating seahub database tables ...
creating seafile-server-latest symbolic link ... done
Your seafile server configuration has been finished successfully.
run seafile server: ./seafile.sh { start | stop | restart }
run seahub server: ./seahub.sh { start | stop | restart }
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://download.seafile.com/published/seafile-manual/home.md
for information.
###安装完成
[root@seahub ~]# cd /opt/seafile/
[root@seahub ~]#tree -L 2 #查看一下目录结构,看不看都行,本人强迫症
.
├── ccnet
├── conf
│ ├── ccnet.conf
│ ├── gunicorn.conf.py
│ ├── seafdav.conf
│ ├── seafile.conf
│ └── seahub_settings.py
├── installd
│ └── seafile-server_8.0.2_x86-64.tar.gz
├── seafile-data
│ └── library-template
├── seafile-server-8.0.2
│ ├── check_init_admin.py
│ ├── reset-admin.sh
│ ├── runtime
│ ├── seaf-fsck.sh
│ ├── seaf-fuse.sh
│ ├── seaf-gc.sh
│ ├── seafile
│ ├── seafile.sh
│ ├── seahub
│ ├── seahub.sh
│ ├── setup-seafile-mysql.py
│ ├── setup-seafile-mysql.sh
│ ├── setup-seafile.sh
│ ├── sql
│ └── upgrade
├── seafile-server-latest -> seafile-server-8.0.2
└── seahub-data
└── avatars
14 directories, 16 files
#此处已安装完成,接下来启动Seafile
[root@seahub ~]#/opt/seafile/seafile-server-latest/./seafile.sh start
[root@seahub ~]#/opt/seafile/seafile-server-latest/./seahub.sh start #第一次需要设置邮箱(登录用户名)和管理员密码,比较简单,不做详细介绍
#添加开机启动
[root@seahub ~]#vim /etc/rc.d/rc.local #按i键,插入一下内容,ESC:wq保存
/opt/seafile/seafile-server-latest/./seafile.sh start
/opt/seafile/seafile-server-latest/./seahub.sh start
[root@seahub ~]#chmod +x /etc/rc.d/rc.local
#接下来,127.0.0.1:8000可以访问了,默认8000端口只监听本地地址,外部地址无法访问,故需要配置Nginx反向代理才行
[root@seahub ~]#yum install nginx -y #安装Nginx
[root@seahub ~]# vi /etc/nginx/nginx.conf #修改nginx配置文件,修改后的如下
For more information on configuration, see:
* Official English Documentation: http://nginx.org/en/docs/
* Official Russian Documentation: http://nginx.org/ru/docs/
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
[object Object]server {
listen 80;
server_name 192.168.1.3;
[object Object]}
Settings for a TLS enabled server.
server {
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
servername ;
root /usr/share/nginx/html;
ssl_certificate "/etc/pki/nginx/server.crt";
ssl_certificate_key "/etc/pki/nginx/private/server.key";
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 10m;
ssl_ciphers PROFILE=SYSTEM;
ssl_prefer_server_ciphers on;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
}
#这其实是个默认文档,哈哈,容我皮一下,具体的配置文件还是参考官网吧,配置文件需要个人去理解才行。照搬是不可取的...
#当然也可以留言或者发送邮件至[email protected]进行询问,本人有时间的话会一一回复。
[root@seahub ~]# systemctl enable nginx #配置nginx开机启动
[root@seahub ~]# firewall-cmd --permanent --zone=public --add-port=80/tcp #防火墙端口开放,Emm...这个差点忘了
[root@seahub ~]# firewall-cmd --permanent --zone=public --add-port=8000/tcp
[root@seahub ~]# firewall-cmd --permanent --zone=public --add-port=8082/tcp
[root@seahub ~]# systemctl restart firewalld.service #重启防火墙
[root@seahub ~]# setenforce 0 #临时关闭selinux
[root@seahub ~]# vi /etc/sysconfig/selinux #永久关闭selinux
#SELINUX=enforcing 改为 SELINUX=disabled #永久关闭selinux
#安装到此结束,访问:http://192.168.1.3,试试看
#使用教程参考官网或自行摸索
#官网地址:https://www.seafile.com/