CentOS下更新SQLite版本

查看系统的sqlte3的版本

[root@djangoserver work]# sqlite3 --version 
3.7.17 2013-05-20 00:56:22 118a3b35693b134d56ebd780123b7fd6f1497668
[root@djangoserver work]# 

果然centos系统自带的sqlite3版本偏低,在上面的错误提示中要求需要sqlite 3.8.3 or later,那么就需要去升级 sqlite 的版本了。

centos7安装最新的sqlite3并设置更新python库版本

#更新sqlite 3
#获取源代码(在主目录中运行)
[root@djangoserver ~]# cd ~
[root@djangoserver ~]# wget https://www.sqlite.org/2019/sqlite-autoconf-3270200.tar.gz
[root@djangoserver ~]# tar -zxvf sqlite-autoconf-3270200.tar.gz

#构建并安装
[root@djangoserver ~]# cd sqlite-autoconf-3270200
[root@djangoserver sqlite-autoconf-3270200]# ./configure --prefix=/usr/local/sqlite
[root@djangoserver sqlite-autoconf-3270200]# make && make install

#检查版本
## 最新安装的sqlite3版本
[root@djangoserver ~]# /usr/local/sqlite/bin/sqlite3 --version
3.27.2 2019-02-25 16:06:06 bd49a8271d650fa89e446b42e513b595a717b9212c91dd384aab871fc1d0f6d7
[root@djangoserver ~]# 

## centos7自带的sqlite3版本
[root@djangoserver ~]# /usr/bin/sqlite3 --version
3.7.17 2013-05-20 00:56:22 118a3b35693b134d56ebd780123b7fd6f1497668
[root@djangoserver ~]# 

## 可以看到sqlite3的版本还是旧版本,那么需要更新一下。
[root@djangoserver ~]# sqlite3 --version
3.7.17 2013-05-20 00:56:22 118a3b35693b134d56ebd780123b7fd6f1497668
[root@djangoserver ~]# 

## 更改旧的sqlite3
[root@djangoserver ~]# mv /usr/bin/sqlite3  /usr/bin/sqlite3_old

## 软链接将新的sqlite3设置到/usr/bin目录下
[root@djangoserver ~]# ln -s /usr/local/sqlite/bin/sqlite3   /usr/bin/sqlite3

## 查看当前全局sqlite3的版本
[root@djangoserver ~]# sqlite3 --version
3.27.2 2019-02-25 16:06:06 bd49a8271d650fa89e446b42e513b595a717b9212c91dd384aab871fc1d0f6d7
[root@djangoserver ~]# 

#将路径传递给共享库
# 设置开机自启动执行,可以将下面的export语句写入 ~/.bashrc 文件中,如果如果你想立即生效,可以执行source 〜/.bashrc 将在每次启动终端时执行
[root@djangoserver ~]# export ld_library_path=/usr/local/sqlite/lib

到此这篇关于centos下更新sqlite版本的文章就介绍到这了。希望对大家的学习有所帮助,也希望大家多多支持www.887551.com。

(0)
上一篇 2022年3月21日
下一篇 2022年3月21日

相关推荐