Ịwụnye Seafile (Nchekwa Ígwé ojii echekwara) na MySQL database na RHEL/CentOS/SL 7.x/6.x


Seafile bụ ngwa nchekwa igwe ojii na-emekọrịta ihe mepere emepe nke e dere n'ime Python nwere ikesa faịlụ na nkwado mmekọrịta, imekọ ihe ọnụ na nchedo nzuzo site na iji nzuzo ndị ahịa. A na-ewu ya dị ka faịlụ multi-ikpo okwu na ndị ahịa na-agba ọsọ na nyiwe isi niile (Linux, Raspberry Pi, Windows, Mac, iPhone na Android) na enwere ike ijikọ ya na ọrụ mpaghara dịka LDAP na WebDAV ma ọ bụ nwee ike ibuga ya site na iji elu dị elu. ọrụ netwọk na ọdụ data dị ka MySQL, SQLite, PostgreSQL, Memcached, Nginx ma ọ bụ Apache Web Server.

Nkuzi a ga-eduzi gị na nzọụkwụ site nzọụkwụ Seafile Server ntinye na RHEL/CentOS/Scientific Linux 7.x/6.x etinyere na MySQL nchekwa data, na mmalite init ederede maka ịgba ọsọ nkesa na ọdụ ụgbọ mmiri Seafile (8000/TCP) na ọdụ ụgbọ mmiri HTTP ndabara (80/TCP), mepụta iwu Firewall dị mkpa iji mepee ọdụ ụgbọ mmiri achọrọ.

  1. Nwụnye CentOS 6.5 pere mpe nwere adreesị IP static.
  2. MySQL/MariaDB nchekwa data
  3. Python 2.6.5+ ma ọ bụ 2.7
  4. Python-setuptools
  5. Python-simplejson
  6. Python-imaging
  7. Python-mysqldb

Usoro ntinye a nwalere na usoro CentOS 6.4 64-bit, mana enwere ike iji ya na nkesa Linux ndị ọzọ yana nkọwapụta na init script mmalite dị iche na nkesa na nke ọzọ. .

Kwụpụ 1: Wụnye Python Modules

1. Buru ụzọ mee usoro Mmelite, wee wụnye usoro Python niile achọrọ site na iji iwu ndị a.

# yum upgrade
# yum install python-imaging MySQL-python python-simplejson python-setuptools

2. Ọ bụrụ na ị na-eji Debianma ọ bụ Ubuntu ihe nkesa wụnye usoro Python niile na iwu na-esote.

$ sudo apt-get update
$ sudo apt-get install python2.7 python-setuptools python-simplejson python-imaging python-mysqldb

Nzọụkwụ 2: Wụnye Seafile Server

3. Mgbe arụnyere modul Python niile mepụta onye ọrụ sistemụ ọhụrụ nwere paswọọdụ siri ike nke a ga-eji kwado nhazi ihe nkesa Seafile yana data niile dị na ndekọ ụlọ ya, wee gbanwee gaa na akaụntụ onye ọrụ ọhụrụ mepụtara.

# adduser seafile
# passwd seafile
# su - seafile

4. Mgbe ahụ banye na MySQL nchekwa data wee mepụta ọdụ data atọ, otu maka ihe ọ bụla Seafile Server components: ccnet server, seafile server na seahub na otu otu. onye ọrụ maka ọdụ data niile.

$ mysql -u root -p

mysql> create database `ccnet-db`;
mysql> create database `seafile-db`;
mysql> create database `seahub-db`;
mysql> create user 'seafile'@'localhost' identified by 'password';
mysql> GRANT ALL PRIVILEGES ON `ccnet-db`.* to `seafile`@`localhost`;
mysql> GRANT ALL PRIVILEGES ON `seafile-db`.* to `seafile`@`localhost`;
mysql> GRANT ALL PRIVILEGES ON `seahub-db`.* to `seafile`@`localhost`;
mysql> FLUSH PRIVILEGES;
mysql> exit;

5. Ugbu a ọ bụ oge ibudata na wụnye Seafile Server. Gaa na ibe nbudata ọrụ Sefile wee jide nke ikpeazụ .Tar Linux Archive resignment for your server architecture iji wgetiwu, wee wepụ ya n'ụlọ gị onye ọrụ Sefile emebere na mbụ wee banye Sefile. ewepụtara ndekọ.

$ wget https://bitbucket.org/haiwen/seafile/downloads/seafile-server_3.0.4_x86-64.tar.gz
$ tar xfz seafile-server_3.0.4_x86-64.tar.gz
$ cd seafile-server_3.0.4/

6. Iji wụnye Seafile Server site na iji MySQL nchekwa data na-agba ọsọ setup-seafile-mysql.sh edemede mmalite ma zaa ajụjụ niile site na iji nhọrọ nhazi ndị a, mgbe edemede ahụ kwadoro ịdị adị nke Python niile chọrọ modul.

$ ./setup-seafile-mysql.sh

  1. Gịnị bụ aha nkesa gị? = họrọ aha nkọwa (enweghị oghere ekwere).
  2. Gịnị bụ IP ma ọ bụ ngalaba nke sava ahụ? = Tinye ihe nkesa adreesị IP ma ọ bụ aha ngalaba gị bara uru.
  3. Kedu ọdụ ụgbọ mmiri ịchọrọ iji maka sava ccnet? = see [Tinye] - hapụ ya ndabara - 10001.
  4. Ebee ka ị chọrọ itinye data seafile? = kụrụ [Tinye] - ebe ndabara ga-abụ ndekọ $HOME/seafile-data gị.
  5. Kedu ọdụ ụgbọ mmiri ịchọrọ iji maka sava sefile? = see [Tinye] - hapụ ya ndabara - 12001.

  1. Kedu ọdụ ụgbọ mmiri ịchọrọ iji maka seafile httpserver? = see [Tinye] - hapụ ya ndabara - 8082.
  2. Biko họrọ ụzọ isi malite ọdụ data seafile: = họrọ 1 wee nye nzere MySQL ndabara: localhost, 3306 na paswọọdụ mgbọrọgwụ.
  3. Tinye aha MySQL onye ọrụ seafile: = seafile (ọ bụrụ na ị mepụtara aha njirimara ọzọ tinye aha njirimara) na seafile paswọọdụ njirimara MySQL.
  4. Na ccnet-server, seafile-server na seahub ọdụ data ka pịa [Tinye] igodo – ndabara.

Mgbe Sefile Server rụchara nke ọma, ọ ga-ewepụta ozi bara uru dị ka ọdụ ụgbọ mmiri kwesịrị imeghe na Firewall gị iji kwe ka njikọ mpụga yana ihe edemede ị ga-ejikwa iji malite sava ahụ.

Kwụpụ 3: Mepee Firewall ma mepụta Seafile init Script

7. Tupu ịmalite ihe nkesa Seafile site na edemede mpaghara maka ule, gbanwee azụ na akaụntụ mgbọrọgwụ wee mepee iptables nhazi faịlụ firewall dị na /etc/sysconfig/ b> usoro ma tinye iwu ahịrị ndị a tupu mbụ REJECT ahịrị, wee malitegharịa iptables iji tinye iwu ọhụrụ.

$ su - root
# nano /etc/sysconfig/iptables

Tinye iwu ndị a.

-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 8000 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8082 -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

Malitegharịa iptables ka itinye iwu n'iji iwu a.

# service iptables restart

IHE: Ọ bụrụ na ị gbanwere Seafile ọkọlọtọ ọdụ ụgbọ mmiri na nwụnye usoro melite Firewall iptables iwu gị otú ahụ.

8. Ugbu a ọ bụ oge iji nwalee Seafile Server. Banye na onye ọrụ Seafile na seafile-server ndekọ wee malite ihe nkesa site na iji seafile.sh na seahub.sh scripts.

Oge mbụ ị malitere seahub.sh script, mepụta akaụntụ nchịkwa maka Seafile Server site na iji adreesị email gị wee họrọ paswọọdụ siri ike maka akaụntụ nchịkwa, ọkachasị ma ọ bụrụ na ị na-ebuga nhazi a na mpaghara mmepụta.

# su - seafile
$ cd seafile-server-latest/
$ ./seafile.sh start
$ ./seahub.sh start

9. Mgbe emechara ihe nkesa ahụ nke ọma, mepee ihe nchọgharị wee gaa na adreesị IP nke ihe nkesa gị ma ọ bụ aha ngalaba dị na ọdụ ụgbọ mmiri 8000 site na iji HTTP protocol, wee banye site na iji akaụntụ admin gị mepụtara na nzọụkwụ dị n'elu.

http://system_IP:8000

OR 

http://domain_name:8000

10. Mgbe nyocha nhazi mbụ, kwụsị Sefile nkesa ma mepụta init script nke ga-enyere gị aka ijikwa ngwa ngwa dum usoro, dị ka ọ bụla Linux usoro daemon usoro.

$ ./seafile.sh stop
$ ./seahub.sh stop
$ su - root
# nano /etc/init.d/seafile

Tinye ọdịnaya ndị a na edemede init - Ọ bụrụ na etinyere Sefile na onye ọrụ sistemụ ọzọ hụ na imelite onye ọrụ na ụzọ dabara na ahịrị su - $USER -c.

#!/bin/sh
#chkconfig: 345 99 10
#description: Seafile auto start-stop script.

# source function library
. /etc/rc.d/init.d/functions

start() {
        echo "Starting Seafile server..."
su - seafile -c "seafile-server-latest/seafile.sh start"
su - seafile -c "seafile-server-latest/seahub.sh start"
}

stop() {
        echo "Stopping Seafile process..."
su - seafile -c "seafile-server-latest/seafile.sh stop"
su - seafile -c "seafile-server-latest/seahub.sh stop"
}

restart() {
        echo "Stopping Seafile process..."
su - seafile -c "seafile-server-latest/seafile.sh stop"
su - seafile -c "seafile-server-latest/seahub.sh stop"

         echo "Starting Seafile server..."
su - seafile -c "seafile-server-latest/seafile.sh start"
su - seafile -c "seafile-server-latest/seahub.sh start"
}

case "$1" in
    start)
       start
        ;;
    stop)
       stop
        ;;
    restart)
       restart
        ;;
        *)
      echo "Usage: $0 start stop restart"
        ;;
esac

11. Mgbe emechara faịlụ init, gbaa mbọ hụ na o nwere ikike ime ihe wee jikwaa usoro site na iji mmalite, kwụsị na malitegharịa ekwentị. mgbanwe. Ugbu a ị nwere ike tinye ọrụ Sefile na mmalite sistemụ site na iji iwu chkconfig.

# chmod +x /etc/init.d/seafile
# service seafile start 
# service seafile stop 
# service seafile restart
# chkconfig seafile on | off
# chkconfig --list seafile

12. Site na ndabara Seafile nkesa na-eji 8000/TCP ọdụ ụgbọ mmiri HTTP maka azụmahịa webụ. Ọ bụrụ na ịchọrọ ịnweta Seafile Server site na ihe nchọgharị n'ọdụ ụgbọ mmiri HTTP ọkọlọtọ jiri init script na-amalite nkesa na ọdụ ụgbọ mmiri 80 (maara na ịmalite ọrụ na ọdụ ụgbọ mmiri dị n'okpuru b>1024chọrọ ohere mgbọrọgwụ).

# nano /etc/init.d/seafile

Tinye ọdịnaya ndị a na edemede init ka ịmalite Sefile n'ọdụ ụgbọ mmiri HTTP ọkọlọtọ. Ọ bụrụ na etinyere Sefile na onye ọrụ sistemu ọzọ hụ na imelite onye ọrụ na ụzọ dabara na ahịrị su – $USER -c na $HOME.

#!/bin/sh
#chkconfig: 345 99 10
#description: Seafile auto start-stop script.

# source function library
. /etc/rc.d/init.d/functions

start() {
                echo "Starting Seafile server..."
su - seafile -c "seafile-server-latest/seafile.sh start"
                ## Start on port default 80 http port ##
/home/seafile/seafile-server-latest/seahub.sh start 80
}

stop() {
                echo "Stopping Seafile process..."
su - seafile -c "seafile-server-latest/seafile.sh stop"
/home/seafile/seafile-server-latest/seahub.sh stop
}

restart() {
      echo "Stopping Seafile process..."
su - seafile -c "seafile-server-latest/seafile.sh stop"
/home/seafile/seafile-server-latest/seahub.sh stop
                 echo "Starting Seafile server..."
su - seafile -c "seafile-server-latest/seafile.sh start"
/home/seafile/seafile-server-latest/seahub.sh start 80
}

case "$1" in
    start)
       start
        ;;
    stop)
       stop
        ;;
     restart)
       restart
        ;;
                *)
        echo "Usage: $0 start stop restart"
        ;;
Esac

13. Ọ bụrụ na ị malitelarị Sefile na ọdụ ụgbọ mmiri 8000 hụ na egburu usoro niile, malite sava na ọdụ ụgbọ mmiri 80.

# chmod +x /etc/init.d/seafile
# service seafile start | stop | restart

Mepee ihe nchọgharị wee duzie ya na adreesị na-esonụ.

http://system_ip 

OR

http://domain_name.tld

14. Ị nwekwara ike nyochaa ihe ọdụ ụgbọ mmiri Seafile na-eji iwu netstat.

# netstat -tlpn

Ọ bụ ya! Sefile nwere ike iji obi ụtọ dochie igwe mmekọrịta igwe ojii ndị ọzọ yana nyiwe ịmekọrịta faịlụ dị ka ọha Dropbox, Owncloud, Pydio, OneDrive, wdg. na nzukọ gị, emebere ya maka ịrụkọ ọrụ ọnụ yana njikwa zuru oke na nchekwa gị yana nchekwa dị elu na oghere onye ọrụ.

N'ime edemede m na-abịa, m ga-ekpuchi otu esi etinye onye ahịa Seafile na Linux na sistemụ Windows ma gosikwa gị otu esi ejikọta na Seafile Server. Ruo mgbe ahụ nọrọ na nche na Tecment ma echefula ịnye nkọwa gị bara uru.