Pages

Saturday, 14 September 2019

50 followers!

I've reached 50 followers. That's about four dozen more than I expected when I started this blog. And 1.5 million page views. Wow.

So what is the purpose of this blog. It's kind of like a journal, in which I post things that I've done, things that have happened, thoughts that I've thought

So thanks to the 48 unexpected followers, and here's to the next 50!

Raspberry Pi 4 workstation

I've been using a Raspberry Pi 3 for a couple of years now as a workstation, but only as multiple terminals, plus a bit of Googling. When the Pi 4 came out, at first I couldn't get hold of one, but after a while they became easily available.

You can get them in 1gb, 2gb and 4gb.  But you can't upgrade. The cost is £35, £45 and £55, so I got the 4gb version. I also got the recommended power supply (I can try it out later with my own power supplies). My own? I'll just explain that.

I use standard PC power supplies (and in some cases, they are powering an ordinary computer). I take the 12 volt line, and feed that into the ethernet cable, using a POE adaptor. Ethernet cables are 8 wires, but only four of them are used. So this uses the other four to carry power. Then I feed that 12 volts (which will have dropped a bit by the time it arrives where it's needed) into a little card that drops that 12v to what the Pi wants, which is about 5 volts (or maybe 5.5). This means that I don't need lots of Pi power supplies; that little card is very cheap. And it means I don't have a big overhead in the power conversion.

I set up a 64gb SD card using the latest Raspbian, Buster (I only recently found out that the various versions are named after Toy Story characters). But then I hit the first problem - I only have HDMI cables, and the Pi 4 uses mini HDMI. So on Ebay, I bought a little converter from HDMI to mini HDMI.

I plugged in a USB keyboard and USB mouse, and powered up. To my great happiness, the Pi 4 was immediately driving my Acer et430k monitor giving me 43 inches of 3840 by 2160 loveliness. I was half-expecting to do a lot of messing about for that, but it "just worked".

The USB keyboard is rubbish - what do you expect for £4? But I was able to replace that with one of my beautiful big IBM keyboards (you can still get them, they're about £100, but if you do a lot of typing, and like a positive clicky keyboard, it is perfection). That has a PS/2 interface, but I have a converter for that, and that worked first time too!

But the sound didn't work. The HDMI interface should feed sound into the monitor, and it wasn't working. I haven't given up on that yet; I feel that the problem is at the monitor end. But I do want sound! So I used the audio output on the Pi 4, and fed that into a pair of powered speakers. And that worked first time too!

So then I added Firefox, and xfe (the file manager that I like), and Nedit (my favourite editor). A slight problem there; most of my computers are Fedora, and I know how to add software to those using yum. But the Pi 4 is using Raspbian, a derivative of Debian, and that uses apt-get. I think all the packages I want are probably available, but the names are slightly different. Google gets me there.

And printing. I have three printers, my Old Faithful HP Laserjet 6p, which I've had for 25 years. That was very easy to set up because I use Jetdirect, an ethernet-to-parallel converter. The Dell was easy too, because it is natively a network printer, and the Samsung took a bit of messing about to get that working with the Pi 4.

Networking can be done using the built-in Wifi, or the Gigabit ethernet port. At first, I used the Wifi, but it didn't play youtube smoothly. So I used a speed tester on it. I found that my various Wifi access points were giving me 5mbps, 7, 10 and 20, with the 20 running off the TP link. But with a wired connection I got 60 mbps, which is about what I'd expect, because my link to the internet is 100 mbps. Roll on Gigabit broadband!

So what's the point of all this?

The Raspberry Pi 4 takes about 2 amps at 5 volts, which is 10 watts. When I put my hand above it, I can feel that it's slightly warm. But that is replacing a full size computer that was pulling about 150 watts. And it isn't just the cost of the electricity. It's the heat. All that 150 watts comes out as heat, which isn't a problem in winter, but we had a really really hot summer this year, and even opening the window didn't help, because it was hotter outside than inside. But next year, when the hot weather arrives, I can power off all my computers in the office except the Pi.


Thursday, 5 September 2019

Setting up a phpBB forum

phpBB is one of the more commonly used forum software packages. I used it on a Linux Fedora box, and it was fairly easy to set up.

But I wanted to move the whole thing to a Raspberry Pi, as part of my electricity economy drive. I had a Pi 2 that wasn't being used, and that has 1 gb of memory, so that was my intention.

First, I tried to set it up with Fedora. That's not what most people use on a pi, but I thought it might be easier since I was moving the phpBB from a Fedora box.

Fedora version 30 is available for the pi (and version 29). But when I set it up, I discovered that it occupies a couple of gb, and there seemed to be no way to tell it to use the whole 64gb on the SD card. It said that it did; the partition was expanded to 64gb, but the partition wasn't being fully used. It was only after I realised that, since it was using the xfs file system, you can't use fsck to fix it, you have to use the xfs equivalent, "xfs_growfs /". And that expanded it to 64gb, but really the install process should have done that for me.

And then I found that there were four processes running continuously, which meant that the loading of the pi was 4, and that was before I was running anything.

And when I installed PHP, it gave me version 7.3.8, and phpBB won't use such a recent version of PHP, and at that point I gave up on Fedora on the pi.

So, on to Raspbian, which is what most people use on the pi. I tried the latest version of Raspbian first, "Buster". That didn't work, because it also gave me a too-recent version for PHP, so I tried using the previous version , "Stretch". Whatever happened to good old-fashioned version numbers?

I had a lot of false start with that too, but I eventually got it to work. Here's hw.

First, I installed Raspbian Lite. Then:
raspi-config
apt-get update
apt-get install network-manager -y
        Then I used nmtui change ip to 10.11.0.37
        Then I edited /etc/ssh/sshd_config to allow rootlogin
reboot

Then I installed some more stuff:

apt-get -y install rdate
apt-get -y install rsync
apt-get -y install dcfldd
apt-get -y install apache2
apt-get -y install php7.0
apt-get -y install php7.0-mysql php7.0-curl php7.0-json php7.0-cgi php7.0-xsl
apt-get -y install mysql-server
apt-get -y install libxml2-dev
apt-get -y install php-xml

Then I added a user, and edited the apache configuration, so it would run using https.
And then I copied over the ssl certificates

And now phpBB
bunzip2 phpBB-3.2.7.tar.bz2
tar -xf phpBB-3.2.7.tar
rm phpBB-3.2.7.tar

Then, as root, I created the database.
mysql
CREATE DATABASE db;
use db; 
UPDATE mysql.user SET authentication_string = PASSWORD('****') where user = 'db' AND Host = 'localhost';
GRANT ALL PRIVILEGES ON *.* TO 'db'@'localhost' IDENTIFIED BY 'db';
exit






Then I could do the install of phpBB, which was only what really needed to be done, because I was going to copy the already-existing phpBB. So to do that, on the old forum, I did a backup. I copied the file to the raspberry, and tried to do a restore.

It didn't work.

So I tried to do a backup of the newly created database, and that worked, and I tried to restore that backup, and the restore didn't work.

Oh, great. Millions of people are using this system, and if you do a backup, you can't do a restore.

So I googled some more.

cd /home/rd/pub/phpBB3/includes/acp
acp_database.php on line 219
line 219 incorrectly tries to reference "extensions", instead of "extension"
So I edited that line, and then the restore worked.


I would estimate that doing this job took about a week, and it should have taken an hour. Partly because there are so many things that don't work as they should, and partly because there are so many things that don't work with each other.

But, I got it done in the end.

So now I can try out my new Raspberry Pi 4, which I want to use as a workstation with a 4K monitor.