一、CnetOS 7.9 安装 sqlite3
地址
- https://www.sqlite.org
- https://github.com/sqlite/sqlite
- https://www.sqlite.org/2022/sqlite-autoconf-3390400.tar.gz
wget 下载
wget https://www.sqlite.org/2022/sqlite-autoconf-3390400.tar.gz
解压包
tar -zxvf sqlite-autoconf-3390400.tar.gz -C /opt/
进入文件包
cd /opt/sqlite-autoconf-3390400
检测安装路径
./configure --prefix=/usr/local/sqlite3
编译&安装
make && make install
安装完后可以看见如下提示
这段内容显示了sqlite3的安装路径:/usr/local/sqlite3/lib。
特别注意 add LIBDIR to the 'LD_LIBRARY_PATH' environment variable,这是sqlite建议添加环境变量。
----------------------------------------------------------------------
Libraries have been installed in:
/usr/local/sqlite3/lib
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the '-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the 'LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the 'LD_RUN_PATH' environment variable
during linking
- use the '-Wl,-rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to '/etc/ld.so.conf'
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
增加环境变量
vim /etc/profile
export LD_LIBRARY_PATH=/usr/local/sqlite3/lib
# 使配置文件生效
source /etc/profile
查看是否安装成功
ls -l /usr/local/sqlite3/lib/*sqlite*
ls -l /usr/local/sqlite3/include/*sqlite*
替换系统中旧的sqlite
# 把旧的sqlite3改个名字
mv /usr/bin/sqlite3 /usr/bin/sqlite3_old
# 设置软链接
ln -s /usr/local/sqlite3/bin/sqlite3 /usr/bin/sqlite3
echo "/usr/local/sqlite3/lib" > /etc/ld.so.conf.d/sqlite3.conf
ldconfig
检测版本
[root@ecs-65685 bin]# sqlite3
SQLite version 3.39.4 2022-09-29 15:55:41
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite>
sqlite> .quit
# 查看sqlite3版本
[root@ecs-65685 bin]# sqlite3 --version
3.39.4 2022-09-29 15:55:41 a29f9949895322123f7c38fbe94c649a9d6e6c9cd0c3b41c96d694552f26b309
标签:bin,sqlite,CnetOS,LIBDIR,usr,sqlite3,7.9,local From: https://www.cnblogs.com/huaxiayuyi/p/16770739.html