Centos7升级SQLite

我的django版本是3.1.5

而系统当前的sqlite版本是3.1.17,太低了,最少需要3.8.3

[root@izbp1eednvvtf33syjd02az bin]# python -m django --version
3.1.5
[root@izbp1eednvvtf33syjd02az bin]# sqlite3 --version
3.7.17 2013-05-20 00:56:22 118a3b35693b134d56ebd780123b7fd6f1497668
[root@izbp1eednvvtf33syjd02az bin]#
[root@izbp1eednvvtf33syjd02az mysite]# python manage.py runserver
Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
  File "/usr/local/python3/lib/python3.7/threading.py", line 926, in _bootstrap_inner
    self.run()
……
…… django.core.exceptions.ImproperlyConfigured: SQLite
3.8.3 or later is required (found 3.7.17).

于是升级SQLite


 

下载安装包,解压,进入源码目录

创建安装目标目录

wget -c https://www.sqlite.org/2019/sqlite-autoconf-3270200.tar.gz
tar -xzf sqlite-autoconf-3270200.tar.gz
cd sqlite-autoconf-3270200
mkdir /usr/local/sqlite

安装前配置

安装到/usr/local/sqlite/中去

./configure --prefix=/usr/local/sqlite/

编译,安装

make
make install

安装目标目录下已经有东西了

[root@izbp1eednvvtf33syjd02az sqlite-autoconf-3270200]# tree /usr/local/sqlite/
/usr/local/sqlite/
├── bin
│   └── sqlite3
├── include
│   ├── sqlite3ext.h
│   └── sqlite3.h
├── lib
│   ├── libsqlite3.a
│   ├── libsqlite3.la
│   ├── libsqlite3.so -> libsqlite3.so.0.8.6
│   ├── libsqlite3.so.0 -> libsqlite3.so.0.8.6
│   ├── libsqlite3.so.0.8.6
│   └── pkgconfig
│       └── sqlite3.pc
└── share
    └── man
        └── man1
            └── sqlite3.1

7 directories, 10 files
[root@izbp1eednvvtf33syjd02az sqlite-autoconf-3270200]#

备份旧版本,链接新版本,验证

[root@izbp1eednvvtf33syjd02az bin]# mv /usr/bin/sqlite3 /usr/bin/sqlite3_old
[root@izbp1eednvvtf33syjd02az bin]# ln -s /usr/local/sqlite/bin/sqlite3 /usr/bin/sqlite3
[root@izbp1eednvvtf33syjd02az bin]# sqlite3 --version
3.27.2 2019-02-25 16:06:06 bd49a8271d650fa89e446b42e513b595a717b9212c91dd384aab871fc1d0f6d7
[root@izbp1eednvvtf33syjd02az bin]#

将库文件包含进系统库中去,source立即生效

vi /etc/profile
末尾追加 export LD_LIBRARY_PATH="/usr/local/sqlite/lib"
source /etc/profile

 

Centos7升级SQLite

上一篇:PX4 飞控源码系统框架介绍


下一篇:MON-DB-mysql通过zabbix监控processlist数量