20. Juli, 2025

WordPress (WP-CLI) auf Infomaniak inkl. Vorlagen

Um WP-CLI auf infomaniak (oder jedem anderen Provider) einfach nutzen zu können, solltest Du es einmalig installieren.

Hier konkret für die PHP Version 8.2 einfach folgende Zeile kopieren und ausführen.
Es werden zusätzlich 3 Konfigurationsdateien (test.sh, dev.sh, vorlage.sh) erstellt.

Dazu geht Du in Dein Webhosting bei infomaniak, per SSH auf die Console und fügst die folgende Zeile ein.

# Muss ggf. für jedes Webhosting gemacht werden.

				
					mkdir -p ~/bin && curl -o ~/bin/wp-cli.sh https://cloudmeister.ch/wp-content/downloads/wp-cli.sh && bash ~/bin/wp-cli.sh
				
			

Um die jeweils gewünschte WordPress-Konfiguration (test, dev, vorlage) auszuführen, gehst Du in die gewünschte Site Deines Webhosting mit

				
					cd /sites/{DeineWebSite}
				
			

Die jeweils gewünschte WordPress-Konfiguration (test, dev, vorlage) Deiner Website, kannst Du dann wie folgt ausführen z. B.

				
					~/vorlage.sh
				
			

Nach Deinen Wünschen anpassen kannst Du sie jeweils mit (im Beispiel von vorlage.sh):

				
					nano ~/vorlage.sh
				
			

Den jeweiligen Quellcode findest Du hier

				
					# Einmalige Installation von WP CLI (pro hosting)
# =================================
# mkdir -p ~/bin && curl -o ~/bin/wp-cli.sh https://cloudmeister.ch/wp-content/downloads/wp-cli.sh && bash ~/bin/wp-cli.sh


clear
echo "WP CLI wird installiert ... $(date)"
echo ""
# Prüfe, ob Dein Verzeichnis ~/bin existiert, und lege es ggf. an
if [ ! -d ~/bin ]; then
  mkdir ~/bin
fi


# Lade WP-CLI runter
curl -o ~/bin/wp-cli.phar https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
curl -o ~/leer.sh https://cloudmeister.ch/wp-content/downloads/leer.sh
curl -o ~/dev.sh https://cloudmeister.ch/wp-content/downloads/dev.sh
curl -o ~/vorlage.sh https://cloudmeister.ch/wp-content/downloads/vorlage.sh
curl -o ~/plugins.sh https://cloudmeister.ch/wp-content/downloads/plugins.sh


# Mache die heruntergeladene WP-CLI ausführbar
chmod +x ~/bin/wp-cli.phar


# Erstelle die Skripts im Home-Verzeichnis ausführbar (falls vorhanden)
chmod +x ~/leer.sh
chmod +x ~/dev.sh
chmod +x ~/vorlage.sh


echo ""
echo ""
echo "Installation abgeschlossen und 3 Dateien erstellt"
echo ""
echo "leer.sh     - zu Testzwecken"
echo "dev.sh      - zum programmieren"
echo "vorlage.sh  - als Vorlage für Kunden"
echo ""
echo ""
echo "# Die jeweilige Datei editieren kannst Du mit z. B.:"
echo "  nano  ~/leer.sh"
echo ""
echo "# strg+x (beenden), y (Yebbs), Enter drücken (zum bestätigen)"
echo "# strg+k (kannst Du eine Zeile löschen)"
echo ""
echo "# Um die .sh-Dateien nutzen zu können, gehe zur gewünschten vorlage zb:"
echo "  cd sites/{deine-domain.ch}/"
echo ""
echo "# und gib dort dann den Namen der Datei (inkl. Pfad) ein z. B.:"
echo "  ~/vorlage.sh"
echo ""
echo ""
echo "Hier die Liste aller Konfigdateien"
ls *.sh
echo ""
echo ""

				
			

Um die WP-CLI zurekt aurufen zu kommen (aus der jeweiligen Site)

				
					cp ~/bin/wp-cli.phar ~/bin/wp
chmod +x ~/bin/wp
ln -s ~/bin/wp-cli.phar /usr/local/bin/wp

				
			
				
					clear
echo "WordPress leer.sh wird installiert"
echo "=================================="
echo ""


# WP-CLI Pfad VAR definieren
WP="/opt/php8.2/bin/php $HOME/bin/wp-cli.phar"
echo ""

# Alle Plugins deaktivieren & löschen
$WP plugin deactivate --all
$WP plugin delete $($WP plugin list --field=name)
$WP theme activate twentytwentyfive && themes=$($WP theme list --field=name --status=inactive) && [ -n "$themes" ] && $WP theme delete $themes
echo ""


# Beispiel-Posts löschen
$WP post delete 1 2 --force
echo ""

# Grundeinstellungen setzen
$WP core update && $WP core update-db
$WP language core update
$WP language plugin update --all
$WP language theme update --all
echo ""

				
			
				
					clear
echo "WordPress dev.sh wird installiert"
echo "================================="
echo ""


# WP-CLI Pfad VAR definieren
WP="/opt/php8.2/bin/php $HOME/bin/wp-cli.phar"
echo ""

# Alle Plugins deaktivieren & löschen
$WP plugin deactivate --all
$WP plugin delete $($WP plugin list --field=name)
$WP theme  delete $(wp  theme  list --field=name --status=inactive)
echo ""


# Beispiel-Posts löschen
$WP post delete 1 2 --force
echo ""


# Plugins installieren (einige direkt aktivieren)
$WP plugin install elementor --activate
$WP plugin install better-search-replace
$WP plugin install query-monitor
$WP plugin install wp-server-stats
$WP plugin install woocommerce
echo ""


# Grundeinstellungen setzen
$WP core update && $WP core update-db
$WP language core update
$WP language plugin update --all
$WP language theme update --all
echo ""

				
			
				
					clear
echo "WordPress vorlage.sh wird installiert"
echo "====================================="
echo ""


# WP-CLI Pfad VAR definieren
WP="/opt/php8.2/bin/php $HOME/bin/wp-cli.phar"
echo ""

# Alle Plugins deaktivieren & löschen
$WP plugin deactivate --all
$WP plugin delete $($WP plugin list --field=name)
$WP theme  delete $(wp  theme  list --field=name --status=inactive)
echo ""


# Beispiel-Posts löschen
$WP post delete 1 2 --force
echo ""


# Plugins installieren (einige direkt aktivieren)
$WP plugin install elementor --activate
$WP plugin install better-search-replace
$WP plugin install fluentform
$WP plugin install fluent-smtp
$WP plugin install gtranslate
$WP plugin install instant-images
$WP plugin install microsoft-clarity
$WP plugin install query-monitor
$WP plugin install wp-seopress
$WP plugin install honeypot --activate
$WP plugin install wp-server-stats
$WP plugin install google-site-kit
$WP plugin install unlimited-elements-for-elementor
$WP plugin install woocommerce
$WP plugin install woo-payrexx-gateway
$WP plugin install wpremote --activate
$WP plugin install wpextended
echo ""


# Grundeinstellungen setzen
$WP core update && $WP core update-db
$WP language core update
$WP language plugin update --all
$WP language theme update --all
echo ""

				
			
				
					clear
echo "WordPress plugins.sh wird installiert"
echo "====================================="
echo ""


# WP-CLI Pfad VAR definieren
WP="/opt/php8.2/bin/php $HOME/bin/wp-cli.phar"
echo ""

# Plugins installieren (einige direkt aktivieren)
$WP plugin install elementor --activate
$WP plugin install better-search-replace
$WP plugin install fluentform
$WP plugin install fluent-smtp
$WP plugin install gtranslate
$WP plugin install instant-images
$WP plugin install microsoft-clarity
$WP plugin install query-monitor
$WP plugin install wp-seopress
$WP plugin install honeypot --activate
$WP plugin install wp-server-stats
$WP plugin install google-site-kit
$WP plugin install unlimited-elements-for-elementor
$WP plugin install woocommerce
$WP plugin install woo-payrexx-gateway
$WP plugin install wpremote --activate
$WP plugin install wpextended
echo ""

				
			
Facebook

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert