Skip to content

Commit 33cd0cb

Browse files
authored
Create New LXC: Wordpress (#1485)
1 parent 325084f commit 33cd0cb

File tree

3 files changed

+164
-0
lines changed

3 files changed

+164
-0
lines changed

ct/wordpress.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/usr/bin/env bash
2+
source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
3+
# Copyright (c) 2021-2025 communtiy-scripts ORG
4+
# Author: MickLesk (Canbiz)
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://wordpress.org/
7+
8+
## App Default Values
9+
APP="Wordpress"
10+
var_tags="blog;cms"
11+
var_disk="5"
12+
var_cpu="2"
13+
var_ram="2048"
14+
var_os="debian"
15+
var_version="12"
16+
17+
# App Output & Base Settings
18+
header_info "$APP"
19+
base_settings
20+
21+
# Core
22+
variables
23+
color
24+
catch_errors
25+
26+
function update_script() {
27+
header_info
28+
check_container_storage
29+
check_container_resources
30+
if [[ ! -d /var/www/html/wordpress ]]; then
31+
msg_error "No ${APP} Installation Found!"
32+
exit
33+
fi
34+
msg_error "Wordpress should be updated via the user interface."
35+
exit
36+
}
37+
38+
start
39+
build_container
40+
description
41+
42+
msg_ok "Completed Successfully!\n"
43+
echo -e "${CREATING}${GN} ${APP} setup has been successfully initialized!${CL}"
44+
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
45+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}/${CL}"

install/wordpress-install.sh

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2021-2025 communtiy-scripts ORG
4+
# Author: MickLesk (Canbiz)
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://wordpress.org/
7+
8+
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
9+
color
10+
verb_ip6
11+
catch_errors
12+
setting_up_container
13+
network_check
14+
update_os
15+
16+
msg_info "Installing Dependencies (Patience)"
17+
$STD apt-get install -y \
18+
curl \
19+
unzip \
20+
sudo \
21+
mc \
22+
apache2 \
23+
php8.2-{bcmath,common,cli,curl,fpm,gd,snmp,imap,mbstring,mysql,xml,zip} \
24+
libapache2-mod-php \
25+
mariadb-server
26+
msg_ok "Installed Dependencies"
27+
28+
msg_info "Setting up Database"
29+
DB_NAME=wordpress_db
30+
DB_USER=wordpress
31+
DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
32+
$STD mysql -u root -e "CREATE DATABASE $DB_NAME;"
33+
$STD mysql -u root -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED BY '$DB_PASS';"
34+
$STD mysql -u root -e "GRANT ALL PRIVILEGES ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH PRIVILEGES;"
35+
{
36+
echo "WordPress Credentials"
37+
echo "Database User: $DB_USER"
38+
echo "Database Password: $DB_PASS"
39+
echo "Database Name: $DB_NAME"
40+
} >> ~/wordpress.creds
41+
msg_ok "Set up Database"
42+
43+
msg_info "Installing Wordpress (Patience)"
44+
cd /var/www/html
45+
wget -q https://wordpress.org/latest.zip
46+
unzip -q latest.zip
47+
chown -R www-data:www-data wordpress/
48+
cd /var/www/html/wordpress
49+
find . -type d -exec chmod 755 {} \;
50+
find . -type f -exec chmod 644 {} \;
51+
mv wp-config-sample.php wp-config.php
52+
sed -i -e "s|^define( 'DB_NAME', '.*' );|define( 'DB_NAME', '$DB_NAME' );|" \
53+
-e "s|^define( 'DB_USER', '.*' );|define( 'DB_USER', '$DB_USER' );|" \
54+
-e "s|^define( 'DB_PASSWORD', '.*' );|define( 'DB_PASSWORD', '$DB_PASS' );|" \
55+
/var/www/html/wordpress/wp-config.php
56+
msg_ok "Installed Wordpress"
57+
58+
msg_info "Setup Services"
59+
cat <<EOF > /etc/apache2/sites-available/wordpress.conf
60+
<VirtualHost *:80>
61+
ServerName yourdomain.com
62+
DocumentRoot /var/www/html/wordpress
63+
64+
<Directory /var/www/html/wordpress>
65+
AllowOverride All
66+
</Directory>
67+
68+
ErrorLog \${APACHE_LOG_DIR}/error.log
69+
CustomLog \${APACHE_LOG_DIR}/access.log combined
70+
71+
</VirtualHost>
72+
EOF
73+
$STD a2ensite wordpress.conf
74+
$STD a2dissite 000-default.conf
75+
systemctl reload apache2
76+
msg_ok "Created Services"
77+
78+
motd_ssh
79+
customize
80+
81+
msg_info "Cleaning up"
82+
rm -rf /var/www/html/latest.zip
83+
$STD apt-get autoremove
84+
$STD apt-get autoclean
85+
msg_ok "Cleaned"

json/wordpress.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"name": "Wordpress",
3+
"slug": "wordpress",
4+
"categories": [
5+
14
6+
],
7+
"date_created": "2025-01-14",
8+
"type": "ct",
9+
"updateable": true,
10+
"privileged": false,
11+
"interface_port": 80,
12+
"documentation": "https://wordpress.org/documentation/",
13+
"website": "https://wordpress.org/",
14+
"logo": "https://s.w.org/style/images/about/WordPress-logotype-simplified.png",
15+
"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.",
16+
"install_methods": [
17+
{
18+
"type": "default",
19+
"script": "ct/wordpress.sh",
20+
"resources": {
21+
"cpu": 2,
22+
"ram": 2048,
23+
"hdd": 5,
24+
"os": "Debian",
25+
"version": "12"
26+
}
27+
}
28+
],
29+
"default_credentials": {
30+
"username": null,
31+
"password": null
32+
},
33+
"notes": []
34+
}

0 commit comments

Comments
 (0)