Wiki How To

From Jeff's Weather Service ~ Wiki Page
Jump to: navigation, search

How do I install MediaWiki?

MediaWiki Install links

To install MediaWiki

  • Install required software for mediawiki
# yum install -y httpd mysql-server php php-pear php-xml php-mysql php-intl php-pecl-apc php-gd php-mbstring ImageMagick-perl
  • Install mediawiki
# yum install mediawiki

Setup Apache Webserver

  • Enable and start httpd.service
# systemctl enable httpd.service
# systemctl start httpd.service
  • Fix SELinux
# firewall-cmd --set-default-zone=public
# firewall-cmd --permanent --zone=public --add-service=http
# firewall-cmd --permanent --zone=public --add-service=https
# firewall-cmd --reload

Setup mysql/mariadb database:

  • Turn on mysql/mariadb first
# systemctl enable mariadb.service
# systemctl start mariadb.service
  • Install mysql secure installation
# mysql_secure_installation
Enter current password for root (enter for none): ENTER
Set root password? [Y/n]: Y
New Password: rootpasswd
Re-enter new password: rootpasswd
Remove anonymous users? [Y/n]: Y
Disallow root login remotely? [Y/n]: Y
Remove test database and access to it? [Y/n]: Y
Reload privilege tables now? [Y/n]: Y

  • Create wikiuser
# mysql -user root -pass
mysql> CREATE USER 'wikiuser'@'localhost' IDENTIFIED BY 'pass';
mysql> GRANT ALL PRIVILEGES ON * . * TO 'wikiuser'@'localhost';
mysql> FLUSH PRIVILEGES;
mysql> quit
  • Then, go to following website to following the instructions to install the

wiki page:

http://localhost/wiki/

Fix SELinux issue

# restorecon -FR /path/to/wiki/

MISC Problems

  • Problems starting mysql:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'

# chown mysql:mysql /var/log/mariadb -chR
# systemctl restart mariadb.service && sudo systemctl status mariadb.service

SELinux preventing mysqld access

# grep mysqld /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

How do I uninstall Mediawiki?

MediaWiki Uninstall link

Steps:

# rm -rf /var/www/mediawiki
# mysql -u root -p pass
mysql> DROP DATABASE wikidb;

WikiMedia Reference Card

http://upload.wikimedia.org/wikipedia/meta/6/66/MediaWikiRefCard.pdf

MediaWiki Formatting

http://www.mediawiki.org/wiki/Help:Formatting

Degree symbol in wiki

  • Make sure the Num is ON.
  • Press and hold ALT (on some keyboards this will work only with the left alt) while typing 0176 on the numeric keypad. This will only work when using the numeric keypad.

Mediawiki Help with Tables

http://en.wikipedia.org/wiki/Help:Table

How do I create a new page in wiki?

 1.) In the search box, type the name of the new page you wish to create.
 2.) Click on "Go".
 3.) Then, click on "create this page". 


How do I link a page to a category?

(for example, linking this page to Wiki Help):

  Add this line to the end of the page that you have added or modified:
     [[Category:Wiki Help]]


How do I link to multiple categories?

  Add multiple Category lines:
     [[Category:Wiki Help]]
     [[Category:CSR]]


How do find pages that are Uncategorized?

  1.) Click on Special Pages.
  2.) Then, click on Uncategorized pagess.
  3.) If you can, add a category that makes sense to that page.


How do I modify the sidebar menu?

  Go to to the following page and hit edit:
     http://jeffsweatherservice.com/wiki/index.php/MediaWiki:Sidebar



How do I ignore wiki code within wiki?

(for example, like add a comment into wiki):

  Two ways:
     1.) Use the "Ignore wiki formatting" button above.
     2.) Use: <nowiki>comment</nowiki>


How do I upload files?

  1.) Click on Upload file.
  2.) Only Upload files listed as permitted file types.


How do I upload multiple files?

  1.) Login to Wiki   
  2.) Enter User: & Enter Pass:
  3.) Make new directory in /home/wsi/
      mkdir New_Category
  4.) Use SFTP to push files to that directory.
  5.) From /home/wsi type:
      find New_Category -type f |wiki_import.sh  -s 'New_Category' --footer


How do I create a new skin for MediaWiki?

Manual:Skinning - MediaWiki

How do I modify the Jws skin for MediaWiki?

Modify the file: skins/jws/main.css

OR

Skin tweaking: http://jeffsweatherservice.com/wiki/index.php/MediaWiki:Jws.css

How do I add a banner to the top of the Jws skin for MediaWiki?

1. Upload the banner to your wiki.
2. Open in your wiki MediaWiki:Sitenotice.
3. Insert: File:Banner.gif

How do I backup Wiki?

Quick and painless way to copy/migrate mysql database:

Tar up the following directory

tar zcvf mysql.tar.gz /var/lib/mysql 

Stop mysql

service mysql stop

Restore backup

cd /
rsync -avr /var/lib/mysql /var/lib/mysql_rpmorig
tar zxvf mysql.tar.gz /var/lib/mysql
chown -R mysql:mysql /var/lib/mysql

Config File for mysql database

/etc/my.cnf

This the manual way to backup the wiki database:

/usr/bin/mysqldump --skip-opt --add-locks -u $USER --password=$PASSWORD \ 
$DATABASE -c | /bin/nice -n 19 /bin/gzip -9 > $BACKUPDIR/$DATABASE.sql.gz

Use this backup command line to preserve character set:

/usr/bin/mysqldump --skip-opt --add-locks -u $USER --password=$PASSWORD \
--default-character-set=$CHARSET $DATABASE -c | \ 
/bin/nice -n 19 /bin/gzip -9 > $BACKUPDIR/$DATABASE-$CHARSET.sql.gz

Backup Wiki to XML doc:

php $WIKIDIR/maintenance/dumpBackup.php --current --output=gzip:$BACKUPDIR/$DATABASE.xml.gz

Variables used:

$USER = MYSQL username

$PASSWORD = MYSQL password

$DATABASE = MYSQL database name (In this case: wikidb)

$BACKUPDIR = Backup directory where you wish to store the wiki backup.

$CHARSET = latin1

How do I restore Wiki?

First, install mediawiki, mysql, mysql-server, etc.

yum install mediawiki mediawiki-math mysql mysql-server LabPlot

Then, assign the root password for mysql:

mysqladmin -u root password NEWPASSWORD

Click here for more information:

http://www.cyberciti.biz/faq/mysql-change-root-password

To restore wiki using mysql command lines:

gunzip $BACKUPDIR/$DATABASE.sql.gz
mysql -u wikiuser -p
mysql> use wikidb;
mysql> mysql > $BACKUPDIR/$DATABASE.sql


Fixing Wiki errors, after importing:

If receiving these errors "cannot be null" try the following:

mysql -u wikiuser -p
mysql> use wikidb;
mysql> ALTER TABLE jws_text MODIFY COLUMN old_id int(10) UNSIGNED NOT NULL

AUTO_INCREMENT;

mysql> ALTER TABLE jws_revision MODIFY COLUMN rev_id(10) UNSIGNED NOT NULL

AUTO_INCREMENT;

mysql> ALTER TABLE jws_recentchanges MODIFY COLUMN rc_id int(10) UNSIGNED NOT

NULL AUTO_INCREMENT;

mysql> quit

Bye