You are here: Home / Debian GNU/Linux / Web applications / Bookmarks management / Install Semantic Scuttle bookmarks sharing software on Debian

Install Semantic Scuttle bookmarks sharing software on Debian

by Pierre-Yves Landuré last modified Nov 08, 2017 02:53

Semantic Scuttle is a open source alternative to social sharing services as Digg. It is based on Scuttle with semantic functionalities. I have found it the best among the software I tested.

This howto is tested on :

  • Debian 6.0 Squeeze

This howto is tested with these versions of Semantic Scuttle :

  • 0.98.4

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="links.example-domain.com"

Provide the protocol used to view the software (http or https) :

PROTOCOL="http"

Provide the administration account email address :

ADMIN_EMAIL="webmaster@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/semantic-scuttle/${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 mysql-client unzip apg

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'
/opt/bin/sf-downloader --zip --strip-components=1 --output-directory="${INSTALL_PATH}" \
"semanticscuttle" "SemanticScuttle-VERSION.zip"

Move the source folder to the install path :

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

Database creation

Create the database with mysql-tools :

MYSQL_PARAMS="$(command mysql-tools --server="${MYSQL_HOST}" --with-ssh \
--auto-hosts --db-prefix="semantic-scuttle" --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}"

Create a random table prefix to prevent SQL injection attacks :

TABLE_PREFIX="$(command apg -q -a  0 -n 1 -M NCL)"

Initialize database contents :

command cat "${INSTALL_PATH}/data/tables.sql" \
| command sed -e "s/sc_/${TABLE_PREFIX}_/g" \
| command mysql --user="${MYSQL_USER}" --password="${MYSQL_PASSWORD}" \ --host="${MYSQL_HOST}" "${MYSQL_DB}"

Conformity with LSB

Move data and cache folders to fit Linux Standard Base :

command mkdir --parent "/var/cache/semantic-scuttle/${DOMAIN}"
command chown -R www-data:www-data "/var/cache/semantic-scuttle/${DOMAIN}"

Configuration

Create the configuration file :

echo "<?php
\$dbtype = 'mysqli';
\$dbuser = '${MYSQL_USER}';
\$dbpass = '${MYSQL_PASSWORD}';
\$dbname = '${MYSQL_DB}';
\$dbhost = '${MYSQL_HOST}';
\$tableprefix = '${TABLE_PREFIX}_';

\$cleanurls = true;
\$locale = 'fr_FR';
\$shortdate = 'd/m/Y';
\$use_cache = true;
\$dir_cache = '/var/cache/semantic-scuttle/${DOMAIN}';

\$root = '${PROTOCOL}://${DOMAIN}/';
\$admin_users = array('admin');
\$adminemail = '${ADMIN_EMAIL}';

\$antispamQuestion = '29 + 13 ?';
\$antispamAnswer = '42';
" > "${INSTALL_PATH}/data/config.php"

Setup the HTTP server for the application :

if [ -x "/usr/bin/a2tools" ]; then
  command a2enmod expires
  command a2tools --overrides="All" "${DOMAIN}" "${INSTALL_PATH}/www"
  /etc/init.d/apache2 force-reload
fi
if [ -x "/usr/bin/lighty-tools" ]; then
  command lighty-tools add-vhost "${DOMAIN}" "${INSTALL_PATH}/www"
fi

The software should now be available on the domain name.

Important : Create the administration account by registering a user with "admin" as username.

Advanced setup

Disable registration

If you do not want the visitors to be able to create a user account, disable the registration (after the "admin" user account creation) :

command echo '$enableRegistration = false;
' >> "${INSTALL_PATH}/data/config.php"

Customize title and description

Provide the custom title :

TITLE="Mes liens"

Provide the custom description (displayed on home page) :

DESC="Liens en vrac"

Apply the settings :

echo "\$sitename = \"${TITLE}\";
\$welcomeMessage = \"${DESC}\";" >> "${INSTALL_PATH}/data/config.php"

Use with Mozilla Firefox

In addition to the bookmarklet providing a easy way to add links to the directory from any browser, there is a Firefox add-on enhancing the integration of Scuttle in this browser :

Scuttle add-on for Firefox

Backup

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

command backup-manager-tools add "${INSTALL_PATH}"

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

Software upgrade

Provide the application domain name :

DOMAIN="links.example-domain.com"

Compute the installation path :

INSTALL_PATH="/opt/semantic-scuttle/${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 --zip semanticscuttle SemanticScuttle-VERSION.zip)"

Backup the installation :

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

Setup the new version :

command mv "${SOURCE}" "${INSTALL_PATH}"
command cp -a "${INSTALL_PATH}.old/data/config.php" "${INSTALL_PATH}/data/config.php"

The software is now up-to-date. Check that everything work.

Delete the backup :

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

Thanks