Skip to content

Instantly share code, notes, and snippets.

Last active April 3, 2024 01:00
Show Gist options
  • Save Gargaj/2a8cb8c015244b6431b9 to your computer and use it in GitHub Desktop.
Save Gargaj/2a8cb8c015244b6431b9 to your computer and use it in GitHub Desktop.
Install script for Wuhu (tested on Debian)
# install script for
if [ "$EUID" -ne 0 ]
echo "[wuhu] ERROR: This script needs to install a bunch of things, so please run as root"
echo "[wuhu] Installing packages..."
apt-get install \
apache2 \
php7.3 \
php7.3-gd \
php7.3-mysql \
php7.3-curl \
php7.3-mbstring \
mariadb-server \
libapache2-mod-php7.3 \
mc \
git \
ssh \
# -------------------------------------------------
# set up the files / WWW dir
rm -rf /var/www/*
chmod -R g+rw /var/www
chown -R www-data:www-data /var/www
echo "[wuhu] Fetching the latest version of Wuhu..."
git clone /var/www/
mkdir /var/www/entries_private
mkdir /var/www/entries_public
mkdir /var/www/screenshots
chmod -R g+rw /var/www/*
chown -R www-data:www-data /var/www/*
# -------------------------------------------------
# set up PHP
echo "[wuhu] Setting up PHP..."
for i in /etc/php/7.3/*/php.ini
sed -i -e 's/^upload_max_filesize.*$/upload_max_filesize = 128M/' $i
sed -i -e 's/^post_max_size.*$/post_max_size = 256M/' $i
sed -i -e 's/^memory_limit.*$/memory_limit = 512M/' $i
sed -i -e 's/^session.gc_maxlifetime.*$/session.gc_maxlifetime = 604800/' $i
sed -i -e 's/^short_open_tag.*$/short_open_tag = On/' $i
# -------------------------------------------------
# set up Apache
echo "[wuhu] Setting up Apache..."
rm /etc/apache2/sites-enabled/*
echo -e \
"<VirtualHost *:80>\n" \
"\tDocumentRoot /var/www/www_party\n" \
"\t<Directory />\n" \
"\t\tOptions FollowSymLinks\n" \
"\t\tAllowOverride All\n" \
"\t</Directory>\n" \
"\tErrorLog \${APACHE_LOG_DIR}/party_error.log\n" \
"\tCustomLog \${APACHE_LOG_DIR}/party_access.log combined\n" \
"\t</VirtualHost>\n" \
"\n" \
"<VirtualHost *:80>\n" \
"\tDocumentRoot /var/www/www_admin\n" \
"\tServerName admin.lan\n" \
"\t<Directory />\n" \
"\t\tOptions FollowSymLinks\n" \
"\t\tAllowOverride All\n" \
"\t</Directory>\n" \
"\tErrorLog \${APACHE_LOG_DIR}/admin_error.log\n" \
"\tCustomLog \${APACHE_LOG_DIR}/admin_access.log combined\n" \
"</VirtualHost>\n" \
> /etc/apache2/sites-available/wuhu.conf
a2ensite wuhu
echo "[wuhu] Restarting Apache..."
service apache2 restart
# -------------------------------------------------
# TODO? set up nameserver / dhcp?
# -------------------------------------------------
# set up MySQL
service mysql restart
echo "[wuhu] Setting up MySQL (MariaDB)..."
echo -e "Enter a MySQL password for the Wuhu user: \c"
echo "Now connecting to MySQL..."
echo -e \
| mysql -u root -p
# -------------------------------------------------
# We're done, wahey!
printf "\n\n\n*** CONGRATULATIONS, Wuhu is now ready to configure at http://admin.lan\n"
Copy link

chainq commented Jan 30, 2021

I have installed this on a recent freshly installed Debian Buster AMD64. On top of what's described in this Gist, I found two things:

  • I had to modify apache2.conf to say AllowOverride all in the <Directory /var/www> section, despite having the required AllowOverride in the virtualhost config. (Although I installed it the whole shebang in directory /var/www/<mypartyname>,
    not sure if that would change this behavior, compared to /var/www.)
  • I had to run a2enmod authz_groupfile, otherwise the the generated .htaccess file couldn't be interpreted by Apache because of the AuthGroupFile /dev/null line in it. (An alternative would be deleting that line from the generated. .htaccess file in config.php, but I'm not sure which one is the better solution.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment