Here, we cover the process of installing WP Multisite via the command line using WP-CLI.
There are many convenient methods to install WordPress, such as Softaculous or WordPress Toolkit, but there are some situations where those options are unavailable, or you may prefer to perform a manual installation.
A database must be created for a WP Multisite, the site files downloaded, and the .htaccess manually updated to support a WP Multisite installation.
Related Articles
Manually Install WordPress Using File Manager
Manually Install WordPress Using Command Line
Install WordPress with Softaculous
SSH into Shared Server
Install WordPress
-
Create a new database for the website
NOTE: Make note of the database name, user, and password, as you will need them to complete the installation. - Access the server via SSH or using the Terminal in cPanel
- Navigate to the domain's document root using the cd command
cd public_html
REPLACE: public_html with your domain's document root if different. - Run the following command to download the WordPress files
wp core download
- Run the following command to add the database details
wp core config --dbhost=localhost --dbname=DBNAME --dbuser=DBUSER --prompt=dbpass
REPLACE: DBNAME with the database name and DBUSER with the database user.
NOTE: When prompted for the database password use the password associated with the database user. - Run the following command to configure the site and admin user
wp core multisite-install --title='TITLE' --admin_user='USER' --admin_email='EMAIL' --url='URL'
REPLACE: TITLE with the site title (e.g. "My Blog" or the name of your business), USER and EMAIL with the desired username and email address for the admin user, and URL with the site URL (e.g. https://domain.com).
TIP: If you wish to set a specific password, add--prompt=admin_password
to be automatically prompted for the password.
NOTE: This will configure a multisite set to use subdirectories (e.g. domain.com/site) by default. To configure a multisite that uses subdomains (e.g. site.domain.com), add--subdomains
to the above command.
EXAMPLE: Subdirectory multisite installation using a randomly generated password
wp core multisite-install --title='Site Title' --admin_user='userna5' --admin_email='user@domain.com' --url='https://domain.com'
EXAMPLE: Subdomain multisite installation using a specified password
wp core multisite-install --title='Site Title' --admin_user='userna5' --admin_email='user@domain.com' --url='https://domain.com' --prompt=admin_password --subdomains
- Run the following commands to create an uploads directory and set its permissions appropriately
cd wp-content
mkdir uploads
chmod 755 uploads/ - Update the site's .htaccess file