Install multiple packages on linux (like pip install -r requirements.txt) - linux

As the title is pretty clear (I hope so :) ), I'm looking for an easy way to install many softwares through apt-get command, I have created a shell script where I put all software I need but it's not very clean to do that I assume. The cleanest way is to tell apt-get to read into a file like the command pip.
Thanks in advance

Put the list of packages in a text file(say test.txt) with package names separated by spaces, like this -
python ruby foo bar
then you can just install with apt-get like this -
sudo apt-get install $(cat test.txt)

Related

apt-get install build-essential

I am writing bash script for vps server. I got this problem:
I need to install the build-essential package by script.
Command using in script:
eval 'apt-get install build-essential'
I coped with the problem (yes / no), found the -y switch for apt-get.
eval 'apt-get -y install build-essential'
But how to get around the second problem?:
(Enter the items or ranges you want to select, separated by spaces.)
Which services should be restarted?
I don't have to choose anything. A simple press of Enter would solve the problem!
So, any
echo, echo "\r", yes | apt-get -y install build-essential
does not working and my ideas are over!
I figured out how to solve this problem! The reboot service selection menu pops up on Ubuntu 22.04. I installed 20.04 and
and there is no menu. Might be useful for someone!

How to install multiple .deb files but in specific order with single linux command

I have 4 debian installer :
abc.deb
jkl.deb
pqr.deb
xyz.deb
I want to install jkl and xyz first, and then I want to install abc.deb and pqr.deb. So the sequence/order the .deb files should be installed should be : jkl.deb , xyz.deb, abc.deb, pqr.deb.
PS:
When I am trying to run apt-get install ./*.deb it is picking the .deb files in random (or maybe alphabetically) order.
So I did apt-get install ./jkl.deb ./xyz.deb ./abc.deb ./pqr.deb but still I am seeing that pqr.deb is Setting up first before abc.deb
Can someone let me know how can i install these four deb in specific order by single linux command ?
As far as I know, the installation of packages follows an alphabetical order along with dependencies. So, if you try to install package X and Y but they have A and B as dependencies, the installation order would be: A, B, X and Y.
In your case, you might have to use the following syntax:
apt install X && apt install Y
Try
apt-get install ./jkl.deb && apt-get install ./xyz.deb && apt-get install ./xyz.deb && apt-get install ./pqr.deb
*Put \n for new lines (so '\n' between each deb file)
list=$(echo -e "abc.deb\njkl.deb\npqr.deb\nxyz.deb")
for i in $list; do apt-get install ./$i; done
*or if you use gdebi
list=$(echo -e "abc.deb\njkl.deb\npqr.deb\nxyz.deb")
for i in $list; do sudo gdebi $i --n; done

How to install jpegrescan on Centos 6?

Id like to use jpegrescan on my Centos 6 linux install, both on its own and as part of Picopt.
Unfortunately I can't seem to get it work with either. The Picopt instructions just vaguely say it needs to be "in path" though I'm not sure where that is?
I've tried dropping in various places such as /usr/bin /usr/local/bin - but I don't get the jpegrescan command, and nor does picopt find it to use...
Can anyone advise?
After getting the jpegrescan Perl script and making it executable, you also need to install the File::Slurp Perl module like so:
yum install perl-File-Slurp
In Ubuntu, the command needed was:
apt-get -y install libfile-slurp-perl
So complete installation sequence in Ubuntu would be:
sudo apt-get -y install libfile-slurp-perl
sudo wget https://raw.githubusercontent.com/kud/jpegrescan/master/jpegrescan -O /usr/local/bin/jpegrescan
sudo chmod +x /usr/local/bin/jpegrescan

How do I build/install protobuf 2.4.1 on CentOs (or any LINUX/UNIX system)?

Ok, so I'm kind of a complete foreigner in the UNIX/LINUX land, but I need to install profbuf 2.4.1.
I was following the instructions by doing
wget http://protobuf.googlecode.com/files/protobuf-2.4.1.tar.bz2
tar xfj protobuf-2.4.1.tar.bz2
pushd protobuf-2.4.1
./configure
make
sudo make install
I could only go as far as ./configure'. WHen I tried runningmake`, I got some error saying "No target specified and no makefile found... Stop"
Does anyone know what I might've done wrong?
Thanks!!!
You probably don't have a g++ compiler in your system or your environment variable doesn't contain the path of it. To install one on linux use the following:
yum install gcc-c++
I had met the same question before, and now I've known the reason. It's lack of corresponding library. If you are using redhat, use root permission to enter the two lines of commands:
# yum install glibc-headers
# yum install gcc-c++
If you are using ubuntu,you can enter this:
# sudo apt-get install build-essential
I've solved my question by that way. Wish you luck!

Populate The Custom Yum Repository with list

I have a list of 350 rpms listed in a text file that are also installed in a cluster that is not online with the outside world. We have an internal yum repository. Is there a way to take the list, and download all the 350 installs for yum to bring back to the cluster? I hate thinking of downloading them one by one.
Thanks
reposync and making internal repos. (and then using kickstart) is better option, IMO.
But if you want to just download, then something as simple as:
yumdownloader $(cat myfile)
...might well do it. yumdownloader is in the yum-utils package. If you need to use yum/yum-downloadonly then you can do:
yum --installroot=/tmp/my-installroot --downloadonly install $(cat myfile)
...that will get you all the deps. too (not sure if that's what you want). If it doesn't fit on the command use yum shell:
perl -pe 's/^/install /' myfile > myfile-shell
echo run >> myfile-shell
yum --installroot=/tmp/my-installroot --downloadonly shell myfile
...but again, I think you really want to have usable repos. on your yum machines.
Try:
yum install `cat /path/to/pkgs_list`

Resources