Assuming that you already have wordpress running and you want to run more than one instance on your system, you need to do the following:
Download the latest version of wordpress <em>wordpress-2.5.1.zip </em>and unzip it into a temporary directory.
I am using /var/www as my first rootdoc and will be using /var/www1 and /var/www2 as my other 2 wordpress rootdoc locations.
<em>mv wordpress-2.5.1.zip /tmp</em>
<em>unzip wordpress-2.5.1.zip</em>
<em>cd wordpress</em>
<em>cp -r * /var/www1</em>
<em>cp -r * /var/www2</em>
So far we have extracted the zip file in the /tmp directory. We then went in /tmp and recursively copied it into the new areas where the new wordpress blogs will live.
cp /var/www/wp-config.php /var/www1
cp /var/www/wp-config.php /var/www2
We want to use the same wp-config.php file since we want to use the same mysql database, but we want to use DIFFERENT TABLES.
This is the wp-config.php file. Note the <em><strong>’wp_’ </strong></em>variable below. This is what the mysql database uses to name the tables. I used <em><strong>’wpdb1_’ </strong></em>and ‘<em><strong>wpdb2_’</strong></em> for my other wordpress installations.
Now edit the /etc/hosts file
192.168.1.2 blaster blaster.nethopper.com<em><strong> blogger.blogme.com dog.doggone.com</strong></em>
127.0.0.1 localhost
You obviously need to contact a registrar and purchase your domain names. Cheap. About $7 per year. Now my hostname is blaster and my first blog was at blaster.nethopper.com. I want to add blogger.blogme.com and dog.doggone.com. Both new wordpress blogs to run on my linux host. These names must be in the /etc/hosts file.
<em><?php^M
// ** MySQL settings ** //^M
define(’DB_NAME’, ‘wordpress’); // The name of the database^M
define(’DB_USER’, ‘wordpress_user’); // Your MySQL username^M
define(’DB_PASSWORD’, ‘gogetyourownpasswd’); // …and password^M
define(’DB_HOST’, ‘localhost’); // 99% chance you won’t need to change this value^M
define(’DB_CHARSET’, ‘utf8′);^M
define(’DB_COLLATE’, ”);^M
^M
// You can have multiple installations in one database if you give each a unique prefix^M
$table_prefix = <strong>’wp_’;</strong> // Only numbers, letters, and underscores please!^M
^M
// Change this to localize WordPress. A corresponding MO file for the^M
// chosen language must be installed to wp-content/languages.^M
// For example, install de.mo to wp-content/languages and set WPLANG to ‘de’^M
// to enable German language support.^M
define (’WPLANG’, ”);^M
^M
/* That’s all, stop editing! Happy blogging. */^M</em>
The wordpress files are in order, our mysql database is ready. Apache needs some work.
look in the /etc/apache2/sites-available directory and edit the remove the default file and replace it with the names of the domains that you want to blog on. In my case, there are 3 files called.
blaster.nethopper.com<em><strong> </strong></em>blogger.blogme.com dog.doggone.com
Here is the contents of blaster.nethopper.com. Make the other 2 look like this one with the obvious changes. I will bold them.
<blockquote>root@blaster:/etc/apache2/sites-available# cat blaster.nethopper.com
<em>NameVirtualHost 192.168.1.2 <strong> <–Your IP from your router. Will be the same IP for all.</strong>
<VirtualHost <strong>blaster.nethopper.com</strong>> <strong><– Put the domain that will answer on the above IP</strong>
ServerAdmin webmaster@localhost
ServerName <strong>blaster.nethopper.com</strong>
DocumentRoot /var/www/ <strong><– Change accordingly /var/www1 and /var/www2</strong>
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
# This directive allows us to have apache2’s default start page
# in /apache2-default/, but still have / go to the right place
#RedirectMatch ^/$ /apache2-default/
</Directory></em>
<em>ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory “/usr/lib/cgi-bin”>
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory></em>
<em>ErrorLog /var/log/apache2/error.log</em>
<em># Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn</em>
<em>CustomLog /var/log/apache2/access.log combined
ServerSignature On</em>
<em>Alias /doc/ “/usr/share/doc/”
<Directory “/usr/share/doc/”>
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory></em>
<em></VirtualHost></em></blockquote>
Once you have all three files done, link them to the sites-enabled directroy.
<em>cd /etc/apache2/sites-enabled</em>
<em>ln -s /etc/apache2/sites-available/blaster.nethopper.com .</em>
<em>ln -s /etc/apache2/sites-available/blogger.blogme.com .</em>
<em>ln -s /etc/apache2/sites-available/dog.doggone.com .</em>
Now restart Apache
<em>/etc/init.d/apache2 stop; /etc/init.d/apache2 start</em>
Open a browser and enter: <em>http://blogger.blogme.com/wp-admin/install.php</em>
Then do the same for: <em>http://dog.doggone.com/wp-admin/install.php</em>
You are done.
If you are curious to see what your mysql wordpress database looks like. Take a look. You can see that the variable we changed in the wp-config.php file is the beginning of each table entry.
<em>root@blaster:~# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 25628
Server version: 5.0.45-Debian_1ubuntu3.3-log Debian etch distribution</em>
<em>Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.</em>
<em>mysql> use wordpress
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A</em>
<em>Database changed
mysql> show tables;
+————————–+
| Tables_in_wordpress |
+————————–+
| wp_comments |
| wp_links |
| wp_options |
| wp_postmeta |
| wp_posts |
| wp_term_relationships |
| wp_term_taxonomy |
| wp_terms |
| wp_usermeta |
| wp_users |
| wpdb2_comments |
| wpdb2_links |
| wpdb2_options |
| wpdb2_postmeta |
| wpdb2_posts |
| wpdb2_term_relationships |
| wpdb2_term_taxonomy |
| wpdb2_terms |
| wpdb2_usermeta |
| wpdb2_users |
| wpdb3_comments |
| wpdb3_links |
| wpdb3_options |
| wpdb3_postmeta |
| wpdb3_posts |
| wpdb3_term_relationships |
| wpdb3_term_taxonomy |
| wpdb3_terms |
| wpdb3_usermeta |
| wpdb3_users |
+————————–+
30 rows in set (0.00 sec)</em>
<em>mysql> </em>