阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

CentOS 6下安装Seafile 2

111次阅读
没有评论

共计 3407 个字符,预计需要花费 9 分钟才能阅读完成。

在 CentOS 6.4_64 安装 Seafile 使用 Apahce 和 SQLite。

1. 环境准备
1.1 centos6.4_64 最小化安装
yum -y install httpd  ## 部署在 apache 之后,参考 https://github.com/haiwen/seafile/wiki/Deploy-Seafile-with-apache
yum -y install install Python python-setuptools python-simplejson python-imaging sqlite3  ## 系统默认是 python2.6
yum -y install  apr apr-devel httpd-devel libtool  ## 安装 fastcgi 需要用到
yum update -y
chkconfig postfix off
/etc/ini t.d/postfix stop  ## 关闭邮件服务
reboot

1.2 防火墙配置
vi /etc/sysconfig/iptables

/etc/sysconfig/iptables 增加三条内容开放 80、10001、12001 端口
-A INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT
-A INPUT -m state –state NEW -m tcp -p tcp –dport 10001 -j ACCEPT
-A INPUT -m state –state NEW -m tcp -p tcp –dport 12001 -j ACCEPT

防火墙重启配置生效。
/etc/init.d/iptables restart

1.3 安装 fastcgi 为 httpd 一个模块
seafile 的 apache 部署使用到 fastcgi,下载 fastcgi,解压
curl -O  http://www.fastcgi.com/dist/mod_fastcgi-current.tar.gz
tar -xzvf mod_fastcgi-current.tar.gz
cd mod_fastcgi-2.4.6/
cp Makefile.AP2 Makefile

更改 Makefile 内文件 top_dir
#top_dir      = /usr/local/apache2
top_dir      = /usr/lib64/httpd  ## 如 32 位机器应是 /usr/lib/httpd

编译安装 fastcgi,安装到 /usr/lib64/httpd/modules/(32 位机器 /usr/lib/httpd/modules/)
make
make install

配置 httpd.conf
添加 FastCGIExternalServer
LoadModule fastcgi_module modules/mod_fastcgi.so
##
FastCGIExternalServer /var/www/html/seahub.fcgi -host 127.0.0.1:8000

添加 /etc/httpd/conf.d/v.conf
NameVirtualHost *:80

  ServerName sf.linuxidc.com  ## 对应 dns 要配置,如没有就修改自己机器的 hosts
  DocumentRoot /var/www/html
  Alias /media  /opt/haiwen/seafile-server-2.0.3/seahub/media/
  RewriteEngine On
  #
  # seafile httpserver
  #
  ProxyPass /seafhttp http://127.0.0.1:8082
  ProxyPassReverse /seafhttp http://127.0.0.1:8082
  RewriteRule ^/seafhttp – [QSA,L]

  # seahub
  #
  RewriteRule ^/(media.*)$ /$1 [QSA,L,PT]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)$ /seahub.fcgi$1 [QSA,L,E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

2. 安装 seafile2.0
 2.1 seafile 下载、解压
seafile 下载、解压到指定目录就行了,执行安装命令。

http://seafile.googlecode.com/files/seafile-server_2.0.3_x86-64.tar.gz

tar -xzvf seafile-server_2.0.3_x86-64.tar.gz
mkdir /opt/haiwen
mv seafile-server-2.0.3  /opt/haiwen

安装 seafile,只需要按指定提示填写就行了,一般默认。可参考:https://github.com/haiwen/seafile/wiki/Download-and-setup-seafile-server。

./setup-seafile.sh

2.2 配置 selinux
 selinux 在 centos6 下面默认是开启的。
setsebool -P httpd_can_network_connect 1  ##httpd 可网络连接
chcon -R -h -u system_u -t httpd_sys_content_t /opt/haiwen/seafile-server-2.0.3/seahub/media/  ##httpd 可访问
chcon -R -h -u system_u -t httpd_sys_content_t  /opt/haiwen/seahub-data/avatars/  ##httpd 可访问

3. 启动服务
seafile 和 seahub 启动,httpd 重启。
/opt/haiwen/seafile-server-2.0.3/seafile.sh start
/opt/haiwen/seafile-server-2.0.3/seahub.sh start-fastcgi
/etc/init.d/httpd restart

最后祝贺成功安装了,可直接访问 http://sf.linuxidc.com
或下载客户端 http://seafile.com/download/ 访问

4. 遇到问题
4.1 httpd 出错 apr_sockaddr_info_get() failed
Starting httpd: httpd: apr_sockaddr_info_get() failed for seafile.linuxidc.com

在 /etc/hosts 添加 seafile.linuxidc.com, 机器名称。
127.0.0.1  localhost localhost.localdomain localhost4 localhost4.localdomain4  seafile.linuxidc.com

4.2 FastCGI: apr_dir_open() 失败
 出错信息如下
[Wed Nov 20 10:51:13 2013] [error] (13)Permission denied: FastCGI: apr_dir_open() failed
[Wed Nov 20 10:51:13 2013] [notice] Digest: generating secret for digest authentication …
[Wed Nov 20 10:51:13 2013] [notice] Digest: done
[Wed Nov 20 10:51:13 2013] [error] (13)Permission denied: FastCGI: apr_dir_open() failed
[Wed Nov 20 10:51:13 2013] [notice] FastCGI: process manager initialized (pid 1823)
[Wed Nov 20 10:51:13 2013] [notice] Apache/2.2.15 (Unix) DAV/2 mod_fastcgi/2.4.6 configured — resuming normal operations

是 selinux 问题,执行如下命令
chcon -R -t var_log_t /var/log/httpd/fastcgi/

更多 CentOS 相关信息见 CentOS 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=14

正文完
星哥说事-微信公众号
post-qrcode
 
星锅
版权声明:本站原创文章,由 星锅 2022-01-20发表,共计3407字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中