GNU/Linux >> Linux Esercitazione >  >> Panels >> Panels

Script:Installa WordPress su un VPS Debian/Ubuntu

In precedenza abbiamo spiegato come installare WordPress su un VPS Debian. Inoltre puoi installare WordPress su Debian o Ubuntu VPS in modo più semplice, utilizzando lo script fornito in questo articolo. Questo script creerà un database MySQL, scaricherà e configurerà l'ultima versione di WordPress e creerà automaticamente un host virtuale Apache. Tutto quello che devi fare è creare un file sul tuo VPS WordPress con il contenuto mostrato di seguito, rendere il file eseguibile, eseguirlo e inserire alcuni parametri.

Crea un nuovo file e incolla lo script:

# nano wpinstall
#!/bin/bash
#
# Install WordPress on a Debian/Ubuntu VPS
#

# Create MySQL database
read -p "Enter your MySQL root password: " rootpass
read -p "Database name: " dbname
read -p "Database username: " dbuser
read -p "Enter a password for user $dbuser: " userpass
echo "CREATE DATABASE $dbname;" | mysql -u root -p$rootpass
echo "CREATE USER '$dbuser'@'localhost' IDENTIFIED BY '$userpass';" | mysql -u root -p$rootpass
echo "GRANT ALL PRIVILEGES ON $dbname.* TO '$dbuser'@'localhost';" | mysql -u root -p$rootpass
echo "FLUSH PRIVILEGES;" | mysql -u root -p$rootpass
echo "New MySQL database is successfully created"

# Download, unpack and configure WordPress
read -r -p "Enter your WordPress URL? [e.g. mywebsite.com]: " wpURL
wget -q -O - "http://wordpress.org/latest.tar.gz" | tar -xzf - -C /var/www --transform s/wordpress/$wpURL/
chown www-data: -R /var/www/$wpURL && cd /var/www/$wpURL
cp wp-config-sample.php wp-config.php
chmod 640 wp-config.php
mkdir uploads
sed -i "s/database_name_here/$dbname/;s/username_here/$dbuser/;s/password_here/$userpass/" wp-config.php

# Create Apache virtual host
echo "
ServerName $wpURL
ServerAlias www.$wpURL
DocumentRoot /var/www/$wpURL
DirectoryIndex index.php

Options FollowSymLinks
AllowOverride All

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
" > /etc/apache2/sites-available/$wpURL

# Enable the site
a2ensite $wpURL
service apache2 restart

# Output
WPVER=$(grep "wp_version = " /var/www/$wpURL/wp-includes/version.php |awk -F\' '{print $2}')
echo -e "\nWordPress version $WPVER is successfully installed!"
echo -en "\aPlease go to http://$wpURL and finish the installation\n"

Rendi eseguibile lo script:

# chmod +x wpinstall

Esegui lo script:

# ./wpinstall

Per gli aggiornamenti, puoi anche leggere il nostro post su Come installare WordPress con Nginx su Debian 10.


Panels
  1. Script:installa ownCloud su un VPS Ubuntu 12.04

  2. Installa Wallabag su Ubuntu 12.04 LTS VPS

  3. Come installare eGroupware su un VPS Ubuntu 14.04

  4. Installa MDwiki su un VPS Ubuntu 14.04

  5. Installa VTiger CRM su un VPS Ubuntu 14.04

Come installare WordPress su Ubuntu 18.04

Installa Lychee su un VPS Ubuntu

Installa Question2Answer su un VPS Ubuntu 14.04

Installa VTEDDY su un VPS Ubuntu 14.04

Come installare il plug-in WooCommerce su un VPS Ubuntu 16.04

Installa WordPress su Debian VPS