The article Using WordPress on N0C explains how to install and configure a new WordPress site with N0C. However, sometimes it can be advantageous to install a WordPress site in command line. To do this, you need to use the
Installing a WordPress Website
To install a WordPress site on the hosting with the help of
wp-cli, you must first :
- Create a database, a user with a password and authorize the database user with the N0C panel: please refer to the paragraph Create an SQL Database with a New User in the article Databases.
- Logging in with a password: please refer to the paragraph Connecting to your World/HybridCloud Hosting with Microsoft Windows Operating System in the article Creating an SSH Key and Connecting to an Account.
Installation of the Website
The process is explained with the help of an example, where we will install a WordPress website in the
public_htmldirectory of the hosting. In this example, the dummy address of the site that points to this directory is https://mydomain.ca :
# Downloading WordPress wp core download # Production of the configuration file cd ~/public_html wp core config --dbname="database_wp" --dbuser="user_wp" --dbprefix="mywp_" --dbpass="pass_database" # Launching the installation wp core install --url="https://mydomain.ca" --title="Site WordPress" --admin_user="adminname" --admin_password="mypassword" --admin_email="firstname.lastname@example.org" # Change of link structure to keep the article name only wp rewrite structure '/%nameofpost%'
- database_wp: database name.
- user_wp: database username.
- mywp_: the prefix.
- pass_database: password to access to the database.
- Site WordPress: name of the site.
- adminname: name of the administrator.
- mypassword: password of the administrator.
- email@example.com: e-mail of the administrator.
- nameofpost: post name.
By default, the language of WordPress is English. However, should you need to define another language, you would have to enter the following command (in this exemple, French is chosen):
# Changing the WordPress language for French wp core language list wp core language install --activate fr_FR
Installation of a Theme
A new custom theme available in the WordPress theme repository can be installed. The command also allows you to specify a link to the zip archive of a theme or an HTTPS address to a themes zip file.
# Display the list of themes that can be found in the installation wp theme list # Installation of a new theme (generatepress) # https://wordpress.org/themes/generatepress/ wp theme install generatepress # Activation of the theme wp theme activate generatepress
Installation of a Plug-In
To install a plug-in, you just have to give the name of the plug-in and the command will automatically fetch it from the WordPress repositories. The command also allows you to indicate a path to a zip file of an extension or an HTTPS address to a zip file of plug-ins.
# Display of the list of detected plug-ins wp plugin list # Installation of the classic-editor plug-in wp plugin install classic-editor # Activation of the plug-in wp plugin activate classic-editor
The wp-cli tool allows you to manage updates for WordPress, themes and plug-ins. However, each module must be updated individually using the
# Check to see if updates are available wp core check-update # WordPress core update wp core update # Database update wp core update-db # Check to see if extension updates are available wp plugin update --all --dry-run # Update all plug-ins wp plugin update --all # Check to see if themes updates are available wp theme update --all --dry-run # Update all themes wp theme update --all
References About wp-cli Commands
The basic wp-cli commands are available via this link: https://developer.wordpress.org/cli/commands/.