diff --git a/packages/DEBIAN/postinst b/packages/DEBIAN/postinst
index 0cb3957e36e5510ba598d20ccd96b85030a39a77..01b83ca77711c1b295a916eaa44aca213b75a845 100644
--- a/packages/DEBIAN/postinst
+++ b/packages/DEBIAN/postinst
@@ -1,5 +1,5 @@
 #!/bin/bash
- 
+
 # Script for installing VuFind 2.x on Ubuntu
 # This does not include the OCI8 libraries
 
@@ -15,22 +15,21 @@ if [ $? -ne 0 ]; then
 fi
 grep -q VUFIND_LOCAL_DIR= /etc/profile
 if [ $? -ne 0 ]; then
-    sudo sh -c 'echo export VUFIND_LOCAL_DIR=\"$VUFIND_HOME/local\"  >> /etc/profile'
+    sudo sh -c 'echo export VUFIND_LOCAL_DIR=\"\$VUFIND_HOME/local\"  >> /etc/profile'
 fi
 source /etc/profile
 
 # Turn on mod_rewrite in Apache.
 sudo a2enmod rewrite
- 
+
 # Set permissions so Apache can write to certain directories.
 sudo chown -R www-data:www-data $VUFIND_LOCAL_DIR/cache
 sudo chown -R www-data:www-data $VUFIND_LOCAL_DIR/config
- 
-# set up Apache for VuFind and reload configuration
-sudo ln -s $VUFIND_LOCAL_DIR/httpd-vufind.conf /etc/apache2/conf.d/vufind2
-sudo /etc/init.d/apache2 force-reload
- 
-# Finalize the installation 
+
+# Create the Apache configuration
 cd $VUFIND_HOME
 sudo php install.php --use-defaults
 
+# Set up Apache for VuFind and reload configuration
+sudo ln -s $VUFIND_LOCAL_DIR/httpd-vufind.conf /etc/apache2/conf.d/vufind2
+sudo /etc/init.d/apache2 force-reload