Install Pydio/AjaXplorer web file manager on Debian
Pydio is a web file manager allowing to manage server files through a Web browser. It is light, simple of use, and allow to access the server file system using WebDAV protocol.
This how-to is tested on:
- Debian 7.0 Wheezy
This how-to is tested with these Pydio versions:
- 5.0.1
- 5.2.0
Prerequisites
This how-to needs :
- a2tools, a script easing Apache 2 server administration.
- a HTTP server with PHP, as described by Install PHP-FPM on Debian.
- the PHP OpCode cache APC, as described by Install the PHP extension APC on Debian.
- php-tools, a script easing PHP configuration.
- a MySQL server, as described by Install and setup MySQL on Debian.
- mysql-tools, a script easing MySQL server administration on localhost (and MySQL server host, if other).
This howto recommends :
- The setup of a email alert on new PEAR upgrades availability, as described by Setup a email alert for PEAR upgrades.
Warning
This how-to is incompatible with this posts:
Parameters
Provide the domain name where the software will be available :
DOMAIN="pydio.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.
Provide the name of the SSL certificate to use (created by following Create a SSL / TLS certificate on Debian) (optionnal, recommended):
SSL_KEY_NAME="${DOMAIN}"
Installation
Compute the installation path:
INSTALL_PATH="/opt/pydio/${DOMAIN}"
Compute the data paths:
DATA_PATH="/var/lib/pydio/${DOMAIN}"
Compute the logs path:
LOG_PATH="/var/log/pydio/${DOMAIN}"
Compute the cache path:
CACHE_PATH="/var/cache/pydio/${DOMAIN}"
Make sure that the parent folders exists :
command mkdir -p "$(command dirname "${INSTALL_PATH}")"
command mkdir -p "$(command dirname "${DATA_PATH}")"
command mkdir -p "$(command dirname "${LOG_PATH}")"
command mkdir -p "$(command dirname "${CACHE_PATH}")"
Environment preparation
Install the needed softwares:
command apt-get install php5-mcrypt php5-gd php5-curl php5-imap \
php5-mysql php-pear imagemagick patch git subversion zip unzip
Upgrade PEAR:
pear channel-update pear.php.net
pear upgrade PEAR
Install PEAR extensions used by the software:
command pear install HTTP_WebDAV_Client
command pear install Mail_mimeDecode
command pear install 'channel://pear.php.net/HTTP_OAuth-0.2.3'
command pear install 'channel://pear.php.net/VersionControl_Git-0.4.4'
Adjust PHP configuration to the application needs:
command php-tools --for="pydio" --set "upload_max_filesize" "1024M"
command php-tools --for="pydio" --set "post_max_size" "1030M"
command php-tools --for="pydio" --fix "output_buffering" "0"
Reload PHP configuration:
if command type -f 'service' &>'/dev/null'; then
test -e '/etc/init.d/php5-fpm' && command service 'php5-fpm' 'restart'
test -e '/etc/init.d/apache2' && command service 'apache2' 'force-reload'
test -e '/etc/init.d/lighttpd' && command service 'lighttpd' 'force-reload'
test -e '/etc/init.d/nginx' && command service 'nginx' 'force-reload'
else
test -x '/etc/init.d/php5-fpm' && /etc/init.d/php5-fpm 'restart'
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'
fi
Application installation
Fetch the latest sources using the sf-downloader script :
command wget 'https://raw.github.com/biapy/howto.biapy.com/master/various/sf-downloader' \
--quiet --no-check-certificate --output-document='/tmp/sf-downloader'
SOURCE="$(command bash '/tmp/sf-downloader' --output-directory="${INSTALL_PATH}" --strip-components=1 \
--zip 'ajaxplorer' 'pydio-core-VERSION.zip')"
Add CKEditor to the software:
CK_SOURCE="$(command bash '/tmp/sf-downloader' --output-directory="${INSTALL_PATH}/plugins/editor.ckeditor" \
--ckeditor --zip 'ckeditor' 'ckeditor_VERSION_standard.zip')"
Add Plupload to the software:
PLUPLOAD_SOURCE="$(commmand bash '/tmp/sf-downloader' --output-directory="${INSTALL_PATH}/plugins/uploader.plupload" \
--generic='http://www.plupload.com/download' \
--zip 'plupload' 'vVERSION.zip')"
Add Jumploader to the software:
command wget 'http://jumploader.com/jar/jumploader_z.jar' \
--output-document="${INSTALL_PATH}/plugins/uploader.jumploader/jumploader_z.jar"
Conformity with LSB
Move data folders to fit Linux Standard Base:
if [ ! -h "${INSTALL_PATH}/data/cache" ]; then
command mv "${INSTALL_PATH}/data/cache" "${CACHE_PATH}"
command ln -s "${CACHE_PATH}" "${INSTALL_PATH}/data/cache"
command chown -R www-data:www-data "${CACHE_PATH}"
fi
if [ ! -h "${INSTALL_PATH}/data/logs" ]; then
command mv "${INSTALL_PATH}/data/logs" "${LOG_PATH}"
command ln -s "${LOG_PATH}" "${INSTALL_PATH}/data/logs"
command chown -R www-data:www-data "${LOG_PATH}"
fi
if [ ! -h "${INSTALL_PATH}/data" ]; then
command mv ${INSTALL_PATH}"/data" "${DATA_PATH}"
command ln -s "${DATA_PATH}" "${INSTALL_PATH}/data"
command chown -R www-data:www-data "${DATA_PATH}"
fi
Virtual host setup
Setup the HTTP server virtual host:
if [ -n "${SSL_KEY_NAME}" -a -e "/etc/ssl/private/${SSL_KEY_NAME}.key" ]; then
command a2tools --overrides="All" --ssl="${SSL_KEY_NAME}" "${DOMAIN}" "${INSTALL_PATH}"
command a2tools --template='redirect' "${DOMAIN}" "https://${DOMAIN}/"
else
command a2tools --overrides="All" "${DOMAIN}" "${INSTALL_PATH}"
fi
The application is now available on the specified domain name with HTTP and HTTPS protocols if possible.
Création de la base de données
Create the database with mysql-tools:
MYSQL_PARAMS="$(command mysql-tools --server="${MYSQL_HOST}" --with-ssh \
--auto-hosts --db-prefix="pydio" --create "${DOMAIN}")"
Fetch the database 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}"
Write down the provided connexion parameters.
Configuration
Adjust the .htaccess file:
command sed -i \
-e 's|RewriteBase.*|RewriteBase /|' \
"${INSTALL_PATH}/.htaccess"
If the system use PHP-FPM, install the needed fix:
if [ -x '/etc/init.d/php5-fpm' ]; then
command sed -i \
-e 's|^#\(.*HTTP:Authorization.*\)$|\1|' \
-e 's|^#\(.*HTTP_AUTHORIZATION.*\)$|\1|' \
"${INSTALL_PATH}/.htaccess"
fi
The application is now available on the specified domain name with HTTP and HTTPS protocols if possible. Finalize the installation.
Finalisation
In "Main options" -> "AjaXplorer Main Options" -> "WebDAV server":
- Enable WebDAV: Yes
- Shares URI: "/shares"
- Browser Access: Yes
In "Main options" -> "AjaXplorer Main Options" -> "Command Line":
- Command line: Yes
In "Main options" -> "AjaXplorer Main Options" -> "Compression":
- Gzip compression: Yes
In "Main options" -> "Mailers", setup the emails addresses used by the software to send emails.
In "Extensions" -> "Action", enable theses plugins:
- Power FS
- Tasks Scheduler
In "Extensions" -> "Editor", enable theses plugins:
- Image Magick
- CKEditor
In "Extensions" -> "Uploader", enable theses plugins (optionnal):
- PlUpload Support
- Jumploader
Provide the username of the administration account:
ADMIN_USER="admin"
Provide the password of the administration account:
ADMIN_PASSWORD="password"
Setup a regular call to Task Scheduler:
command echo "*/5 * * * * www-data command test -x '/usr/bin/php' -a -e '${INSTALL_PATH}/cmd.php' && /usr/bin/php '${INSTALL_PATH}/cmd.php' -u='${ADMIN_USER}' -p='${ADMIN_PASSWORD}' -r=ajxp_conf -a=scheduler_runAll > '/dev/null'" \
> "/etc/cron.d/pydio-${DOMAIN//./-}"
Reload cron configuration
command type -f 'service' &>'/dev/null' && command service 'cron' 'reload'
command type -f 'service' &>'/dev/null' || /etc/init.d/cron 'reload'
Kown issues
If you can not login with the administrator account at the end of the installation, provide the administrator account login:
ADMIN_USER="admin"
Reset the administrator account password to "admin":
command echo "UPDATE ajxp_users SET password = '21232f297a57a5a743894a0e4a801fc3' WHERE ajxp_users.login = '${ADMIN_USER}' LIMIT 1" \
| command mysql --user="${MYSQL_USER}" --password="${MYSQL_PASSWORD}" \ --host="${MYSQL_HOST}" "${MYSQL_DB}"
You can now connect to the administrator account by using the password "admin"
Backups
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 "${DATA_PATH}"
Don't forget to backup the database (see Install and setup MySQL on Debian).
Software upgrade
Provide the application domain name:
DOMAIN="pydio.domain.com"
Compute the installation path :
INSTALL_PATH="/opt/pydio/${DOMAIN}"
Fetch the latest sources using the sf-downloader script:
command wget 'https://raw.github.com/biapy/howto.biapy.com/master/various/sf-downloader' \
--quiet --no-check-certificate --output-document='/tmp/sf-downloader'
SOURCE="$(command bash '/tmp/sf-downloader' --zip 'ajaxplorer' 'pydio-core-VERSION.zip')"
Add CKEditor to the software:
CK_SOURCE="$(command bash '/tmp/sf-downloader' --output-directory="${SOURCE}/plugins/editor.ckeditor" \
--ckeditor --zip 'ckeditor' 'ckeditor_VERSION_standard.zip')"
Add Plupload to the software:
PLUPLOAD_SOURCE="$(command bash '/tmp/sf-downloader' --output-directory="${SOURCE}/plugins/uploader.plupload" \
--generic='http://www.plupload.com/download.php' \
--zip 'plupload' 'vVERSION.zip')"
Copy the data from the outdated install :
command rm -r "${SOURCE}/data" command cp -a "${INSTALL_PATH}/data" "${SOURCE}"
Adjust the .htaccess file :
command sed -i \
-e 's|RewriteBase.*|RewriteBase /|' \
"${SOURCE}/.htaccess"
If the system use PHP-FPM, install the needed fix:
if [ -x '/etc/init.d/php5-fpm' ]; then
command sed -i \
-e 's|^#\(.*HTTP:Authorization.*\)$|\1|' \
-e 's|^#\(.*HTTP_AUTHORIZATION.*\)$|\1|' \
"${INSTALL_PATH}/.htaccess"
fi
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 old installation backup:
command rm -r "${INSTALL_PATH}.old"
Thanks
- Thanks to Pydio/AjaXplorer developers.