Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
03-15-2017, 10:16 PM
|
#1
|
LQ Newbie
Registered: Jan 2017
Posts: 25
Rep:
|
SQLite path configuration
I installed SQLite with "npm install sqlite3 --build-from-source = sqlite3" (on Linux Debian), which ran without problems. However, when trying to run SQLite via command line with "sqlite3", this command is not found: "-bash: sqlite3: command not found"
Already when running a script like this from the example below, everything worked OK.
===================
In a second option, I also uninstalled SQLite via npm and reinstalled as indicated below:
$tar xvfz sqlite-autoconf-3170000.tar.gz
$cd sqlite-autoconf-3170000
$./configure --prefix=/usr/local
$make
$make install
In this way the command "$ sqlite3" is recognized, however the script below stopped working and the following error message was shown:
Error: Cannot find module 'sqlite3'
===========================
Is there any path configuration missing from these two installation options?
The command "sqlite3" must be recognized in bash and the script also must be executed in bash. After all, sqlite is installed and running ...
SCRIPT TEST
Code:
#!/usr/bin/env node
var sqlite3 = require('sqlite3').verbose();
var db = new sqlite3.Database('abcd');
db.serialize(function() {
db.run("create table if not exists user (id INT, dt TEXT)");
var stmt = db.prepare("INSERT INTO user VALUES (?,?)");
for (var i = 0; i < 10; i++) {
var d = new Date();
var n = d.toLocaleTimeString();
stmt.run(i, n);
}
stmt.finalize();
db.each("SELECT id, dt FROM user", function(err, row) {
console.log("User id : " + row.id, row.dt);
});
});
db.close();
|
|
|
03-16-2017, 12:16 AM
|
#2
|
Senior Member
Registered: Mar 2003
Location: Nova Scotia, Canada
Distribution: Debian AMD64
Posts: 4,170
|
Suppose there must be good reason for you not using the already packaged in Debian version? I would give the packaged version a try more than likely will have a better outcome using it.
Code:
~$ apt-cache policy sqlite3
sqlite3:
Installed: (none)
Candidate: 3.8.7.1-1+deb8u2
Version table:
3.8.7.1-1+deb8u2 0
500 http://ftp.de.debian.org/debian/ jessie/main amd64 Packages
3.8.7.1-1+deb8u1 0
500 http://security.debian.org/ jessie/updates/main amd64 Packages
|
|
|
03-16-2017, 09:57 AM
|
#3
|
LQ Newbie
Registered: Jan 2017
Posts: 25
Original Poster
Rep:
|
Yes, there is a good reason: SQLite isn't intalled in this Debian version.
I'm using an embedded device called Beaglebone Black, which runs on Linux Debian prepared for it. There is a Linux Debian Jessie 8.6 image on its webpage. It's the first link to linux image as shown below:
Jessie for BeagleBone via microSD card
Debian 8.6 2016-11-06 4GB SD LXQT image for BeagleBone
https://debian.beagleboard.org/images/bone-debian-8.6-lxqt-4gb-armhf-2016-11-06-4gb.img.xz
So, for this reason I'm trying to install (unsuccessfully) SQLite and I'm getting some unreported errors.
Please, could you help me solve the problem? I'm a newbie Linux user, SQLite user, and newbie for "many other things more" user.
|
|
|
03-16-2017, 11:35 AM
|
#4
|
Senior Member
Registered: Mar 2003
Location: Nova Scotia, Canada
Distribution: Debian AMD64
Posts: 4,170
|
Quote:
Originally Posted by wBB
Yes, there is a good reason: SQLite isn't intalled in this Debian version.
I'm using an embedded device called Beaglebone Black, which runs on Linux Debian prepared for it. There is a Linux Debian Jessie 8.6 image on its webpage. It's the first link to linux image as shown below:
Jessie for BeagleBone via microSD card
Debian 8.6 2016-11-06 4GB SD LXQT image for BeagleBone
https://debian.beagleboard.org/images/bone-debian-8.6-lxqt-4gb-armhf-2016-11-06-4gb.img.xz
So, for this reason I'm trying to install (unsuccessfully) SQLite and I'm getting some unreported errors.
Please, could you help me solve the problem? I'm a newbie Linux user, SQLite user, and newbie for "many other things more" user.
|
Lovely one of them distributions that are not complete well hopefully this will work. First you need to install the build-essential package and apt-src if it is not installed at the same time. Then mkdir src and cd src to change into the directory that you just created for holding the source it downloads now on this page below it tells you the rest of the steps. For the source line in your /etc/apt/sources.list you want.
Code:
deb-src http://ftp.de.debian.org/debian/ jessie main non-free contrib
Where it tells you to modify dpkg-buildpackage debian/rules options leave them alone with the defaults they install with and follow the rest of the instructions.
https://wiki.debian.org/apt-src
Edit: To install the packages mentioned apt-get install build-essential apt-src.
Last edited by HappyTux; 03-16-2017 at 11:40 AM.
|
|
|
03-16-2017, 02:44 PM
|
#6
|
LQ Newbie
Registered: Jan 2017
Posts: 25
Original Poster
Rep:
|
HappyTux,
I don't know if I did everything right (I hope so...), but it did not work. The same problem remains. Thank you for your attention. If you have any other suggestions, I'd appreciate it.
norobro
I had imagined installing the two packages to try to solve the problem, but that is an idea that doesn't seem right. I don't know, but it seems wrong to me to have two different packages to do the same thing. As I said before, I'm newbie and my experience is not relevant...
I'll try to find some other alternative, but if I can't, I'll follow your suggestion. Anyway thank you for your attention and time.
|
|
|
03-16-2017, 08:27 PM
|
#7
|
Senior Member
Registered: Mar 2003
Location: Nova Scotia, Canada
Distribution: Debian AMD64
Posts: 4,170
|
Quote:
Originally Posted by wBB
HappyTux,
I don't know if I did everything right (I hope so...), but it did not work. The same problem remains. Thank you for your attention. If you have any other suggestions, I'd appreciate it.
norobro
I had imagined installing the two packages to try to solve the problem, but that is an idea that doesn't seem right. I don't know, but it seems wrong to me to have two different packages to do the same thing. As I said before, I'm newbie and my experience is not relevant...
I'll try to find some other alternative, but if I can't, I'll follow your suggestion. Anyway thank you for your attention and time.
|
Hmm probably need the two other packages already mentioned installed as well. Now you may have to build them from source too but before that what is in the sources.list you have on the machine right now.
|
|
|
03-17-2017, 10:08 AM
|
#8
|
LQ Newbie
Registered: Jan 2017
Posts: 25
Original Poster
Rep:
|
I uninstalled the previous packages and I reinstalled as indicated by norobro. Now there are both packages and both work. One package to run scripts and another for executing the sqlite in command-line bash. As I said before, I don't like this idea, but I have no choice for now.
My source.list file is the same as the one originally installed:
Code:
deb http://httpredir.debian.org/debian/ jessie main contrib non-free
# deb-src http://httpredir.debian.org/debian/ jessie main contrib non-free
deb http://httpredir.debian.org/debian/ jessie-updates main contrib non-free
# deb-src http://httpredir.debian.org/debian/ jessie-updates main contrib non-free
deb http://security.debian.org/ jessie/updates main contrib non-free
# deb-src http://security.debian.org/ jessie/updates main contrib non-free
# deb http://httpredir.debian.org/debian jessie-backports main contrib non-free
##deb-src http://httpredir.debian.org/debian jessie-backports main contrib non-free
deb https://deb.nodesource.com/node_0.12 jessie main
# deb-src https://deb.nodesource.com/node_0.12 jessie main
#Kernel source (repos.rcn-ee.com) : https://github.com/RobertCNelson/linux-stable-rcn-ee
#
#git clone https://github.com/RobertCNelson/linux-stable-rcn-ee
#cd ./linux-stable-rcn-ee
#git checkout `uname -r` -b tmp
#
deb [arch=armhf] http://repos.rcn-ee.com/debian/ jessie main
# deb-src [arch=armhf] http://repos.rcn-ee.com/debian/ jessie main
|
|
|
03-17-2017, 03:31 PM
|
#9
|
Senior Member
Registered: Mar 2003
Location: Nova Scotia, Canada
Distribution: Debian AMD64
Posts: 4,170
|
Quote:
Originally Posted by wBB
I uninstalled the previous packages and I reinstalled as indicated by norobro. Now there are both packages and both work. One package to run scripts and another for executing the sqlite in command-line bash. As I said before, I don't like this idea, but I have no choice for now.
My source.list file is the same as the one originally installed:
Code:
deb http://httpredir.debian.org/debian/ jessie main contrib non-free
# deb-src http://httpredir.debian.org/debian/ jessie main contrib non-free
deb http://httpredir.debian.org/debian/ jessie-updates main contrib non-free
# deb-src http://httpredir.debian.org/debian/ jessie-updates main contrib non-free
deb http://security.debian.org/ jessie/updates main contrib non-free
# deb-src http://security.debian.org/ jessie/updates main contrib non-free
# deb http://httpredir.debian.org/debian jessie-backports main contrib non-free
##deb-src http://httpredir.debian.org/debian jessie-backports main contrib non-free
deb https://deb.nodesource.com/node_0.12 jessie main
# deb-src https://deb.nodesource.com/node_0.12 jessie main
#Kernel source (repos.rcn-ee.com) : https://github.com/RobertCNelson/linux-stable-rcn-ee
#
#git clone https://github.com/RobertCNelson/linux-stable-rcn-ee
#cd ./linux-stable-rcn-ee
#git checkout `uname -r` -b tmp
#
deb [arch=armhf] http://repos.rcn-ee.com/debian/ jessie main
# deb-src [arch=armhf] http://repos.rcn-ee.com/debian/ jessie main
|
Well with that sources.list you should never have to have built from source at all it should have been available according to packages.debian.org it is built for armhf.
https://packages.debian.org/search?s...ywords=sqlite3
To check which version of the sqlite3 you are running use in bash which sqlite3 and put a line in the script echo "which sqlite3". If they are both the same then you can delete the package or source install depending on which is used.
|
|
|
03-17-2017, 07:59 PM
|
#10
|
LQ Newbie
Registered: Jan 2017
Posts: 25
Original Poster
Rep:
|
On Bash:
SQLite version 3.17.0 2017-02-13 16:02:40
On script "echo" raises a error:
echo "which sqlite"
I believe both are the same version, but I didn't get to check from script.
|
|
|
03-17-2017, 09:44 PM
|
#11
|
Senior Member
Registered: Mar 2003
Location: Nova Scotia, Canada
Distribution: Debian AMD64
Posts: 4,170
|
Quote:
Originally Posted by wBB
On Bash:
SQLite version 3.17.0 2017-02-13 16:02:40
On script "echo" raises a error:
echo "which sqlite"
I believe both are the same version, but I didn't get to check from script.
|
That is not the output of a which sqlite3 it returns the path to the binary it finds, that is a --version output.
Code:
:~$ which bash
/bin/bash
:~$ bash --version
bash --version
GNU bash, version 4.3.30(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
And now I look back at that script it is not a bash script like you said but rather a node script so it probably will not execute that echo bash command not sure though never ran one before. As well that could be the reason for the failure to find the sqlite3 originally if that script does not set a proper path it will not find the binary it is looking for.
|
|
|
03-18-2017, 09:25 AM
|
#12
|
LQ Newbie
Registered: Jan 2017
Posts: 25
Original Poster
Rep:
|
You really are a very patient guy... You're right! I forgot that I was working on a Node script and not on bash script . Now I did a bash script and I got the same result in command line and bash script, like you said:
/usr/local/bin/sqlite3
For now, I think that I should work with two sqlite3 instances: one for bash and one for nodejs, as before. I am satisfied though still disagreeing with this option.
|
|
|
All times are GMT -5. The time now is 12:58 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|