Forum Moderators: bakedjake

Message Too Old, No Replies

How to update sqlite3 on Ubuntu for all users?

"apt" tries to install an old version, manual install not visible

         

MichaelBluejay

5:46 pm on Nov 24, 2022 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I installed the newest version of sqlite3, but when I enter "sqlite3" on the command line, the old sqlite3 loads. In fact, when I do "which -a sqlite3", the only result is the old, preinstalled version in /usr/bin/sqlite3.

The steps I used to install the new version:

cd /usr/local/bin
wget https://www.sqlite.org/2022/sqlite-autoconf-3400000.tar.gz
tar zxvf sqlite-autoconf-3400000.tar.gz
cd sqlite-autoconf-3400000
./configure
make
make install

Most articles about installing sqlite3 say to use these or similar commands:

apt update
apt upgrade
apt install sqlite3

But when I do that, I get the error, "sqlite3 is already the newest version (3.22.0-1ubuntu0.7)." But that's not true, the newest version is 3.40.0.

robzilla

5:58 pm on Nov 24, 2022 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



There's a difference between building and installing software from source, and installing packaged software. You cannot update packaged software by building from source, nor can you use a package manager like apt to update software that was built from source.

So now you have two separate installations of SQLite. Maybe you can run them side by side, I don't have any experience running SQLite.

What happens when you call "which -a sqlite"? (without the 3)

Without building from source, you'd have to wait for the package maintainers to release the 3.40 version. Downside of building from source, on the other hand, is that you have to do so for every update you want to install -- which is why they created packages and package managers, but that does create a reliance on package maintainers.

graeme_p

8:54 pm on Nov 24, 2022 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You get the newest version packaged for your version of Ubuntu. As @robzilla said you are two versions side by side. A lot depends on why you want to upgrade to the newest (do you want a specific feature for a specific purpose, for example?).

You are probably using an older stable version. The whole point of a stable version if you only get security upgrades so things do not break - they are really meant for servers.

If you find yourself needing newer versions of stuff, move to a newer version of Ubuntu. If it is only sqlite you want the latest version for there is probably a PPA for your version of Ubuntu - with a backport.

If you always want the latest stuff, use a rolling release distro - I use Manjaro myself. However, the cost of being on the leading edge is that you have to fix things more often and experience more bugs. Rolling release distros are probably not right for servers.

[edited by: graeme_p at 8:56 pm (utc) on Nov 24, 2022]

graeme_p

8:56 pm on Nov 24, 2022 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I just noticed you put it in /usr/local/bin That is fine, but you need to call it by full path /usr/local/bin/sqlite

MichaelBluejay

9:22 pm on Nov 25, 2022 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Thank you all for the help.

Skipping to the chase, now when I log in as any user and run sqlite3, I get the proper newest version I installed (v.3.40). I don't know why that's suddenly happening. Maybe my webhost decided to fix the problem after insisting I was on my own. (I have a "Fully Managed" dedicated server; most webhosts seem to define "Fully Managed" as that the host will update popular app sw like sqlite3, vs. just "Managed" which means they update only the OS, but to my host, they won't update app software for their "Fully Managed" servers.)

Answering questions:

which -a sqlite3
/usr/local/bin/sqlite3 # 3.40
/usr/bin/sqlite3 # 3.29


$PATH:
...
/usr/local/bin
/usr/bin
...

which -a sqlite
/usr/bin/sqlite # 2.8.17

Why upgrading. Yes, I need a feature in the newer version (the ability to easily rename table columns).