Create New LXC: Proxmox

This commit is contained in:
CanbiZ 2025-01-14 18:20:04 +01:00
parent 325084f8ca
commit 99a0923998
3 changed files with 164 additions and 0 deletions

45
ct/wordpress.sh Normal file
View File

@ -0,0 +1,45 @@
#!/usr/bin/env bash
source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
# Copyright (c) 2021-2025 communtiy-scripts ORG
# Author: MickLesk (Canbiz)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://wordpress.org/
## App Default Values
APP="Wordpress"
var_tags="blog;cms"
var_disk="5"
var_cpu="2"
var_ram="2048"
var_os="debian"
var_version="12"
# App Output & Base Settings
header_info "$APP"
base_settings
# Core
variables
color
catch_errors
function update_script() {
header_info
check_container_storage
check_container_resources
if [[ ! -d /var/www/html/wordpress ]]; then
msg_error "No ${APP} Installation Found!"
exit
fi
msg_error "Wordpress should be updated via the user interface."
exit
}
start
build_container
description
msg_ok "Completed Successfully!\n"
echo -e "${CREATING}${GN} ${APP} setup has been successfully initialized!${CL}"
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}/${CL}"

View File

@ -0,0 +1,85 @@
#!/usr/bin/env bash
# Copyright (c) 2021-2025 communtiy-scripts ORG
# Author: MickLesk (Canbiz)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://wordpress.org/
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
msg_info "Installing Dependencies (Patience)"
$STD apt-get install -y \
curl \
unzip \
sudo \
mc \
apache2 \
php8.2-{bcmath,common,cli,curl,fpm,gd,snmp,imap,mbstring,mysql,xml,zip} \
libapache2-mod-php \
mariadb-server
msg_ok "Installed Dependencies"
msg_info "Setting up Database"
DB_NAME=wordpress_db
DB_USER=wordpress
DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
$STD mysql -u root -e "CREATE DATABASE $DB_NAME;"
$STD mysql -u root -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED BY '$DB_PASS';"
$STD mysql -u root -e "GRANT ALL PRIVILEGES ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH PRIVILEGES;"
{
echo "WordPress Credentials"
echo "Database User: $DB_USER"
echo "Database Password: $DB_PASS"
echo "Database Name: $DB_NAME"
} >> ~/wordpress.creds
msg_ok "Set up Database"
msg_info "Installing Wordpress (Patience)"
cd /var/www/html
wget -q https://wordpress.org/latest.zip
unzip -q latest.zip
chown -R www-data:www-data wordpress/
cd /var/www/html/wordpress
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;
mv wp-config-sample.php wp-config.php
sed -i -e "s|^define( 'DB_NAME', '.*' );|define( 'DB_NAME', '$DB_NAME' );|" \
-e "s|^define( 'DB_USER', '.*' );|define( 'DB_USER', '$DB_USER' );|" \
-e "s|^define( 'DB_PASSWORD', '.*' );|define( 'DB_PASSWORD', '$DB_PASS' );|" \
/var/www/html/wordpress/wp-config.php
msg_ok "Installed Wordpress"
msg_info "Setup Services"
cat <<EOF > /etc/apache2/sites-available/wordpress.conf
<VirtualHost *:80>
ServerName yourdomain.com
DocumentRoot /var/www/html/wordpress
<Directory /var/www/html/wordpress>
AllowOverride All
</Directory>
ErrorLog \${APACHE_LOG_DIR}/error.log
CustomLog \${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
EOF
$STD a2ensite wordpress.conf
$STD a2dissite 000-default.conf
systemctl reload apache2
msg_ok "Created Services"
motd_ssh
customize
msg_info "Cleaning up"
rm -rf /var/www/html/latest.zip
$STD apt-get autoremove
$STD apt-get autoclean
msg_ok "Cleaned"

34
json/wordpress.json Normal file
View File

@ -0,0 +1,34 @@
{
"name": "Wordpress",
"slug": "wordpress",
"categories": [
14
],
"date_created": "2025-01-14",
"type": "ct",
"updateable": true,
"privileged": false,
"interface_port": 80,
"documentation": "https://wordpress.org/documentation/",
"website": "https://wordpress.org/",
"logo": "https://s.w.org/style/images/about/WordPress-logotype-simplified.png",
"description": "WordPress is the simplest, most popular way to create your own website or blog. In fact, WordPress powers over 43.6% of all the websites on the Internet. Yes more than one in four websites that you visit are likely powered by WordPress.\n\nOn a slightly more technical level, WordPress is an open-source content management system licensed under GPLv2, which means that anyone can use or modify the WordPress software for free.",
"install_methods": [
{
"type": "default",
"script": "ct/wordpress.sh",
"resources": {
"cpu": 2,
"ram": 2048,
"hdd": 5,
"os": "Debian",
"version": "12"
}
}
],
"default_credentials": {
"username": null,
"password": null
},
"notes": []
}