You are here: Home / Debian GNU/Linux / Web applications / Files management / Install ProjectSend professional file sharing tool on Debian

Install ProjectSend professional file sharing tool on Debian

by Pierre-Yves Landuré last modified Nov 26, 2016 09:55

ProjectSend (previously cFTP, for client oriented FTP) is a web file sharing tool for professionals. It solve the issue of sharing files between a company and its clients. Its main drawback is to be available only in english.

This howto is tested on :

  • Debian 6.0 Squeeze

This howto is tested with these versions of ProjectSend :

  • r157

Prerequisites

This howto needs :

This howto needs one of these tools, according to the installed HTTP server :

Parameters

Provide the domain name where will be available the software :

DOMAIN="files.example-domain.com"

Provide the MySQL server host :

MYSQL_HOST="localhost"

If the MySQL server is not local, the mysql-tools script will try to connect with MySQL client, or in case of connection failure, through SSH.

Installation

Compute the installation path :

INSTALL_PATH="/opt/projectsend/${DOMAIN}"

Make sure that the parent folder exists :

PARENT_PATH="$(command dirname "${INSTALL_PATH}")"
if [ ! -e "${PARENT_PATH}" ]; then
command mkdir --parent "${PARENT_PATH}"
fi

Environment preparation

Install the needed software :

command apt-get install php5-mysql unzip

Adjust PHP configuration to the application needs :

command php-tools --for="projectsend" --set "upload_max_filesize" "750M"
command php-tools --for="projectsend" --set "post_max_size" "750M"

Reload PHP configuration :

test -x /etc/init.d/php5-fpm && /etc/init.d/php5-fpm force-reload
test -x /etc/init.d/apache2 && /etc/init.d/apache2 force-reload
test -x /etc/init.d/lighttpd && /etc/init.d/lighttpd force-reload
test -x /etc/init.d/nginx && /etc/init.d/nginx force-reload

Application installation

Fetch the latest sources using the sf-downloader script :

command mkdir --parent '/opt/bin'
command wget 'https://raw.github.com/biapy/howto.biapy.com/master/various/sf-downloader' \
--quiet --no-check-certificate --output-document='/opt/bin/sf-downloader'
command chmod +x '/opt/bin/sf-downloader'
SOURCE="$(/opt/bin/sf-downloader --googlecode --zip clients-oriented-ftp ProjectSend-VERSION.zip)"

Move the source folder to the install path :

command mv "${SOURCE}" "${INSTALL_PATH}"

Fix the permissions :

command chmod go+rx "${INSTALL_PATH}"

Conformity with LSB

Move data folders to fit Linux Standard Base :

command mkdir --parent "/var/lib/projectsend"
command mv "${INSTALL_PATH}/upload" "/var/lib/projectsend/${DOMAIN}"
command ln -s "/var/lib/projectsend/${DOMAIN}" "${INSTALL_PATH}/upload"
command chown -R www-data:www-data "/var/lib/projectsend/${DOMAIN}"

Database creation

Create the database with mysql-tools :

MYSQL_PARAMS="$(command mysql-tools --server="${MYSQL_HOST}" --with-ssh \
--auto-hosts --db-prefix="tt-rss" --create "${DOMAIN}")"

Parse the database connection parameters :

MYSQL_DB="$(echo "${MYSQL_PARAMS}" | command grep -e "^MYSQL_DB" \
    | cut --delimiter="=" --fields="2-")"
MYSQL_USER="$(echo "${MYSQL_PARAMS}" | command grep -e "^MYSQL_USER" \
    | cut --delimiter="=" --fields="2-")"
MYSQL_PASSWORD="$(echo "${MYSQL_PARAMS}" | command grep -e "^MYSQL_PASSWORD" \
    | cut --delimiter="=" --fields="2-")"
echo "${MYSQL_PARAMS}"

Configuration

Create the configuration file from template :

command cp "${INSTALL_PATH}/includes/sys.config.sample.php" "${INSTALL_PATH}/includes/sys.config.php"

Setup the database connection :

command sed -i \
    -e "s/\(define('DB_NAME', \).*/\1'${MYSQL_DB}');/" \
    -e "s/\(define('DB_HOST', \).*/\1'${MYSQL_HOST}');/" \
    -e "s/\(define('DB_USER', \).*/\1'${MYSQL_USER}');/" \
    -e "s/\(define('DB_PASSWORD', \).*/\1'${MYSQL_PASSWORD}');/" \
    "${INSTALL_PATH}/includes/sys.config.php"

Setup the HTTP server for the application :

if [ -x "/usr/bin/a2tools" ]; then
  command a2tools "${DOMAIN}" "${INSTALL_PATH}"
fi
if [ -x "/usr/bin/lighty-tools" ]; then
  command lighty-tools add-vhost "${DOMAIN}" "${INSTALL_PATH}"
fi

The software should now be available on the domain name.

Initialization

Finish the software setup by browsing the URL displayed by :

command echo "http://${DOMAIN}/install"

Setup the administration account on this page.

Security hardening

Once the installation finished, delete the install folder :

command rm -r "${INSTALL_PATH}/install"

Backup

Backup the installation with Backup Manager (see Install and setup Backup Manager on Debian) :

command backup-manager-tools add "${INSTALL_PATH}"
command backup-manager-tools add "/var/lib/projectsend/${DOMAIN}"

Don't forget to backup the database (see Install and setup MySQL on Debian)

Software upgrade

Provide the application domain name :

DOMAIN="files.example-domain.com"

Compute the installation path :

INSTALL_PATH="/opt/projectsend/${DOMAIN}"

Fetch the latest sources using the sf-downloader script :

command mkdir --parent '/opt/bin'
command wget 'https://raw.github.com/biapy/howto.biapy.com/master/various/sf-downloader' \
--quiet --no-check-certificate --output-document='/opt/bin/sf-downloader'
command chmod +x '/opt/bin/sf-downloader'
SOURCE="$(/opt/bin/sf-downloader --googlecode --zip clients-oriented-ftp ProjectSend-VERSION.zip)"

Copy the data from the outdated install :

command rm -r "${SOURCE}/upload"
command cp -a "${INSTALL_PATH}/upload" "${SOURCE}"
command cp -a "${INSTALL_PATH}/includes/sys.config.php" "${SOURCE}/includes"

Fix the permissions :

command chmod go+rx "${SOURCE}"

Backup the outdated install :

if [ -e "${INSTALL_PATH}.old" ]; then
command rm -r "${INSTALL_PATH}.old"
fi
command mv "${INSTALL_PATH}" "${INSTALL_PATH}.old"

Install the latest version :

command mv "${SOURCE}" "${INSTALL_PATH}"

Check that everything work and delete backup data :

command rm -r "${INSTALL_PATH}.old"

Thanks