10

I'm currently running Ubuntu 18.04 with SQLite3. SQLite 3 is at version 3.22.0 and I need to upgrade it to version 3.33.0 to take advantage of new functionality that is available. If I remove and reinstall SQLite3 with apt-get, it just re=installs 3.22.0. How can I upgrade to the latest version of SQLite3?

Mike Collins
  • 402
  • 3
  • 13
  • 1
    Just download and compile the source. It installs into /usr/local by default and tends to just work with anything using the sqlite dynamic library. – Shawn Nov 16 '20 at 23:40

1 Answers1

23

I have tried to compile the latest sqlite3 from source and it does not work with the packages of Ubuntu 18.04.

Eventually, I upgraded my Ubuntu to 20.04(Focal Fossa), and it comes with Sqlite 3.31.

If you want the latest Sqlite 3.34(at the time of this post), you need to download and build it yourself.

The steps are pretty straight forward.

Step 1 - Download the Source code

wget https://sqlite.org/2021/sqlite-autoconf-3340100.tar.gz

Step 2 - Extract the tarball

tar -xvf sqlite-autoconf-3340100.tar.gz && cd sqlite-autoconf-3340100

Step 3 - Configure

sudo apt-get install libreadline-dev
./configure

Step 4 - Make

make

Step 4.5 - Get rid of the old version

sudo apt-get purge sqlite3

Step 5 - Make Install

sudo make install

Step 6 - Add to path

export PATH="/usr/local/bin:$PATH"  # also add in your .bashrc

Step 7 - Verify the installation

sqlite3 --version
3.34.1 2021-01-20 14:10:07 10e20c0b43500cfb9bbc0eaa061c57514f715d87238f4d835880cd846b9ebd1f
Alex R
  • 11,364
  • 15
  • 100
  • 180
divinedragon
  • 5,105
  • 13
  • 50
  • 97
  • 1
    I tried your steps above to the letter, but step 6 does not work: "-bash: /usr/bin/sqlite3: No such file or directory". Can I only reach sqlite3 in its own folder? – Somentus Mar 02 '21 at 12:33
  • You are building on Ubuntu 20.04? – divinedragon Mar 02 '21 at 18:02
  • Yes. Someone else with more Linux knowledge helped me, apparently the folder where sqlite3 gets installed is not part of the PATH, so it had to be added manually. – Somentus Mar 02 '21 at 18:41
  • Can you add that to the answer so that if somebody faces a similar situation, they have that note for reference. – divinedragon Mar 02 '21 at 18:47
  • On Ubuntu 20.04.6 LTS (Focal Fossa), it needs to instead be : `export PATH="/usr/local/lib:$PATH" # also add in your .bashrc` – GeneC Jul 30 '23 at 17:32