How to install Wordpress on Linux Mint

kejs
  9 years ago
  6

The following tutorial walks you through the process of installing Wordpress on Linux Mint and configuring Apache for SEO URL's - required if you want your site to rank well on Google and other major search engines (SEO stands for Search Engine Optimisation). 

Linux Mint Wordpress install

To install Wordpress on Linux Mint you would enter the following: 

apt-get update && apt-get upgrade

apt-get install wordpress
 
apt-get update && apt-get upgrade
apt-get install wordpres

Open the default htaccess file: 

 
 
vim /etc/wordpress/htaccess
 
 
vim /etc/wordpress/htaccess
vim /etc/wordpress/htaccess

Add the following lines if they do not already exist: 

RewriteEngine On

RewriteBase /

RewriteCond %{HTTP_HOST} ^www\.(.+) [NC]

RewriteRule ^.*$ http://%1%{REQUEST_URI} [QSA,R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /index.php [L]
Create Apache config file: 

 vim /etc/apache2/sites-available/your-blog.com
Add the following Apache Vhost config: 
 <VirtualHost 192.168.1.2:80>
ServerName your-blog.com
ServerAdmin me@your-blog.com
DocumentRoot /var/www/your-blog.com
DirectoryIndex index.php
<Directory /var/www/your-blog.com/>
  AllowOverride All
  Order Deny,Allow
  Allow from all
</Directory>
</VirtualHost>
Save the file and create the following new one: 
 vim /etc/apache2/sites-available/your-blog.com
Add the following to the second Apache Vhost: 
 
  Add the following Apache Vhost config: 

<VirtualHost 192.168.1.2:80>
 ServerName www.your-blog.com

ServerAdmin me@your-blog.com

DocumentRoot /var/www/www.your-blog.com

DirectoryIndex index.php

<Directory /var/www/www.your-blog.com/>

  AllowOverride All

  Order Deny,Allow

  Allow from all

</Directory>

</VirtualHost>

Create a sym link to your new site: 
 
 
cd /var/www/
ln -s /usr/share/wordpress your-blog.com
  cd /var/www/

ln -s /usr/share/wordpress your-blog.com
Enable your new sites and restart Apache: 
 
  a2ensite www.your-blog.com

a2ensite your-blog.com

/etc/init.d/apache2 restart
Next run:
 
/usr/share/doc/wordpress/examples/setup-mysql -n example example.com

If you get a permissions error that looks like:

/usr/share/doc/wordpress/examples/setup-mysql: Permission denied

You can fix this by doing the following:

chmod 700 /usr/share/doc/wordpress/examples/setup-mysql

Then re run the command again, this should then work! 

Enable Wordpress Permalinks (SEO URL's)

When you enable Wordpress Permalinks for nice url's you have to update the .htaccess file manually, by adding the following code to it:

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

You will probably notice that your Permalinks still 404 even after you have updated your .htaccess file, to fix this you need to enable Mod_Rewrite in Apache.

Enable Linux Mint mod rewrite

To enable mod_rewrite enter the following as root:

a2enmod rewrite

Restart Apache on Linux Mint

You will also need to restart Apache on Linux Mint:

/etc/init.d/apache2 resert

That's it any problems or questions please post a comment. 

Comments
tekola 3 years ago

First 2 command require "sudo " in front. 3rd command "vim" not recognized.


jahid_0903014 6 years ago

thanks...