Installing Mediawiki on a Raspberry PI3

We’ve all been there, and by all I mean ‘Technicians’, and ‘there’ I mean at job sites. And you have no idea what the password is, and your people in the office ‘may have’ the password to something you need that was written down some time ago.

Fortunately I have a effective solution that could be of some major use to you.

Well, it is 2x things. A small SBC (single board computer) called a Raspberry Pi 3 and a piece of software called ‘MediaWiki’. This is the same programme that runs ‘Wikipedia’. The site that allows anyone to edit, add, modify, correct info on the world’s largest encyclopedia site.

 

And with it running on a small SBC, you can leave it inside a network cabinet, as long as it is attached to some power and you should be fine.

For this project you will need the following:
  1. A Raspberry Pi 3 with a power supply and a 16 gigabyte SD-CARD with Noobs already configured on it. (See here on how it is done.) You might be able to get away with a 8gb card but I will recommend 16gb as a minimum.
  2. An internet connection.
  3. A monitor that you can be able to plug the PI3 into temporarily (at least until remote access is enabled.
  4. If you are running Windows on your pc that you will be using to remotely connect to the PI3 you will need 2 utilities. Putty and PSCP. Both are available @ http://www.putty.org/
  5. Knowledge of how to follow tutorials.

 

This tutorial will assume that you already have a pre-configured SDcard with the latest Raspbian version on it. So just just get it connected to the network via a RJ45 cable and power it on @ first.

ENABLE SSH (FOR REMOTE LOGIN)

If remote access via SSH is not enabled, you can do so via the terminal command ‘sudo raspi-config’, Selecting  ‘Interfacing Options’, selecting ‘SSH’ and selecting option to enable it.

This will also be a good time to get the IP address of the PI3 (this can be done using a network scanner looking for the network name of the PI3 <default is ‘raspberrypi’>, looking for it in your DHCP configuration on your server or router, or just by the terminal command ifconfig

Mine is currently showing that it is 192.168.1.81.

Connecting to the Pi3 via SSH via Windows (PUTTY)

If you are using Windows (Linux command will follow) , this is done through Putty. Once you have downloaded and installed putty, you will need to open it up

Putty screenshot

In the field underneath ‘Host Name (or IP address) you put in your raspberry pi’s ip address, and then click connect. If may ask  you to confirm any security keys or encryption keys. Please click on yes until you see another window with it asking for a username. The default username is ‘pi’. You will need to type it in and press enter. It now should be asking for a password (if you logged in with the username as ‘pi’ the default password is raspberry).

SSH COMMAND IN LINUX TERMINAL

If you are running Linux (any distribution as it doesn’t matter) you can open up a terminal and run the following command:

ssh pi@(IP_ADDRESS_OF_PI)

If you are using a different username for the pi please substitute it. Then put in the ip address of you PI3, then press enter.

If you get this after running the command, type in ‘yes’, press enter then put in the password and press enter again.

Now we can start getting the software downloaded.

Lets first download Mediawiki. The version we are going to be installing is 1.30 as this is the latest version.

Type in the following commands in order:

cd Downloads

(if the Downloads folder doesn’t exist first go ‘mkdir Downloads)

wget https://releases.wikimedia.org/mediawiki/1.30/mediawiki-1.30.0.tar.gz
tar -xvzf mediawiki-1.30.0.tar.gz
sudo mkdir /var/lib/mediawiki
sudo mv mediawiki-*/* /var/lib/mediawiki
cd /var/www/html
sudo ln -s /var/lib/mediawiki mediawiki

Now to do the installation and updating of the software on your PI3

sudo apt-get update
sudo apt-get upgrade

Once done, run the following command the base packages required for Mediawiki.

sudo apt-get install apache2 mysql-server php php-mysql libapache2-mod-php php-xml php-mbstring

If the packages have already been installed, the command will skip those and install the others.

CONFIGURATION OF MYSQL

During the installation of MySQL server, you will be prompted to enter a password for the MySQL root account. If for some reason no prompt is given, please run the command below.

 mysqladmin -u root password "enter the new password here"

Remember not to use same password for system root and MYSQL root.

We’re going to create a database for our MediaWiki installation to use which will be named ‘wiki’. You can use any other name you wish.

MySQL comes with a shell that can be used for configuration. We can use the the MySQL shell to create a database:

$ sudo mysql -u root -p
Enter password:
mysql> CREATE DATABASE wiki;
mysql> USE wiki;

The ‘USE temps’ command tells the shell to use that database in future operations in this shell session. MySQL supports users accounts, so we need to create a database user and give it access to the database:

mysql> CREATE USER 'wiki'@'localhost' IDENTIFIED BY 'password';
mysql> GRANT ALL PRIVILEGES ON wiki.* TO 'wiki'@'localhost'; 
mysql> FLUSH PRIVILEGES;
mysql> quit

This creates a user called wiki , and assigns it a pass word ‘password’. This user is allowed to connect to the database from ‘localhost’.

Initially, the new user has no privileges, so it must be granted some access rights using the ‘GRANT’ command. I have used ‘ALL’ in this example, but in real world applications it would be better to grant users more limited rights. A complete list of privilege options is available at http://dev.mysql.com/doc/refman/5.1/en/grant.html.

CONFIGURATION OF MEDIAWIKI

Now you should be able on the pc you are connecting to the pi from configure Mediawiki at last! Open a new browser tab or window and browse to the following:

http://ip_address_of_pi3/mediawiki

If you are getting a page that says ‘LocalSettings.php not found’ then click on the ‘setup the wiki first’. If you do not get that page, then you skipped a step somewhere and would need to start over.

The next few screens you will need to go over everything carefully. You can leave all of the settings as their defaults. But when you get to the database connection settings, use the same settings as in the creation of the MYSQL database which was done in the MYSQL shell moments earlier.

ON the page where it asks for a name for the wiki, you can name the wiki whatever you want it to be. For testing purposes I will call it temporary wiki. It will also ask for a username and password (last time it is asking for username’s and passwords I promise). You can even put in the email address so that it can send out emails for security purposes (and how to do that will be in a follow-up tutorial).

When you are on the last screen, click on ‘Continue’ and then leave it until another page loads asking to download the file named ‘LocalSettings.php’ save this file somewhere you can access it.

You will now need to get this file onto your PI3.

If you are running Windows:

Browse to where you saved the file ‘pscp.exe’ (Downloaded in Step 1) . In the white open space HOLD your left shift button, and RIGHT CLICK at the same time. An option to ‘open the command prompt window here’ will open. Then if you downloaded the ‘LocalSettings.php’ file to the same place then you can run the following command but if not you will need to either copy the file to where pscp.exe is or modify the command appropriately.

pscp LocalSettings.php pi@(IPADDRESS_OF_PI):/home/pi/Downloads

In a Linux terminal, browse to where you saved the ‘LocalSettings.php’ file and run the following command.

scp LocalSettings.php pi@(PI_IP_ADDRESS):/home/pi/Downloads

Once the file is there you can move it from the place we copied it to the correct place. This is done via the remote terminal with the command:

 sudo mv ~/Downloads/LocalSettings.php /var/lib/mediawiki/

Now you can go back to the same address on the same pc that we started the Mediawiki configuration (http://ip_address_of_pi3/mediawiki) and you will see the first page.

To change anything, this will be done in that ‘LocalSettings.php’ file that we moved to the Pi. I will be adding some tutorials regarding this wiki (including daily backup of the database, etc) which will come.

 

In the meantime please comment if I had missed anything or need some clarification I will get back to it when I can.

 

How to properly debunk Console Peasants.

In the past year or so I have watched many videos by people claiming to be ‘console gamers’ (or console peasants) touting their console to be the best on the market on the moment.

Xbox fans will always tout the Xbox. Playstation fans will tout for Playstation, and the Nintendiots will always tout for Nintendo.

And they will always make up facts and statistics about PC gaming and when presented with real facts and statistics they will deny it. They will ignore it. They will not even recognise them.

 

So here are some of the most common misconceptions that console fanboys always bring up about PC gaming:

 

  1. Consoles are cheaper than PC’s.

You can build or purchase a pc using either brand new low to mid-range parts that will match or exceed the performance of the current top selling consoles )excluding handheld) Playstation 4 Pro and Xbox One S.

A Xbox one with 1 TB of storage will set you between $270 and $380 (depending on which game is included) with the Ps4 Pro being about $400 on Amazon.com.

With that $380/400 price in mind you would need to add about $60 usd for a 1 year Xbox Live gold or Playstation Now subscription for online play.

I have selected the following components that will provide a superior performance (or higher FPS) at the same or better graphical fidelity in 99.9% of multi-platform games:

CPU = Intel Pentium G4560 3.5GHz Dual-Core Processor = $59.48

Motherboard = MSI B150M BAZOOKA Micro ATX LGA1151 = $60 ($20 mail in rebate from NewEgg)

Ram = Crucial 8GB (2 x 4GB) DDR4-2133 Memory = $55.45

Hard Drive = Hitachi Ultrastar 1TB 3.5″ 7200RPM Internal Hard Drive = $39.99

Video Card = PNY GeForce GTX 1050 Ti 4GB = $129.99($20 mail in rebate from NewEgg)

Case + PSU = Rosewill I3-397-BK MicroATX Mini Tower Case w/400W Power Supply = $34.99

Operating system = Windows 10 Home OEM = Between $25 to $30 depending on which greymarket reseller you use like Kinguin or G2A. Otherwise you can save this amount and just not activate the O.S license. Or install Linux.

The hardware will cost around $342 (with $40 discount for mail in rebates). For windows 10 $30 (if you choose to go that route). The rest on a headset, keyboard and mouse (about $28). There is your $400 PC. And since we don’t have to pay for any online subscription (on top of the internet subscription) for online play you can a couple of games for you to download on your pc.

This leads to my second point –

2. Putting together a pc is difficult

If you cannot complete one of these –

 then you wont be able to put together a PC. Putting a Pc together is just the exact same thing. In fact within a hour you can have the above pc built up and running (including having a OS installed). But if you really want to see how to put together a pc here below is a video of it:

And here is a video of a 5 year old kid putting one together:

Remember my most important rule when building. If it aint going in it’s going in the WRONG WAY!

3. Console versions of games are superior and crash less often than PC’s.

Game crashes happen on consoles to. In fact I have experienced more crashes starting and exiting games on my Xbox one than I have on my pc. Sure there are some games that are released very buggy but this is up to the DEVELOPER/PUBLISHER whether they want to fix or update the game.

Many games that were released buggy as hell also had the same issues on the console ports (still remember seeing Dragons flying backwards in Skyrim on both PC and PS3 during its initial release), and some companies may decide to pull the pc version from the digital and retail because it received so much flack because of the issues (last one I can think of was Batman Arkham Knight).

4. Consoles have the better selection of games.

If you were to take the amount of games that have been released for Pc (which has been around since 1980). That figure is probably in the region of 15-20 THOUSAND verses the couple hundred released for the consoles in this generation, <including those that were self-published>.

Also most console games tend to be either a sports game or a ‘3rd person action adventure with stealth elements’. PC’s tend to have a more diverse range of games as because of our superior inputs, we can have MMORPG’s <Massive Multiplayer Online Role Playing Games>, MOBA’s <Massive Online Battle Arena’s>, Flight Simulators, strategy games, tower defence games, etc.

Although some of these have been ported to  console, their control systems had to be dumbed down for use on a standard controller.

Also if you want to play a old game on a new pc, it may just be as simple as starting up the game, and if any issues occur (due to age of the game) chances are there are ways and ‘unofficial’ patches made by fans of the old game that you want to play.

5. Game-pads are better than keyboard and mouse for games.

In some instances the game-pad is better (like fighting and driving games) but in others nothing beats a keyboard and mouse combo. Plus on PC you can use every single controller available to you <including Xbox one and PS4 controllers> and many games wont know the difference.

6. Online play much better and bigger than on console.

That is a big fat lie. I play on both console and PC and pc online is much better because I have all of the advantages <plus more> of that of a console and I am not paying a single cent <above what I pay for the internet> whereas if I stop paying for my xbox live/psnow subscription or let it run out then I lose contact with all my online friends. Free in my mind is better.

7. You have to upgrade your PC every single month.

You do not have to upgrade ‘every single month’ and those that do must have more money than brain cells.

I currently have a Core i5 3470K cpu and a Geforce GTX 660 TI video card (both about 5 years old or so). Only recently I had upgraded my ram to 16 gb (had started out with 4 gb). I also plan on getting a new GPU soon.

Also I can sell my old parts that I upgrade to offset the price of the new upgrade. That way I do not spend as much on my new build.

 

Pc security

This topic, PC Security, is one that I have been wanting to write for a long time.

4710152-internet-virus-through-pc-browser-surfing-art-stock-photo-internet

This past week, the company I work for almost got hit with ransomware. Luckily the user thought something was fishy with the email he got and called me over to him. He said that he thinks that something just does not sit well with him being relatively new to the company (he was hired 3 months ago and our company is a large company with offices/branches all over the world). He also does not know all the clients of the company as many don’t always order our goods very often.

 

They then forwarded a copy of the mail to me and immediately deleted it off of their accounts. I then forwarded it to the group IT heads and while waiting for a response, when I noticed the attachment. Definitely fishy as it had a file named, and not kidding, ‘invoice-random-number.xls.html’.

 

Lots of people (especially people in finance) will assume that the email is safe, open it, then be surprised it needs your username/password/other info so that the file can be sent to you. If you put in that info, the attackers now have access to whatever account info you have put in.

 

Now some people put in way too much faith in their anti-virus protection, but don’t seem to realise that if a new virus starts spreading all anti-virus programmes wont pick it up until someone sends them a infected file, they analyse it, then push the updates through to the end user. This is how many early ransomware viruses were spread. All because of someone not thinking straight.

 

So here are some tips to keep you and your info safe on whatever pc, phone, tablet, etc you may have.

1. Install a reputable anti-virus programme.

There are plenty of reputable anti-virus security programmes around. Many of them have a restricted ‘free’ or ‘trial’ license that would offer barely adequate protection.

Some of the programmes you can try are:

bAvast – www.avast.com

BitDefender – www.bitdefender.com

Kaspersky – www.kaspersky.com

Avg – www.avg.com

There are plenty of others. But these 4 would be the ones I would choose as I personally use all four on different systems. Each one has their own strengths and weaknesses, but it is better. Windows 10 comes with it’s own ‘okay’ anti-virus but I would not trust it.

2. Keep your computer updated.

You read that right. ‘Keep your computer updated’ and you should. Do not leave one piece of software un-patched if there are patches available for it. Many of these patches plug security holes in your system that hackers can make use of to get into your system.

3. Be careful of opening up random emails.

Just because a email subject says ‘requested invoice’ or ‘cute puppy pictures’ or ‘(insert name of famous person) nude video’ and you don’t take a few moments to see who sent you that mail, and you opened it, then congratulations, you have just confirmed your email address as being active to the spammers.

So if you see a someone that emails you regularly all of a sudden show up as a email address in the ‘from’ instead of what they were in the past, contact them via alternate means just to confirm, even if the mail contains a attachment.

Also most companies (by most I mean 99.99999999999999% of all companies, big and small) would send out invoices, as pdf files, not .txt, .doc., .xls or any other kind.

4. Don’t insert random USB flash drives into your computer unless you know what is on that drive.

For me, random USB flash drives that no one know how it got there are like your common street hooker. Sure she may pleasure you for a hour or so and give you something to remind you of the encounter for up to the rest of your life, but so does that random usb drive.

If someone wants to get into your network, they can pose as a ‘client’ if you are a business, intentionally leave a flash drive somewhere with lots of traffic. Some poor sole may plug that drive into their computer in order to find some photo’s to publish onto Facebook or twitter trying to contact the person who left that drive.

All the while when plugging in the drive he/she unknowingly has activated a programme on the flash drive and now it is scouring the pc and network and sending info back to the ‘client’. If you see a random USB drive lying around, keep it somewhere and do not plug it in. If no one comes to claim it then destroy it.

5. Don’t visit click-bait sites on the web.

We’ve all seen those sites or links that say something like ‘Become a billionaire in 30 days’, ‘double the length of your penis in 6 steps’, ‘Homeless man buys a Ferrari’. There are many more examples. Do not click on any of them. They are all lies. Their only purpose is to get you to give them your information for their gain. And they also get paid by people clicking on links on that page.

In fact some of those pages also could contain code that would allow a attacker to get into your computer somehow.

6. Make regular backups of all your most important files.

There are tons of backup programmes available, again with pro’s and cons’. Hell you could even just copy your data onto removable USB flash drives, cloud storage service, etc. Or run a program that does the same thing automatically.

A program I recommend it Crashplan, found here. You can backup as much as you want to their service (as long as you keep up with the monthly fee). So if you want to backup a gigabyte or a terabyte of data, you can do that. You can also set it to backup to a removable hard disk, another pc on the same network or a friends computer at no charge.

7. Don’t visit sites that offer software for too good a price.

If you need a piece of software (such as Autocad, office, Windows, etc) that is very expensive but all of a sudden you see someone offering it at a super deep discount, do not take them up on it.

Some of these sites may have stolen the activation keys <bought with stolen credit cards, stolen though hack, etc> and then tell you if you need support to not go through the developer and rather the seller, then something is wrong.

Rather support the developers directly.

8. Don’t download pirated software.

Again do not visit any torrent sites to download any software which would normally cost any amount of for free. Many of these could have viruses embedded into them, and end up causing more issues when you try to update the said programs.

Those are just a few of my top tips for keeping your PC more secure.

Please email me at willbeone@willbeone-techtips.co.za if you want to add whatever tips/solutions you may have to make your computer more secure.

Free Linux+ course

… but cannot afford to take a course in the subject.

tux

Why am I doing this?

A very simple reason. I like Linux. I have always had a yearning to help bring more people the knowledge of what Linux can do. Also I had a work colleague that said to me that he is going to report me. I asked why and he said ‘because you have illegal software on your PC’. Granted this person is in his 60’s and only been working with PC’s in the last 10 or so years. But that is because of the marketing power of Microsoft and Windows. Couple that with just about every OEM built PC and laptop has Windows pre-installed on it.

I have learnt a lot from the Linux community over the many years that I have been apart of it. I want to ‘Pay It Forward’ helping others learn about this great system. So just like in the 2000 Kevin Spacey film of the same name, I aim to do the exact same.

How long will it take for me to complete the course?

I will do my utmost best to have each of the 4 modules up on this site as soon as each module is ready. As I add each each module I to the site I will create a link on this page to help motivate me to complete this task. Also once I get a semi-decent microphone (current one probably sounds like a cat being skinned when I speak into it) I will do a video version of these tutorials, and post the links to those on each page.

If you want to know how long each module will take for you to complete, then I honestly cannot say as I am definitely not you. It all depends on how willing you are to learn.

 

Now there are 4 modules that I will be splitting this course into. They are:

 

  1. Introduction to Linux – This is where I give a introduction and a short history of Linux.
  2. Installation of Linux – I will guide you step by step in the installation of a Linux distribution explaining each step in great detail (partitions, file systems in use, mount points, etc)
  3. System administration – Here I will show you the many ways of how to install a programme (whether available through the software repositories or not), how to add local users, create files, directories and some basic troubleshooting commands.
  4. Preparation for the Exam – This is probably self-explanatory, even though I will not be the one administering the exam.