Search code examples
phpsqlitemediawiki

Trying to upgrade SQLite on Amazon EC2


I need SQLite minimum version 3.8 to support a MediaWiki install on Amazon EC2. Amazon Linux is based on CentOS and the latest version available in the yum repository is SQLite 3.7.17.

The downloads available from sqlite.org don't include 64-bit Linux. There is a GitHub repository that has a prebuilt 64-bit version, however it's only the command line version. I put it at /usr/bin:

$ which sqlite3
/usr/bin/sqlite3
$ sqlite3 --version
sqlite3: /lib64/libtinfo.so.5: no version information available (required by sqlite3)
3.26.0 2018-12-01 12:34:55 bf8c1b2b7a5960c282e543b9c293686dccff272512d08865f4600fb58238b4f9

But MediaWiki still complains I have SQLite 3.7.17 installed. When I test it I get:

$ cat x.php

<?php
print_r(SQLite3::version());
?>

Run it:

$ php7 x.php

Array
(
    [versionString] => 3.7.17
    [versionNumber] => 3007017
)

I am guessing this is because of these libraries:

$ sudo find / -name "libsqlite*"
/usr/lib64/libsqlite3.so.0
/usr/lib64/libsqlite3.so.0.8.6

How can I download/rebuild or otherwise install a later version of these SQLite libraries?


Solution

  • The easiest option I found was to build it myself. Tested on Amazon Linux release 2 (Karoo).

    1. Download the latest source code with the configure script from here. Currently this is:
      curl https://www.sqlite.org/2020/sqlite-autoconf-3320300.tar.gz | tar xzf -

    2. Go into the created directory and create the Makefile with our system dependant options:
      cd ./sqlite-autoconf-3320300 && ./configure

    3. Build the binary
      make

    4. Install it
      sudo make install

    5. Clean up
      cd .. && rm -r ./sqlite-autoconf-3320300

    Note: It's far from ideal to do this without a proper RPM package. If you update sqlite through yum, you will overwrite you manually built version.