# 在 CentOS 7 下 需要的依赖 yum install python-setuptools python-imaging python-ldap MySQL-python python-memcached python-urllib3
- 启动 Seafile:
./seafile.sh start # 启动 Seafile 服务
- 启动 Seahub
./seahub.sh start <port> # 启动 Seahub 网站 (默认运行在8000端口上)自启动设置
<h2 id="rhelcentos-系统方法-2" style="font-size:1.75em;color:#333333;font-family:"background-color:#FFFFFF;"> RHEL/CentOS 系统方法 2 </h2> <p class="comments-section" style="font-size:16px;color:#333333;font-family:"background-color:#FFFFFF;"> RHEL/CentOS 下 , 我们通过 /etc/init.d/ 脚本将 Seafile/Seahub作为服务程序随开机启动. </p> <h3 id="创建etcsysconfigseafile文件" style="font-size:1.5em;color:#333333;font-family:"background-color:#FFFFFF;"> 创建<span style="font-size:inherit;">/etc/sysconfig/seafile</span>文件 </h3># 请将 user 改为你的Linux用户名 user=haiwen # 请将 script_path 改为你的 Seafile 文件安装路径 seafile_dir=/home/haiwen 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 # 若使用 fastcgi, 请将其设置true fastcgi=false # fastcgi 端口, 默认为 8000. fastcgi_port=8000<h3 id="创建etcinitdseafile文件" style="font-size:1.5em;color:#333333;font-family:"background-color:#FFFFFF;">
创建<span style="font-size:inherit;">/etc/init.d/seafile</span>文件
</h3>
#!/bin/bash # # seafile # # chkconfig: - 68 32 # description: seafile # Source function library. . /etc/init.d/functions # Source networking configuration. . /etc/sysconfig/network if [ -f /etc/sysconfig/seafile ];then . /etc/sysconfig/seafile else echo "Config file /etc/sysconfig/seafile not found! Bye." exit 200 fi RETVAL=0 start() { # Start daemons. echo -n $"Starting seafile: " ulimit -n 30000 su - ${user} -c"${script_path}/seafile.sh start >> ${seafile_init_log} 2>&1" RETVAL=$? echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/seafile return $RETVAL } stop() { echo -n $"Shutting down seafile: " su - ${user} -c"${script_path}/seafile.sh stop >> ${seafile_init_log} 2>&1" RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/seafile return $RETVAL } # See how we were called. case "$1" in start) start ;; stop) stop ;; restart|reload) stop start RETVAL=$? ;; *) echo $"Usage: $0 {start|stop|restart}" RETVAL=3 esac exit $RETVAL<h3 id="创建etcinitdseahub脚本" style="font-size:1.5em;color:#333333;font-family:"background-color:#FFFFFF;">
创建<span style="font-size:inherit;">/etc/init.d/seahub</span>脚本
</h3>
#!/bin/bash # # seahub # # chkconfig: - 69 31 # description: seahub # Source function library. . /etc/init.d/functions # Source networking configuration. . /etc/sysconfig/network if [ -f /etc/sysconfig/seafile ];then . /etc/sysconfig/seafile else echo "Config file /etc/sysconfig/seafile not found! Bye." exit 200 fi RETVAL=0 start() { # Start daemons. echo -n $"Starting seahub: " ulimit -n 30000 if [ $fastcgi = true ]; then su - ${user} -c"${script_path}/seahub.sh start-fastcgi ${fastcgi_port} >> ${seahub_init_log} 2>&1" else su - ${user} -c"${script_path}/seahub.sh start >> ${seahub_init_log} 2>&1" fi RETVAL=$? echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/seahub return $RETVAL } stop() { echo -n $"Shutting down seafile: " su - ${user} -c"${script_path}/seahub.sh stop >> ${seahub_init_log} 2>&1" RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/seahub return $RETVAL } # See how we were called. case "$1" in start) start ;; stop) stop ;; restart|reload) stop start RETVAL=$? ;; *) echo $"Usage: $0 {start|stop|restart}" RETVAL=3 esac exit $RETVAL<p class="comments-section" style="font-size:16px;color:#333333;font-family:"background-color:#FFFFFF;">
接下来启动服务程序:
</p>
chmod 550 /etc/init.d/seafile chmod 550 /etc/init.d/seahub chkconfig --add seafile chkconfig --add seahub chkconfig seahub on chkconfig seafile on<p style="font-size:16px;color:#333333;font-family:"background-color:#FFFFFF;">
执行:
</p>
service seafile start service seahub start<h3 id="完成" style="font-size:1.5em;color:#333333;font-family:"background-color:#FFFFFF;">
完成
</h3>