Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@gustavohenrique
Last active July 9, 2021 14:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gustavohenrique/18876c2a5870671f059c625c43d7fa90 to your computer and use it in GitHub Desktop.
Save gustavohenrique/18876c2a5870671f059c625c43d7fa90 to your computer and use it in GitHub Desktop.
Seafile is an open source alternative to Dropbox

Seafile

Server

Create the LXD container

# Create LXD profile for data storage
mkdir /home/gustavo/Cloud
cat > ~/Cloud/cloud.profile <<EOF
name: cloud
config:
  environment.TZ: America/Sao_Paulo
devices:
  public:
    path: /cloud
    type: disk
    source: /home/gustavo/Cloud
    readonly: false
EOF

# Create container for unprivileged user
lxc launch ubuntu-daily:20.04 seafile
printf "uid $(id -u) 1000\ngid $(id -g) 1000" | lxc config set seafile raw.idmap -
lxc profile add seafile cloud
lxc restart seafile

# Binding ports
lxc config device add seafile porta8000 proxy listen=tcp:0.0.0.0:8000 connect=tcp:127.0.0.1:8000
lxc config device add seafile porta8082 proxy listen=tcp:0.0.0.0:8082 connect=tcp:127.0.0.1:8082

Run inside the LXD container:

# Linux Mint pre requisites
sudo apt install -y build-essential vim tree net-tools python3 python3-setuptools python3-pip memcached libmemcached-dev pwgen sqlite3
sudo pip3 install --timeout=3600 django==2.2.* future Pillow pylibmc captcha jinja2 psd-tools django-pylibmc django-simple-captcha

# Install and change permissions
wget https://s3.eu-central-1.amazonaws.com/download.seadrive.org/seafile-server_8.0.5_x86-64.tar.gz
tar zxf seafile-server_8.0.5_x86-64.tar.gz
sudo mkdir /opt/seafile
sudo mv seafile-server-8.0.5 /opt/seafile/
sudo chown ubuntu:ubuntu -Rf /opt/seafile

# Create symlink to /cloud
cd /opt/seafile/seafile-server-8.0.5
./setup-seafile.sh auto -p 8082 -d /cloud -n dell -i dell
rm /opt/seafile/seafile-data
ln -sn /cloud /opt/seafile/seafile-data

# Start
ulimit -n 30000
./seafile.sh start
./seahub.sh start

Client

# Arch Linux
sudo pacman -Syu qt5-tools qt5-webengine

# libsearpc
git clone --depth 1 https://aur.archlinux.org/libsearpc.git
cd libsearpc
makepkg -si

# libseafile
git clone --depth 1 https://github.com/haiwen/seafile.git
cd seafile
./autogen.sh
./configure --prefix=/usr --with-python3
make
sudo make install

# seaf-cli
git clone --depth 1 https://github.com/haiwen/seafile.git
cd seafile
./autogen.sh
./configure --prefix=$HOME/Applications/seafile --with-python3 --enable-console
make && make install
cd python
make && make install
cp -r ~/Application/seafile/lib/python3.9/site-packages/* ~/.pyenv/versions/3.9.1/lib/python3.9/site-packages/
~/Applications/seafile/bin/seaf-cli help

# seafile-client-qt
mkdir -p ~/Applications/seafile
git clone --depth 1 https://github.com/haiwen/seafile-client.git
cd seafile-client
mkdir build
cd build
cmake -DBUILD_TESTING=ON -DBUILD_SHIBBOLETH_SUPPORT=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$HOME/Applications/seafile" ../
make
make install

Desktop shortcut:

cat > ~/.local/share/applications/seafile-client.desktop <<EOF
[Desktop Entry]
Name=Seafile
Comment=Seafile desktop sync client
TryExec=seafile-applet
Exec=$HOME/Applications/seafile/bin/seafile-applet
Icon=$HOME/Applications/seafile/share/icons/hicolor/scalable/apps/seafile.svg
Type=Application
Categories=Network;FileTransfer;
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment