|
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | +# Copyright (c) 2021-2025 community-scripts ORG |
| 4 | +# Author: bvdberg01 |
| 5 | +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE |
| 6 | + |
| 7 | +source /dev/stdin <<< "$FUNCTIONS_FILE_PATH" |
| 8 | +color |
| 9 | +verb_ip6 |
| 10 | +catch_errors |
| 11 | +setting_up_container |
| 12 | +network_check |
| 13 | +update_os |
| 14 | + |
| 15 | +msg_info "Installing Dependencies" |
| 16 | +$STD apt-get install -y \ |
| 17 | + curl \ |
| 18 | + sudo \ |
| 19 | + mc \ |
| 20 | + lsb-release \ |
| 21 | + mariadb-server \ |
| 22 | + mariadb-client \ |
| 23 | + apache2 \ |
| 24 | + composer |
| 25 | +msg_ok "Installed Dependencies" |
| 26 | + |
| 27 | +msg_info "Adding PHP8.3 Repository" |
| 28 | +$STD curl -sSLo /tmp/debsuryorg-archive-keyring.deb https://packages.sury.org/debsuryorg-archive-keyring.deb |
| 29 | +$STD dpkg -i /tmp/debsuryorg-archive-keyring.deb |
| 30 | +$STD sh -c 'echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list' |
| 31 | +$STD apt-get update |
| 32 | +msg_ok "Added PHP8.3 Repository" |
| 33 | + |
| 34 | +msg_info "Installing PHP" |
| 35 | +$STD apt-get remove -y php8.2* |
| 36 | +$STD apt-get install -y \ |
| 37 | + php8.3 \ |
| 38 | + php8.3-{gd,mysql,mbstring,bcmath,xml,curl,zip,intl,sqlite3,fpm} \ |
| 39 | + libapache2-mod-php8.3 |
| 40 | +msg_info "Installed PHP" |
| 41 | + |
| 42 | +msg_info "Setting up MariaDB" |
| 43 | +DB_NAME=panel |
| 44 | +DB_USER=pelican |
| 45 | +DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13) |
| 46 | +$STD mysql -u root -e "CREATE DATABASE $DB_NAME;" |
| 47 | +$STD mysql -u root -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED WITH mysql_native_password AS PASSWORD('$DB_PASS');" |
| 48 | +$STD mysql -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH PRIVILEGES;" |
| 49 | +{ |
| 50 | + echo "Pelican Panel-Credentials" |
| 51 | + echo "Pelican Panel Database User: $DB_USER" |
| 52 | + echo "Pelican Panel Database Password: $DB_PASS" |
| 53 | + echo "Pelican Panel Database Name: $DB_NAME" |
| 54 | +} >> ~/pelican-panel.creds |
| 55 | +msg_ok "Set up MariaDB" |
| 56 | + |
| 57 | +msg_info "Installing Pelican Panel" |
| 58 | +RELEASE=$(curl -s https://api.github.com/repos/pelican-dev/panel/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') |
| 59 | +mkdir /opt/pelican-panel |
| 60 | +cd /opt/pelican-panel |
| 61 | +wget -q "https://github.com/pelican-dev/panel/releases/download/v${RELEASE}/panel.tar.gz" |
| 62 | +tar -xzf "panel.tar.gz" |
| 63 | +$STD composer install --no-dev --optimize-autoloader --no-interaction |
| 64 | +$STD php artisan p:environment:setup |
| 65 | +$STD php artisan p:environment:queue-service --no-interaction |
| 66 | +echo "* * * * * php /opt/pelican-panel/artisan schedule:run >> /dev/null 2>&1" | crontab -u www-data - |
| 67 | +chown -R www-data:www-data /opt/pelican-panel |
| 68 | +chmod -R 755 /opt/pelican-panel/storage /opt/pelican-panel/bootstrap/cache/ |
| 69 | +echo "${RELEASE}" >/opt/${APPLICATION}_version.txt |
| 70 | +msg_ok "Installed Pelican Panel" |
| 71 | + |
| 72 | +msg_info "Creating Service" |
| 73 | +cat <<EOF >/etc/apache2/sites-available/pelican.conf |
| 74 | +<VirtualHost *:80> |
| 75 | + ServerName pelican |
| 76 | + DocumentRoot /opt/pelican-panel/public |
| 77 | + AllowEncodedSlashes On |
| 78 | + php_value upload_max_filesize 100M |
| 79 | + php_value post_max_size 100M |
| 80 | +
|
| 81 | + <Directory /opt/pelican-panel/public> |
| 82 | + Options Indexes FollowSymLinks |
| 83 | + AllowOverride All |
| 84 | + Require all granted |
| 85 | + </Directory> |
| 86 | +
|
| 87 | + ErrorLog /var/log/apache2/pelican_error.log |
| 88 | + CustomLog /var/log/apache2/pelican_access.log combined |
| 89 | +</VirtualHost> |
| 90 | +EOF |
| 91 | +$STD a2ensite pelican |
| 92 | +$STD a2enmod rewrite |
| 93 | +$STD a2dissite 000-default.conf |
| 94 | +$STD systemctl reload apache2 |
| 95 | +msg_ok "Created Service" |
| 96 | + |
| 97 | +motd_ssh |
| 98 | +customize |
| 99 | + |
| 100 | +msg_info "Cleaning up" |
| 101 | +rm -rf "/opt/pelican-panel/panel.tar.gz" |
| 102 | +$STD apt-get -y autoremove |
| 103 | +$STD apt-get -y autoclean |
| 104 | +msg_ok "Cleaned" |
0 commit comments