Skip to content

Instantly share code, notes, and snippets.

@clem9669
Created February 3, 2025 19:22
Show Gist options
  • Select an option

  • Save clem9669/b62e230e319c392f4f26aea03d622682 to your computer and use it in GitHub Desktop.

Select an option

Save clem9669/b62e230e319c392f4f26aea03d622682 to your computer and use it in GitHub Desktop.
Hashtopolis Script install Ubuntu24.10
I used a clean ubuntu 24.10 installation for this setup.
It requires some modifications to files. Depending on code changes this can stop working. I provide no guarantee it'll work.
Put the following script in setup.sh and run `bash setup.sh`
-------------------------------------------------------------------------------------------------------
sudo apt update -y && sudo apt dist-upgrade
sudo apt install git apache2 php8.3 php8.3-pdo php8.3-mysql php8.3-common php8.3-xml php-pear mariadb-server -y
git clone https://github.com/hashtopolis/server
cp -r server/src /var/www/hashtopolis
chown www-data:www-data -R /var/www/hashtopolis
mkdir /usr/local/share/hashtopolis
chown www-data:www-data -R /usr/local/share/hashtopolis
PASSWORD=$(tr -dc 'A-Za-z0-9' </dev/urandom | head -c 21)
mysql -u root -e "CREATE DATABASE hashtopolis;"
mysql -u root -e "CREATE USER 'htp_user'@'localhost' IDENTIFIED BY '$PASSWORD';"
mysql -u root -e "GRANT ALL PRIVILEGES ON hashtopolis.* TO 'htp_user'@'localhost';"
mysql -u root -e "FLUSH PRIVILEGES;"
mv /var/www/hashtopolis/inc/conf.template.php /var/www/hashtopolis/inc/conf.php
sed -Ei 's/__DBUSER__/htp_user/g' /var/www/hashtopolis/inc/conf.php
sed -Ei 's/__DBPASS__/'$PASSWORD'/g' /var/www/hashtopolis/inc/conf.php
sed -Ei 's/__DBSERVER__/localhost/g' /var/www/hashtopolis/inc/conf.php
sed -Ei 's/__DBDB__/hashtopolis/g' /var/www/hashtopolis/inc/conf.php
sed -Ei 's/__DBPORT__/3306/g' /var/www/hashtopolis/inc/conf.php
echo "\$INSTALL = true;" >> /var/www/hashtopolis/inc/conf.php
sed -Ei 's/html/hashtopolis/g' /etc/apache2/sites-enabled/000-default.conf
sed -i 's/max_execution_time = 30/max_execution_time = 3600/g' /etc/php/8.3/apache2/php.ini
sed -i 's/max_input_time = 60/max_input_time = 3600/g' /etc/php/8.3/apache2/php.ini
sed -i 's/memory_limit = 128M/memory_limit = 1024M/g' /etc/php/8.3/apache2/php.ini
sed -i 's/post_max_size = 8M/post_max_size = 10240M/g' /etc/php/8.3/apache2/php.ini
sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 10240M/g' /etc/php/8.3/apache2/php.ini
sed -i 's/max_file_uploads = 20/max_file_uploads = 100/g' /etc/php/8.3/apache2/php.ini
echo "key_buffer_size = 256M" >> /etc/mysql/mariadb.conf.d/50-server.cnf
service mysql restart
service apache2 restart
ACCOUNT_PW=$(tr -dc 'A-Za-z0-9' </dev/urandom | head -c 16)
sed -i "s/\$password = \"hashtopolis\";/\$password = \""$ACCOUNT_PW"\";/g" /var/www/hashtopolis/inc/load.php
echo "Created account 'admin' with password: $ACCOUNT_PW"
-------------------------------------------------------------------------------------------------------
go to http://<ip> only after the script completes - browsing there early can break the installation.
to improve mysql performance set innodb_buffer_pool_size = 80% of available RAM in /etc/mysql/mariadb.conf.d/50-server.cnf and restart the mysql server with: "service mysql restart".
Example: innodb_buffer_pool_size=12G
for a 16GB-RAM server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment