Building A Web Server

From ScotGrid

(Difference between revisions)
Revision as of 13:23, 8 Feb 2012
Gareth roy (Talk | contribs)
Re-installing Webserver (e.g. on SVR10)
← Go to previous diff
Revision as of 14:39, 8 Feb 2012
Gareth roy (Talk | contribs)
Step 4: Copy Web Content
Go to next diff →
Line 21: Line 21:
== Step 4: Copy Web Content == == Step 4: Copy Web Content ==
Copy /html from the current backup to the new node. We need to preserve permissions to make sure MediaWiki works correctly. '''There is a smarter way to do this piping tar across ssh so needs to be updated with a better command line'''. Copy /html from the current backup to the new node. We need to preserve permissions to make sure MediaWiki works correctly. '''There is a smarter way to do this piping tar across ssh so needs to be updated with a better command line'''.
- tar zcvf html.tar.gz html/+ cd /tmp
 + tar zcvf html.tar.gz /backup/svr028/20120207/tree/disk/www/html
scp html.tar.gz svr010:/var/www/ scp html.tar.gz svr010:/var/www/
 +
ssh svr010 ssh svr010
cd /var/www/ cd /var/www/

Revision as of 14:39, 8 Feb 2012

Table of contents

Re-installing Webserver (e.g. on SVR10)

Step 0: Add to Cfagent

Alter cfagent.conf to include node in the wwwscotgrid group.

wwwscotgrid = ( svr010 )

Step 1: Re-install the node

You can use the notes provided at: (Re)installing a node, you can also watch it rebuilding using:

tail -f /var/log/httpd/svr001-int-access.log

Step 2: Start the MySQL Daemon

To allow the wiki to function properly we need to prepare the MySQL database so start the DB daemon by using the following command:

service mysqld start

Step 3: Create a MySQL User

A local MySQL user is required to allow MediaWiki to access the imported DB tables, this also needs to be done before the tables can be imported. Use the following commands to create the wikiuser:

  mysql --user=root mysql
  CREATE USER 'wikiuser'@'localhost' IDENTIFIED BY 'W1kiP45s';
  GRANT ALL PRIVILEGES ON *.* TO 'wikiuser'@'localhost' WITH GRANT OPTION;

Step 4: Copy Web Content

Copy /html from the current backup to the new node. We need to preserve permissions to make sure MediaWiki works correctly. There is a smarter way to do this piping tar across ssh so needs to be updated with a better command line.

  cd /tmp
  tar zcvf html.tar.gz /backup/svr028/20120207/tree/disk/www/html   
  scp html.tar.gz svr010:/var/www/
  
  ssh svr010
  cd /var/www/
  tar zxvf html.tar.gz

Step 5: Import DB Tables

Copy the current backup of the Wiki DB and import into MySQL.

  scp /backup/svr028/20120207/tree/disk/backup/sg_wikidb_2012-02-07.sql.gz svr010:/tmp/
   
  cd /tmp
  gunzip sg_wikidb_2012-02-07.sql.gz
  mysql --user=wikiuser --password=W1kiP45s < sg_wikidb_2012-02-07.sql
  You can check by logging into mysql and checking the tables are present.
  mysql --user=wikiuser --password=W1kiP45s wikidb
  mysql> show tables;

Step 6: Fix LocalSettings.php

Verify /var/www/html/wiki/LocalSettings.php if needed change:

  chmod 666 LocalSettings.php
  $IP = "/disk/www/html/wiki"; to 
  $IP = "/var/www/html/wiki";
  chmod 400 LocalSettings.php

Step 7: Start httpd

  service httpd start

Notes:

  • Verify Backup scripts /etc/cron.d
  • Need to fix recover-wiki script on svr001 so it no longer looks for /disk but /var.