Skip to content

Instantly share code, notes, and snippets.

@lfzawacki
Last active August 29, 2015 14:23
Show Gist options
  • Save lfzawacki/2d06512885d8cd585188 to your computer and use it in GitHub Desktop.
Save lfzawacki/2d06512885d8cd585188 to your computer and use it in GitHub Desktop.
install-owncloud.sh
#!/bin/bash -e
FILENAME=owncloud-8.0.4.tar.bz2
LATEST=https://download.owncloud.org/community/$FILENAME
SHA=https://download.owncloud.org/community/$FILENAME.sha256
PGP=https://download.owncloud.org/community/$FILENAME.asc
INSTALL_PATH=/var/www
OWNCLOUD_USER='www-data'
echo " --- Download and check sha256 sum"
echo ""
wget $LATEST -nc -q
wget $SHA -N -q
cat $FILENAME | sha256sum -c $FILENAME.sha256
echo ""
echo " --- Importing GPG key and checking"
echo ""
wget $PGP -N -q
wget https://www.owncloud.org/owncloud.asc -Nq
gpg --import owncloud.asc
gpg --verify $FILENAME.asc $FILENAME
echo ""
echo " --- Extracting files"
echo ""
tar -xjf $FILENAME
echo ""
echo " --- Moving files to $INSTALL_PATH"
echo ""
cp -r owncloud $INSTALL_PATH
find ${INSTALL_PATH}/ -type f -print0 | xargs -0 chmod 0640
find ${INSTALL_PATH}/ -type d -print0 | xargs -0 chmod 0750
chown -R root:${OWNCLOUD_USER} ${INSTALL_PATH}/
chown -R ${OWNCLOUD_USER}:${OWNCLOUD_USER} ${INSTALL_PATH}/apps/
chown -R ${OWNCLOUD_USER}:${OWNCLOUD_USER} ${INSTALL_PATH}/config/
chown -R ${OWNCLOUD_USER}:${OWNCLOUD_USER} ${INSTALL_PATH}/data/
chown -R ${OWNCLOUD_USER}:${OWNCLOUD_USER} ${INSTALL_PATH}/themes/
chown root:${OWNCLOUD_USER} ${INSTALL_PATH}/.htaccess
chown root:${OWNCLOUD_USER} ${INSTALL_PATH}/data/.htaccess
chmod 0644 ${INSTALL_PATH}/.htaccess
chmod 0644 ${INSTALL_PATH}/data/.htaccess
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment