Create a directory for the new website (e.g., website1.com):
mkdir website1
Check the owner of the directory, if it’s set to
root, you might want to change it to your username or at leastwww-data. To change the owner fromroottomyusername, type the following:sudo chown -hR myusername:myusername /var/www/html/website1
Go to
website1directory.cd /var/www/html/website1
Download wordpress.
wget https://wordpress.org/latest.tar.gz
or you can target a specific version. For example in this case, the latest version is 6.9.1, then you can download by specific version by typing:
wget https://wordpress.org/wordpress-6.9.1.tar.gz
Extract the file:
tar -zxvf latest.tar.gz
This will extract the files to a sub-directory
wordpresswith the full path/var/www/html/website1/wordpress.
You can then set up wordpress the same way as any other system.
Optional
If you do not want to have wordpress sub-directory, you can copy all files to the parent directory.
sudo cp -r /var/www/html/website1/wordpress/* /var/www/html/website1
We’re copying the content of wordpress directory and -r is to include all sub-directories (recursive).
Use copy instead of move so if you make mistake, you can redo.
After verifying all copied files, then you can delete the files from original directory:
sudo rm -r /var/www/html/website1/wordpress/*
Assumptions:
Web server is installed and the public html directory is in
/var/www.Basic knowledge of
WordPressinstallation and configuration, which is not covered in this post.
