From wiki
Revision as of 23:19, 18 October 2013 by Administrator (talk | contribs) (Created page with "==DNS== At this point I got a domain name from and pointed it to this IP. > My Account > Manage Domains > Modify Domain > All Host Records hostname: @ ip ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


At this point I got a domain name from and pointed it to this IP. > My Account > Manage Domains > Modify Domain > All Host Records

 hostname: @
 ip address/url: 
 record type: A (Address)
 hostname: www
 ip address/url:
 record type: CNAME (Alias)

In DNS an A record maps a hostname (eg to an IP

a CNAME record maps one hostname (eg to another hostname (eg

this means that going to the address has the same effect as going to

Setting it up

Software: MediaWiki, Wordpress

This installs everything I used

 sudo apt-get install apache2 php5 mysql-server php5-mysql
 apache2 - web server
 php5 - server-side scripting language
 mysql-server - database server
 php5-mysql - allows php scripts to connect to mysql database

you will be prompted to enter a mysql root password, note this down as this will be used later

after install must reload apache (important: things didn't work correctly because I didn't do this).

 sudo /etc/init.d/apache2 reload

then to test php works correctly go into the web directory

 cd /var/www
 sudo echo "<?php phpinfo(); ?>" > /var/www/info.php

and view this file here: (I've taken it down already).

Installing MediaWiki

now to clear everything in the web directory, download and extract mediawiki Grab the latest download link from

 cd /var/www
 sudo su
 rm index.*
 tar zxvf mediawiki-1.21.1.tar.gz
 mv mediawiki-1.21.1/* ./
 rm -r mediawiki-1.21.1/

webbrowser go to follow the instructions

>Could not find GD library or ImageMagick.

 sudo apt-get install imagemagick

now you download your LocalSettings.php open it and copy everything paste the contents of your LocalSettings.php file in to a new file on your vim LocalSettings.php (while in /var/www) vim is a command line based editor, type i to go into insert mode, paste (using your shortcut keys), type :wq! to save and quit after finished tried to go to I decided to allow image and file uploads

 >File uploads potentially expose your server to security risks. For more information, read the security section in the manual.
 >To enable file uploads, change the mode on the images subdirectory under MediaWiki's root directory so that the web server can write to it. Then enable this option.
 chmod -R 777 images/

MediaWiki installed, now Wordpress

things to note

  • unix permissions
  • vim

Lock Down Mediawiki

Add to LocalSettings.php

 # Prevent new user registrations except by sysops
 $wgGroupPermissions['*']['createaccount'] = false;
 # Disable anonymous editing
 $wgGroupPermissions['*']['edit'] = false; $wgShowIPinHeader = false; $wgDisableCounters = true;

Installing WordPress

make a blog dir mkdir /var/www/blog cd /var/www/blog grab the latest Wordpress here: download extract move so the wordpress files are in blog folder go to and follow instructions Then I ran into a database error. Namely, I had to create a database called 'wordpress'

 $mysql -u root -p
 Enter password:
 >create database wordpress;

sub domain

vim /etc/apache2/sites-available/

  1. With the following content (modify it according to your needs)
 <VirtualHost *:80>
         DocumentRoot /var/www/
         <Directory /var/www/>
                 AllowOverride All

         <Location />
                 Order Allow,Deny
         Allow from All

  1. 6 Enable the vhost


then continue with the webpage form. entering mysql user=root and password that was created before. Got an error: Sorry, but I can't write the wp-config.php file. You can create the wp-config.php manually and paste the following text into it. So copy everything vim wp-config.php i for insert mode and paste it in The "Run the install" should all work, login and now you're in wp-admin

things to note

  • mysql and commands

Change the permalink structure

 Settings > Permalinks
 Custom Structure: /%year%/%postname%/

Save it and it shows a complaint that my .htaccess isn't writeable. to fix do

 cd /var/www/blog (where wordpress is installed)
 touch .htaccess
 chmod -v 666 .htaccess

Try saving it again. Go to the home page and click on the Hello World entry. You'll get a Not Found error.

things to note

  • .htaccess

I had so much problems with this until I figured out how to fix it. Basically the idea is that some urls, for example:, do not correspond to a physical directory on the server (ie. there is a folder called blog at /var/www/blog but there isn't a /var/www/blog/2012 or /var/www/blog/2012/hello-world). What is means is that the webserver must rewrite a url like to become so that even though the users visited the first link, the actual content comes from the second. This is done in apache by using mod_rewrite. Enabling mod_rewrite assuming apache2 installed do

 $a2enmod rewrite

then edit

 # cat /etc/apache2/sites-available/
 <VirtualHost *:80>
         DocumentRoot /var/www/
         <Directory /var/www/>
                 AllowOverride All
         <Location />
                 Options Indexes FollowSymLinks MultiViews
 # cat /etc/apache2/sites-available/
 <VirtualHost *:80>
         DocumentRoot /var/www/
         <Directory /var/www/>
                 AllowOverride All
         <Location />
                 Order Allow,Deny
                 Allow from All

then restart apache2 so that it reloads from the config file

 service apache2 restart

things to note

  • apache2 modules (mod_rewrite)
  • apache virtual hosts

wordpress upgrades and updates

 chmod -R 777 wp-content

no ftp needed


apache rewriteengine mod

/var/www/ cat .htaccess 
RewriteEngine on
RewriteRule (.*)$1 [R=301,L]



SSH key setup

 ssh-keygen -t rsa
 cat .ssh/ | ssh b@B 'cat >> .ssh/authorized_keys'

Put the public key in .ssh/authorized_keys2

Change the permissions of .ssh to 700

Change the permissions of .ssh/authorized_keys2 to 640

sudo chmod 755 ~/.ssh

sudo chmod 644 ~/.ssh/known_hosts

sudo chmod 600 ~/.ssh/id_rsa

sudo chmod 600 ~/.ssh/

Permissions 0744 for '/home/geek/.ssh/id_rsa' are too open.

For multiple keys and hosts


Host myshortname
IdentityFile ~/.ssh/realname_rsa # private key for realname

Host myother
IdentityFile ~/.ssh/realname2_rsa

Web server Permissions

find what apache is running as (usually www-data)

 ps aux | grep apache
 find /var/www/ -type d -print0 | xargs -0 chmod 755
 find /var/www/ -type f -print0 | xargs -0 chmod 644

webserver: www-data

 chown www-data:www-data -R /var/www/

this would make just your wp-content directory writable by the webserver. You will have to change those names/webroots to your situation. This should push you in the right direction.