虚拟机安装系统系统:Centos 8.3 http://mirrors.aliyun.com/centos/8.3.2011/isos/x86_64/CentOS-8.3.2011-x86_64-dvd1.iso
准备工作:
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 ~]# 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
- Dropping test database…
… Success! - Removing privileges on test database…
… Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y
… Success!
Cleaning up…
All done! If you’ve completed all of the above steps, your MariaDB
installation should now be secure.
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 -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 ] #默认,直接回车
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
server name: seahub
server ip/domain: 192.168.1.3
seafile data dir: /opt/seafile/seafile-data
fileserver port: 8082
database: create new
ccnet database: ccnet-db
seafile database: seafile-db
seahub database: seahub-db
database user: seafile
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可以访问了,但是其它地址不能访问,此时需要配置Nginx反向代{过}{滤}理才行
[root@seahub ~]#yum install nginx #安装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”‘;
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;
server {
listen 80;
server_name 192.168.1.3;
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;
}
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/seafile-server-latest/seahub;
}
}
Settings for a TLS enabled server.
#
server {
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
server_name _;
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 {
}
}
}
[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 #临时关闭selinu
[root@seahub ~]# vi /etc/sysconfig/selinux #永久关闭selinu
#SELINUX=enforcing 改为 SELINUX=disabled #永久关闭selinux
安装到此结束,访问:http://192.168.1.3,试试看#使用教程参考官网或自行摸索

ibrar