Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 14 days ago.
Improve this question
I'm working on a bash script to detect if pipreqs is installed on a system and install pipreqs if it isn't installed.
this is what I have so far;
if command -v pipreqs > /dev/null; then
echo "pipreqs is already installed"
else
echo "pipreqs is not installed, installing now"
pip install pipreqs
fi
line 1 doesn't seem to work how I intend it.
I'm new to scripting.
Testing the pipreqs command is available within the $PATH environment is not reliable. It can give you false negative, because command -v pipreqs will fail if the pipreqs command is not within one of the paths within the $PATH environment variable.
If pipreqs is installed by a user account locally with pip install --user pipreqs, it will try to place the pipreqs command within the ~/.local/bin directory if it is registered to the $PATH environment variable. But it may not be available to the $PATH and fail command -v pipreqs
If you need to check that the pipreq package is installed, even without a pipreqs command in $PATH, then you could do the check with pip like this:
if pip --quiet show pipreqs 2> /dev/null; then
echo "pipreqs is already installed"
else
echo "pipreqs is not installed, installing now"
pip install --user pipreqs
fi
You could find more info on managing python project dependencies if it is what you are trying to do with pipreqs here: https://packaging.python.org/en/latest/tutorials/managing-dependencies/
Related
This question already has answers here:
Is it possible to answer dialog questions when installing under docker?
(7 answers)
Closed last year.
I am making a Dockerfile and want to install xfce4. This is what I am currently trying:
RUN /bin/bash -c 'echo y 12 4 2 | apt install xfce4'
During installation, I am first prompted by a yes or no for installation. Then, I am prompted to give my geographical location (for some reason) and my timezone. Additionally, I am prompted to choose between gdm3 and lightdm. I am trying to pass these choices by echoing my choices and piping the output into stdin. This works for the yes or no, but fails for the rest. Any ideas on how to do this? Thanks.
Use:
DEBIAN_FRONTEND=noninteractive apt-get install -y xfce4
to install something non-interactively.
This question already has answers here:
How to find Linux Distribution name using shell script?
(7 answers)
Closed 2 years ago.
I have an issue where I need to install package updates on ec2s, yet I wouldn't know if it is either ubuntu, or RHEL, CentOs, and AmazonLinux2.
the update for ubuntu command is:
'sudo apt-get update -y',
'sudo apt-get upgrade -y',
while the RHEL, CentOS and AmazonLinux2 update command is:
'sudo yum update -y',
I want to use command cat /etc/os-release to find out the name then put commands into an if statement to execute the appropriate update command for the OS. However, the output is printed and I have no idea how to take the name argument to use in my if statement. Any help is appreciated.
source /etc/os-release
echo "$NAME"
Output:
Ubuntu
or
Red Hat Enterprise Linux Server
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
Node will not delete on Linux Mint 13.
see the video here
http://youtu.be/tV8HhS1xw2g
and
here
http://www.youtube.com/watch?v=g8DNvv3iFdI
I installed via git but node failed to run see https://github.com/Jermolene/TiddlyWiki5/issues/73 for the tests I ran to try to get node to play nice.
so I uninstalled the git version and installed the Ubuntu v. apt-get install node
$ which node
/usr/local/bin/node
$ node --version
v0.5.11-pre
That node didn't work either... but I can't delete node now!
$ sudo apt-get remove node
[sudo] password for dennis:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package node is not installed, so not removed
It's not deleting but the system still sees it.
$ which node
/usr/local/bin/node
I tried the advice found on: Uninstall Node.JS using Linux command line? but that didn't work either.
$./configure --prefix=$HOME/local/node sudo make uninstall
bash: ./configure: No such file or directory
dennis#64maya /usr/local/src/ipython/examples/notebooks $ sudo ./configure --prefix=$HOME/local/node sudo make uninstall
sudo: ./configure: command not found
Node is still installed:
$ node --version
v0.5.11-pre
$ which node
/usr/local/bin/node
$ cd /usr/local/bin
$ ls
apt ipcluster3 iplogger3 irunner3 pycolor
easy_install ipcontroller iptest mint-md5sum pycolor3
easy_install-3.2 ipcontroller3 iptest3 node pygmentize
f2py3.2 ipengine ipython node-waf search
highlight ipengine3 ipython3 nosetests yelp
ipcluster iplogger irunner nosetests-3.2 zim
I tried dpkg... no joy.
$ dpkg -r node
dpkg: error: requested operation requires superuser privilege
dennis#64maya /usr/local/bin $ sudo dpkg -r node
dpkg: warning: there's no installed package matching node
dennis#64maya /usr/local/bin $ which node
/usr/local/bin/node
dennis#64maya /usr/local/bin $ node --version
v0.5.11-pre
How to delete all remnants of node so that I can eventually try to install it again?
Thank you
Dennis
You don't need to. Just download again and
git clone https://github.com/joyent/node
cd node
./configure --prefix=/usr/local
make
sudo make install
You will then overwrite all files from previous installation, since you keep --prefix=/usr/local the same, then the installation procedure should overwrite all files into the same relative file path, following /usr/local
Hope that helps!
You need to get the source from git again so that you can run the ./configure script and make script from within the source directory. The problem there too is that you used the wrong prefix, I think. Given the output from your which command which shows node is installed in /usr/local/bin/node, I think your --prefix is /usr/local/. So try:
./configure --prefix=/usr/local && sudo make uninstall
From within the source directory.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I am trying to work on node.js on my Ubuntu 12.04. However everytime I try to install it, Ubuntu shuts down automatically.
Here are the steps I am trying to do:
$ apt-get -y install libssl-dev git-core pkg-config build-essential curl gcc g++ checkinstall
$ wget http://nodejs.org/dist/v0.8.11/node-v0.8.11.tar.gz
$ tar -zxf node-v0.8.11.tar.gz
$ cd node-v0.8.11
$ ./configure && make && checkinstall --install=yes --pkgname=nodejs --pkgversion "0.8.11" --default
Capturing the terminal output also doesn't seem to be useful since it does not provide any reason for shutdown.
Is there something I am missing in installation?
This may be a hardware-related problem. Please check that your memory is all right before doing other stuff.
Secondly, this may point to some kernel problems, of which you may learn from system log files.
Thirdly, you are generally better off doing the various stages sequentially to find the exact crash stage instead of combining them with &&.
Now, on to the node.js installation. I have been less than successful with checkinstall; however, I have definitely liked fpm, and used it to compile and package (it can do both .deb and .rpm ones) Node.JS and then install it
./configure --prefix=/usr
make
mkdir -p /tmp/nodejs
make install DESTDIR=/tmp/nodejs
fpm -s dir -t deb -n nodejs -v 0.8.11 -C /tmp/nodejs -p nodejs-VERSION_ARCH.deb usr
HTH
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I'm trying to find ab - Apache HTTP server benchmarking tool for Ubuntu, I'm hoping there's a package I can install for it. I decided I need to do some simple load testing on my applications.
% sudo apt-get install apache2-utils
The command-not-found package in Ubuntu provides some slick functionality where if you type a command that can't be resolved to an executable (or bash function or whatever) it will query your apt sources and find a package that contains the binary you tried to execute. So, in this case, I typed ab at the command prompt:
% ab
The program 'ab' is currently not installed. You can install it by typing:
sudo apt-get install apache2-utils
bash: ab: command not found
Another way to search for missing files, e.g. if you use zsh, want to disable command-not-found (slows things down when you misstype commandnames), or are looking for a file that is not an executable:
$ sudo aptitude install apt-file
$ sudo apt-file update
$ apt-file search bin/ab