Wordpress

How to install wordpress from command line

Pinterest LinkedIn Tumblr

To install WordPress from the command line, you need to have access to a web server that supports PHP and MySQL. Here are the general steps to follow:

  1. Download the latest version of WordPress using the command below:
sudowget https://wordpress.org/latest.tar.gz
  1. Extract the downloaded file using the command below:
sudotar -xvzf latest.tar.gz
  1. Move the extracted files to your web server document root. For example, if you are using Apache web server on Ubuntu, the document root is usually /var/www/html. Use the command below to move the files:
sudo mv wordpress/* /var/www/html/
  1. Create a MySQL database for WordPress using the command below:
mysql -u root -p

This will prompt you for your MySQL root password. Once you are logged in to the MySQL shell, run the following commands:

CREATE DATABASE wordpress;
CREATE USER 'wordpressuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpressuser'@'localhost';
FLUSH PRIVILEGES;
exit;

Replace ‘wordpressuser‘ and ‘password‘ with your desired username and password.

  1. Rename the wp-config-sample.php file to wp-config.php and edit it using a text editor to include your database details. For example:
define('DB_NAME', 'wordpress');
 define('DB_USER', 'wordpressuser');
 define('DB_PASSWORD', 'password');
 define('DB_HOST', 'localhost');
  1. Set the correct permissions for your WordPress installation using the commands below:
 sudo chown -R www-data:www-data /var/www/html/
  sudo chmod -R 755 /var/www/html/
  1. Access your WordPress site using a web browser to complete the installation process.

That’s it! You should now be able to install WordPress from the command line.Regenerate response

Write A Comment