-
-
Save chainq/b20cbbf9643278c1c006d56aa797e49e to your computer and use it in GitHub Desktop.
Install script for Wuhu (tested on Debian)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# install script for http://wuhu.function.hu/ | |
if [ "$EUID" -ne 0 ] | |
then | |
echo "[wuhu] ERROR: This script needs to install a bunch of things, so please run as root" | |
exit | |
fi | |
echo "[wuhu] Installing packages..." | |
apt-get install \ | |
apache2 \ | |
php8.2 \ | |
php8.2-gd \ | |
php8.2-mysql \ | |
php8.2-curl \ | |
php8.2-mbstring \ | |
mariadb-server \ | |
libapache2-mod-php8.2 \ | |
mc \ | |
git \ | |
ssh \ | |
sudo | |
# ------------------------------------------------- | |
# 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 https://github.com/Gargaj/wuhu.git /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/8.2/*/php.ini | |
do | |
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 | |
done | |
# ------------------------------------------------- | |
# 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" | |
read -s WUHU_MYSQL_PASS | |
echo "Now connecting to MySQL..." | |
echo -e \ | |
"CREATE DATABASE wuhu;\n" \ | |
"GRANT ALL PRIVILEGES ON wuhu.* TO 'wuhu'@'%' IDENTIFIED BY '$WUHU_MYSQL_PASS';\n" \ | |
| mysql -u root -p | |
# ------------------------------------------------- | |
# We're done, wahey! | |
printf "\n\n\n*** CONGRATULATIONS, Wuhu is now ready to configure at http://admin.lan\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment