First update your system packages :
apt-get update -y && apt-get upgrade -y
Now install wget :
apt-get install wget -y
Download latest version of wordpress :
wget http://wordpress.org/latest.tar.gz
Now extract wordpress tar file :
tar xzvf latest.tar.gz
Create multiple user & databse for each user :
mysql -u root -p (if need install mysql or mariadb)
CREATE DATABASE Database1;
CREATE DATABASE Database2;
CREATE USER User1@localhost;
CREATE USER User2@localhost;
Set password for each user :
SET PASSWORD FOR User1@localhost=PASSWORD("Password1");
SET PASSWORD FOR User2@localhost= PASSWORD("Password2");
Now grant all privileges to all users ot database :
GRANT ALL PRIVILEGES ON Database1.* TO User@localhost IDENTIFIED BY 'Password1';
GRANT ALL PRIVILEGES ON Database2.* TO User2@localhost IDENTIFIED BY 'Password2';
Now flush the privilages to work all user with database properly & exit from mysql mode :
FLUSH PRIVILEGES;
exit
Now go to www directory & create your sites directory :
cd /var/www
mkdir Site1
mkdir Site2
Copy wp-config-sample.php file to wp-config.php :
cp ~/wordpress/wp-config-sample.php ~/wordpress/wp-config.php
Now sync wordpress files to your sites :
rsync -avP ~/wordpress/ /var/www/Site1/
rsync -avP ~/wordpress/ /var/www/Site2/
Change file ownership of www-data :
sudo chown www-data:www-data * -R
Now go to your site1 directory & edit wp-config.php file :
cd /var/www/Site1
sudo nano wp-config.php
Change the database & user name as you created :
define('DB_NAME', 'Database1');
define('DB_USER', 'User1');
define('DB_PASSWORD', 'Password1');
Save and exit. (repeat for other sites)
Now go to sites-available directory :
cd /etc/httpd/sites-available
Copy default file content to Site1 file :
cp default Site1
Edit your Site1 file :
nano Site1
Add the virtualhost block to Site1 file :
<VirtualHost *:80>
ServerAdmin your_email_address
ServerName site1.com
ServerAlias www.site1.com
DocumentRoot /var/www/Site1
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/Site1>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
</VirtualHost>
Now install php to execute php files :
apt-get install php5-gd -y (install php version as you choose)
Enable your Site1 :
a2ensite Site1 (repeat for other sites)
You must need to restart http service to work all configuration :
systemctl restart httpd
Browse your sites now.
Thank you for reading this article.