Koozali.org: home of the SME Server

Cloud "Seafile" unter SME 8

Offline RudiOnTheAir

  • *
  • 23
  • +0/-0
Cloud "Seafile" unter SME 8
« on: May 13, 2014, 10:14:01 AM »
Hallo

Ich habe auf meinem VServer jetzt die Dropboxalternative "Seafile" erfolgreich am laufen. Würde auf dem 8er SME das CLI des Seafile Client verwenden.

http://seafile.com/en/home/

Leider setzt der Client ein installiertes Python 2.6 oder 2.7 vorraus.

Hatte mal mit RPM für das 2.6er Python experimentiert. Leider fehlt es dann auf einmal an den Setuptools...

Scheint also nicht mal eben so zu sein. Von Centos jetzt mit einem anderen Repo auf python 2.6 upzugraden, ist wohl riskant, weil einige Bestandteile wie yum das vorraussetzen.

Gibt es einen anderen Weg, den Client zu installieren.? Dieses Seafile scheint sehr vielversprechend zu sein. Der Server selber läuft auf einem Centos 6 ohne Probleme..!

--
Rüdiger

Offline mmccarn

  • *
  • 2,626
  • +10/-0
Re: Cloud "Seafile" unter SME 8
« Reply #1 on: May 13, 2014, 01:11:45 PM »
[sorry - I don't speak german...]

python 2.7 supports "altinstall" to avoid conflicts with the base system. 

I have never found an rpm for python 2.7, but I have compiled and 'altinstalled' it from sources using these instructions:
http://stackoverflow.com/questions/4149361/on-linux-suse-or-redhat-how-do-i-load-python-2-7

Install gcc (considered a security risk):
Code: [Select]
yum install gcc
signal-event post-upgrade
signal-event reboot

Altinstall the latest python 2.x (currently 2.7.6):
Code: [Select]
RELEASE=2.7.6
mkdir -p ~/addons/python
cd ~/addons/python
wget http://www.python.org/ftp/python/$RELEASE/Python-$RELEASE.tgz
tar zxvf Python-$RELEASE.tgz
cd Python-$RELEASE
./configure
make
make altinstall

Use python2.7 with seafile:
Code: [Select]
PYTHON=/usr/local/bin/python2.7
export PYTHON
# seafile setup or startup command here

Offline RudiOnTheAir

  • *
  • 23
  • +0/-0
Re: Cloud "Seafile" unter SME 8
« Reply #2 on: May 13, 2014, 02:10:14 PM »
[sorry - I don't speak german...]

No problem.

That looks great. Later on i'll give it a try. Now i'm not able to reboot the sytem after installing gcc..
I'll report if is was successful..

Thanks

Offline RudiOnTheAir

  • *
  • 23
  • +0/-0
Re: Cloud "Seafile" unter SME 8
« Reply #3 on: May 13, 2014, 07:57:56 PM »
OK, python27 seems to be compiled.

But  ...

Traceback (most recent call last):
  File "/root/seafile/bin/seaf-cli.py", line 87, in <module>
    import ccnet
  File "/root/seafile/lib/python2.6/site-packages/ccnet/__init__.py", line 5, in <module>
    from ccnet.rpc import RpcClientBase, CcnetRpcClient, CcnetThreadedRpcClient
  File "/root/seafile/lib/python2.6/site-packages/ccnet/rpc.py", line 1, in <module>
    from pysearpc import SearpcClient, searpc_func, SearpcError
  File "/root/seafile/lib/python2.6/site-packages/pysearpc/__init__.py", line 2, in <module>
    from client import SearpcClient, searpc_func, SearpcObjEncoder
  File "/root/seafile/lib/python2.6/site-packages/pysearpc/client.py", line 1, in <module>
    import simplejson as json
ImportError: No module named simplejson

Offline RudiOnTheAir

  • *
  • 23
  • +0/-0
Re: Cloud "Seafile" unter SME 8
« Reply #4 on: May 14, 2014, 11:09:02 AM »
How to test the new python.?

After running
Code: [Select]
PYTHON=/usr/local/bin/python2.7
export PYTHON
python

i see the old version 2.4.x. Shouldn't it be the new one.? (in that terminal...)


Offline mmccarn

  • *
  • 2,626
  • +10/-0
Re: Cloud "Seafile" unter SME 8
« Reply #5 on: May 14, 2014, 01:04:15 PM »
How to test the new python.?
...
i see the old version 2.4.x. Shouldn't it be the new one.? (in that terminal...)

No - /usr/bin/python is still the 2.4 version (if not, yum stops working correctly)

The new python is /usr/local/bin/python2.7
Code: [Select]
# /usr/local/bin/python2.7 -V
Python 2.7.6

In my experience, some applications pay attention to the 'PYTHON' environment variable and some do not.

The script seafile-cli-wrapper.sh looks like it is automatically trying to use the env var if it exists, then python2.7, then python2.6 (if python2.7 didn't work), then aborts if none of these conditions is met. 

If all of the seafile scripts work the same way, as long as python2.7 -V returns something other than 'command not found', you should be OK.

# seafile cli client requires python 2.6 or 2.7
function check_python_executable() {
    if [[ "$PYTHON" != "" && -x $PYTHON ]]; then
return 0
    fi
if which python2.7 2>/dev/null 1>&2; then
PYTHON=python2.7
    elif which python27 2>/dev/null 1>&2; then
PYTHON=python27
    elif which python2.6 2>/dev/null 1>&2; then
PYTHON=python2.6
    elif which python26 2>/dev/null 1>&2; then
PYTHON=python26
    else
...

Offline RudiOnTheAir

  • *
  • 23
  • +0/-0
Re: Cloud "Seafile" unter SME 8
« Reply #6 on: May 14, 2014, 01:20:55 PM »
The new python is /usr/local/bin/python2.7
Code: [Select]
# /usr/local/bin/python2.7 -V
Python 2.7.6

Ah, there is no python2.7 on that location.

Is there something going wrong with the compile job.??

http://ur1.ca/hbcmj  << ./configure

http://ur1.ca/hbcqx << make (the 2nd try)

STOP... After 2nd make and make altinstall i can see the binary. No i'll test again...

root@sme-server-ler seafile]# python2.7
Python 2.7.6 (default, May 14 2014, 13:53:22)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-54)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
« Last Edit: May 14, 2014, 02:25:07 PM by RudiOnTheAir »

Offline RudiOnTheAir

  • *
  • 23
  • +0/-0
Re: Cloud "Seafile" unter SME 8
« Reply #7 on: May 14, 2014, 02:22:25 PM »
Sorry, now i now that the binary is present, but the error message is the same like in that post:

http://forums.contribs.org/index.php/topic,50809.msg256501.html#msg256501

That simplejson... Is that part of the new python2.7? I can find a python-simplejson via yum.

======= Matched: simplejson =================================
python-simplejson.i386 : Simple, fast, extensible JSON encoder/decoder for Python

But:

Package python-simplejson-2.0.9-8.el5.i386 already installed and latest version

What to do next.? ;)


Offline RudiOnTheAir

  • *
  • 23
  • +0/-0
Re: Cloud "Seafile" unter SME 8
« Reply #8 on: May 16, 2014, 10:18:25 AM »
Hi

Are there no additional solutions to get seafile running on SME 8.?

Gibt es keine weiteren Möglichkeiten, Seafile auf einem SME 8 zum laufen zu bringen.?

Habe jetzt bereits erfolgreich den Client unter aktuellen Linux Distris und Windows 7 in Betrieb... Aber der SME8 (Centos5) ist leider etwas
inaktuell, was natürlich wegen der Zuverlässigkeit  auch ok ist, aber bei solchen Vorhaben leider hinderlich. Wäre schade...

Offline mmccarn

  • *
  • 2,626
  • +10/-0
Re: Cloud "Seafile" unter SME 8
« Reply #9 on: May 16, 2014, 02:16:57 PM »
I think these commands will install simplejson in a way that python2.7 can find it:
Code: [Select]
mkdir -p ~/addons/python/tools
cd ~/addons/python/tools
wget --no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-3.5.1.zip
unzip setuptools-3.5.1.zip
python2.7 easy_install.py simplejson

After running the above commands, these commands seem to indicate that simplejson is loaded correctly (my typing in blue):
Quote
# python2.7
Python 2.7.6 (default, Nov 14 2013, 09:04:59)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-54)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import simplejson as json
>>> json.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}])
'["foo", {"bar": ["baz", null, 1.0, 2]}]'

Based on this stackexchange post, and some digging (the easyinstall installation command throws an untrusted certificate error):
http://stackoverflow.com/questions/718040/how-to-install-simplejson-package-for-python

Offline mmccarn

  • *
  • 2,626
  • +10/-0
Re: Cloud "Seafile" unter SME 8
« Reply #10 on: May 16, 2014, 02:49:57 PM »
Seahub ... needs the following python libraries:

    django 1.5
    djblets
    sqlite3
    simplejson (python-simplejson)
    PIL (aka. python imaging library, python-image)
    chardet
    gunicorn

I couldn't find 'easy_install.py' instructions for installing django 1.5, so I installed pip.

Here are commands that install the listed seafile python required libraries into my python2.7:
Code: [Select]
cd ~/addons/python/tools
wget https://bootstrap.pypa.io/get-pip.py --no-check-certificate
python2.7 get-pip.py
pip install Django==1.5
#
# pip couldn't find djblets, so I installed that with easy_install.py downloaded previously
cd ~/addons/python/tools/setuptools-3.5.1
python2.7 easy_install.py djblets
#
# I couldn't find an installer for sqlite3 - see comment below
# pip install sqlite3
#
# We already installed simplejson (above, using easy_install.py), but it looks like we could have done it with pip, too
# pip install simplejson
#
# PIL appeared at some point by itself
# pip install PIL reported 'requirement already satisfied'
#
pip install chardet
pip install gunicorn

For the sqlite3 requirement, you may need to install sqlite-dev and re-compile python2.7 (I'm guessing here).

Offline RudiOnTheAir

  • *
  • 23
  • +0/-0
Re: Cloud "Seafile" unter SME 8
« Reply #11 on: May 16, 2014, 04:12:37 PM »
Hi and thanks for your help. But sadly i have the next showstopper...

Quote
[root@sme-server-ler setuptools-3.5.1]# python2.7 easy_install.py simplejson
Searching for simplejson
Reading https://pypi.python.org/simple/simplejson/
Download error on https://pypi.python.org/simple/simplejson/: unknown url type: https -- Some packages may not be found!
Couldn't find index page for 'simplejson' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading https://pypi.python.org/simple/
Download error on https://pypi.python.org/simple/: unknown url type: https -- Some packages may not be found!
No local packages or download links found for simplejson
error: Could not find suitable distribution for Requirement.parse('simplejson')
[root@sme-server-ler setuptools-3.5.1]#

I'm not sure, but what do you think about this thread. After compiling i got some error, that zlib and other parts are not installed. I have installed via yum zlib-devel and after the next pyhon2.7 compile run that zlib error disappeared.!


http://forums.fedoraforum.org/showpost.php?s=751fd32c27d46a3dfaf24ad20ecbd306&p=1678623&postcount=7

bzip2-devel
mercurial
ncurses-devel
openssl-devel
python-argparse
python-tools
python-setuptools
readline-devel
sqlite-devel
tk-devel
zlib-devel


But do i really install all this packages.? Won't break the system...

Offline mmccarn

  • *
  • 2,626
  • +10/-0
Re: Cloud "Seafile" unter SME 8
« Reply #12 on: May 17, 2014, 01:21:01 PM »
simlejson:
I suspect you need to 'yum install openssl-devel' (from 'smeupdates') and recompile python2.7 first

Development Packages:
Each development package you install becomes another item that you need to remember to update regularly so that your compiled output (python2.7) doesn't include bugs or vulnerabilities that have been fixed in one of the included packages.

Installing gcc has already taken you off of the contribs.org reservation -- you will need to pay more attention to your server security than you would with a less customized configuration:

- Having gcc installed at all is considered a security weakness, in the sense that some attacks on your system are not possible if gcc is not installed, so with it installed there are are more possible ways that you might be attacked (I read about this in the 1990s, and have never heard that it is no longer true).

- Having an uncommon server configuration means that bugs or vulnerabilities in your configuration must be detected by you personally - there won't be a community of other users keeping an eye on your server's exact config, as there is with a more standard SME server config. 

(I try to monitor custom packages and installed webapps on my server using "netvibes" so that I get timely information on available updates.)

There is a another possible challenge that comes with custom software on a SME server:  if you compile and install from sources any package that is included with SME, your server may have problems when you install regular SME updates.  This issue shouldn't apply to you, since the only item you're compiling is python2.7, installed using "altinstall" precisely to avoid changing any SME components.

Offline RudiOnTheAir

  • *
  • 23
  • +0/-0
Re: Cloud "Seafile" unter SME 8
« Reply #13 on: May 17, 2014, 04:51:34 PM »
Sorry, no way.

Cannot download via https.

It would be nice, if the maintainer from seafile can put all tools in one tgz to get it running in Centos5...

But now i go from one problem to the next...