apt: automatcally upgrade dependend on package while installing new version off package - apt

The situation is next:
We have package B and A(depends B). In repository we have next picture:
A
version table
0.0.1 (depends B=0.1.1)
0.0.2 (depends B=0.1.2)
0.0.3 (depends B=0.1.3)
B
version table
0.1.1
0.1.2
0.1.3
0.1.4
On server we have installed A=0.0.1.
Next time when we want to upgrade package A on the server, we don't want to upgrade package B manually (just run apt-get install A=0.0.2). With current configuration it doesn't seem like possible.
We tried next configuration:
instead of creation next version of B, we started to create new packages for each version, like B-1, B-2
A
version table
0.0.1 (depends B-1)
0.0.2 (depends B-2)
0.0.3 (depends B-3)
B-1
B-2 (provides B-1)
B-3 (provides B-2)
This configuration didn't work.
Is there any configuration which will work for our us?
Thanks

Necessary packages fields
./aa_0.0.1/debian/control
Package: aa
Depends: bb-1
./aa_0.0.2/debian/control
Package: aa
Depends: bb-2
./bb_0.1.1/debian/control
Package: bb-1
./bb_0.1.2/debian/control
Package: bb-2
Conflicts: bb-1
A script to build and test you packages using the local repository
#!/bin/bash
# Rebuild packages
d=`pwd`
repo_name=mydebs
mydebs=${d}/${repo_name}
list=/etc/apt/sources.list.d/${repo_name}.list
rm -rf {aa,bb}*.{build,deb,changes,dsc,tar.gz} $mydebs
for i in ${d}/{aa_0.0.1,aa_0.0.2,bb_0.1.1,bb_0.1.2}
do
cd $i
debuild -us -uc
rm -rf debian/{aa,bb-*,aa.*,bb.*} debian/files
done
cd $d
# Rebuild the repository
type dpkg-scanpackages >/dev/null 2>&1 || sudo apt-get install dpkg-dev
mkdir -p $mydebs
cp *.deb ${mydebs}/
cd $mydebs
dpkg-scanpackages --multiversion . /dev/null | gzip -9c > Packages.gz
echo "deb file:${mydebs} ./" | sudo tee $list
sudo apt-get update
# Return
cd $d
Testing
~debian_packaging$ sudo apt-get install aa=0.0.1-1
The following extra packages will be installed:
bb-1
The following NEW packages will be installed:
aa bb-1
0 upgraded, 2 newly installed and 0 to remove.
Setting up bb-1 (0.1.1-1) ...
Setting up aa (0.0.1-1) ...
​
~debian_packaging$ sudo apt-get install aa=0.0.2-1
The following extra packages will be installed:
bb-2
The following packages will be REMOVED:
bb-1
The following NEW packages will be installed:
bb-2
The following packages will be upgraded:
aa
1 upgraded, 1 newly installed and 1 to remove.
Removing bb-1 (0.1.1-1) ...
Setting up bb-2 (0.1.2-1) ...
Setting up aa (0.0.2-1) ...

Related

I got error Class "MongoDB\Driver\Manager" not found under docker

I try to install laravel 9 /mongodbsite under docker , based on
FROM php:8.1.6-apache
But running the app I got error:
Class "MongoDB\Driver\Manager" not found
Searching in net I found a possible decision as “php-mongo” package is not installed
But adding php-mongo in as :
RUN wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | apt-key add -
RUN echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-6.0.list
...
RUN apt-get install -y mongodb-org php-mongo
I got error :
E: Package 'php-mongo' has no installation candidate
I tried to use php-mongodb-all-dev, php8.1-mongodb, but got similar errors.
Which package and have I to install ?
Updated Part 1:
I modified Dockerfile.yml as :
FROM php:8.1.6-apache
RUN apt-get update && \
apt-get install --assume-yes --no-install-recommends --quiet \
curl \
wget \
gnupg
RUN wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | apt-key add -
RUN echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-6.0.list
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
RUN chmod +x /usr/local/bin/install-php-extensions \
&& install-php-extensions mongo
RUN apt-get update && \
apt-get install --assume-yes --no-install-recommends --quiet \
python \
apt-transport-https \
libfreetype6-dev \
But I got error :
docker-compose up -d --build
...
Reading package lists...
### INSTALLING REQUIRED PACKAGES ###
# Packages to be kept after installation:
# Packages to be used only for installation: libsasl2-dev libssl-dev
debconf: delaying package configuration, since apt-utils is not installed
(Reading database ... 14467 files and directories currently installed.)
Preparing to unpack .../libssl1.1_1.1.1n-0+deb11u3_amd64.deb ...
Unpacking libssl1.1:amd64 (1.1.1n-0+deb11u3) over (1.1.1n-0+deb11u2) ...
Setting up libssl1.1:amd64 (1.1.1n-0+deb11u3) ...
Selecting previously unselected package libsasl2-dev.
(Reading database ... 14467 files and directories currently installed.)
Preparing to unpack .../libsasl2-dev_2.1.27+dfsg-2.1+deb11u1_amd64.deb ...
Unpacking libsasl2-dev (2.1.27+dfsg-2.1+deb11u1) ...
Selecting previously unselected package libssl-dev:amd64.
Preparing to unpack .../libssl-dev_1.1.1n-0+deb11u3_amd64.deb ...
Unpacking libssl-dev:amd64 (1.1.1n-0+deb11u3) ...
Setting up libsasl2-dev (2.1.27+dfsg-2.1+deb11u1) ...
Setting up libssl-dev:amd64 (1.1.1n-0+deb11u3) ...
Processing triggers for libc-bin (2.31-13+deb11u3) ...
### INSTALLING REMOTE MODULE mongo ###
WARNING: "pecl/mongo" is deprecated in favor of "channel:///mongodb"
pecl/mongo requires PHP (version >= 5.3.0, version <= 5.99.99), installed version is 8.1.6
No valid packages found
install failed
ERROR: Service 'web' failed to build: The command '/bin/sh -c chmod +x /usr/local/bin/install-php-extensions && install-php-extensions mongo' returned a non-zero code: 1
Which format of the command is valid ?
Thanks in advance!
php-mongo is a PHP extension and the default PHP images for docker do not allow installing PHP extensions on then using apt-get.
You can try doing the following in your Dockerfile instead:
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
RUN chmod +x /usr/local/bin/install-php-extensions \
&& install-php-extensions mongodb
This is a more simplified approach than the official documentation.
More information on these images as well as the documentation to install extensions can be found in dockerhub
Information about docker-php-extension-installer can be found in Github

Clickhouse install on Ubuntu 16.04 failing

Much appreciated if someone tells me how to install on Ubuntu 16.04.
I've tried this:
Steps I took:
echo "deb http://repo.yandex.ru/clickhouse/trusty stable main" >> /etc/apt/sources.list
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv E0C56BD4 # optional
sudo apt-get update
sudo apt-get install clickhouse-client clickhouse-server-common
Errors:
root#c-2:~# sudo apt-get install clickhouse-client clickhouse-server-common
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
clickhouse-client : Depends: clickhouse-server-base (= 1.1.54245) but it is not going to be installed
clickhouse-server-common : Depends: clickhouse-server-base (= 1.1.54245) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
You need to use:
deb http://repo.yandex.ru/clickhouse/xenial stable main
Its literally in the line bellow where you copy pasted from in the docs:
For other Ubuntu versions, replace trusty to xenial or precise.
Version 16.x = xenial
... though it would be nice if they just renamed the paths to 12.x, 14.x and 16.x instead of using code names.
Do like this
echo "deb https://repo.yandex.ru/clickhouse/deb/stable main/" | sudo tee /etc/apt/sources.list.d/clickhouse.list
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv E0C56BD4
sudo apt-get update
sudo apt-get install clickhouse-client clickhouse-server
I use https which is working. http not working in deb

Maven install fails on ubuntu due to broken packages

I am trying to install maven but getting error for broken packages. I tried with -f switch too but it did not helped.
simon#simon-pc:~$ sudo apt-get install -f maven
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
maven : Depends: libaether-java but it is not going to be installed
Depends: libplexus-containers1.5-java but it is not going to be installed
Depends: libsisu-ioc-java but it is not going to be installed
Depends: libwagon-java but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
Try the following commands:
#sudo apt-get remove maven2
sudo add-apt-repository "deb http://ppa.launchpad.net/natecarlson/maven3/ubuntu precise main"
sudo apt-get update
sudo apt-get install maven3
If you encounter this:
The program 'mvn' can be found in the following packages:
maven
maven2
Try sudo apt-get install {selected-package}
#Just add those lines in /etc/profile
export M2_HOME=/usr/share/maven3
export M2=$M2_HOME/bin
export PATH=$M2:$PATH

Installing Java 8 on cloud9

I'm trying to install java 8 on cloud9 through the webupd8 PPA. So I'm adding the repository
sudo add-apt-repository ppa:webupd8team/java
Next I do the update and finally when I run the command
sudo apt-get install oracle-java8-installer
I get the error
E: Unable to locate package oracle-java8-installer
Any ideas how can I get through that and istall java 8 on cloud9?
As noted by christophetd, I completed the following steps and everything installed without issue:
$ sudo vim /etc/apt/sources.list
Add the following lines of code to the file:
deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main
deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main
$ sudo apt-get update
$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get install oracle-java8-installer
$ java -version
java version "1.8.0_101"
Add the two following lines to your file /etc/apt/sources.list (which you can create if it does not exist)
deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main
deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main
Then run sudo apt-get update, and you should be able to install oracle-java8-installer.
This basically does the add-apt-repository manually. I suspect the issue is due to the fact that the default source files /etc/apt/sources.list.d/* are mounted as read-only (see for instance this topic on Cloud9 community)

How to install g++ 4.9 on Debian Wheezy armel?

My Debian 7 armel embedded system currently has g++ 4.6, and I'd like to upgrade to g++ 4.9 to use new C++11 features. How do I do that?
My current sources.list contents is:
deb http://security.debian.org/ wheezy/updates main
deb-src http://security.debian.org/ wheezy/updates main
deb http://ftp.us.debian.org/debian wheezy main non-free
deb-src http://ftp.us.debian.org/debian wheezy main non-free
A simple apt-get install of the package does not work:
root#arm:~# apt-get install g++-4.9
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package g++-4.9
E: Couldn't find any package by regex 'g++-4.9'
Another workaround could be to install the g++ 4.9 packages from "Jessie", according to this blog post. Briefly, you would have to tell APT to use the Jessie repos while you are installing the new G++. First bring the current Wheezy up-to-date:
sudo apt-get update
sudo apt-get upgrade
Then do a backup :-) and edit /etc/apt/sources.list so that you replace the string "wheezy" with "jessie":
sudo cp /etc/apt/sources.list /etc/apt/sources.list.WHEEZY
sudo vi /etc/apt/sources.list
Now update the package list and install the 4.9 version of GCC/G++:
sudo apt-get update
sudo apt-get install gcc-4.9 g++-4.9
After this revert to the "original" package list:
sudo cp /etc/apt/sources.list.WHEEZY /etc/apt/sources.list
sudo apt-get update
This leaves the original GCC,G++ in place. If you wish to compile with the 4.9 version, then either set the CC and CXX env vars accordingly or invoke the compilers as gcc-4.9 or g++-4.9 explicitly.
Probably-required: packaging-dev, ubuntu-dev-tools
Set up pbuilder
(this lets you build a package in a chroot without polluting your system with build-dependency packages)
sudo pbuilder create
if you want to build for a specific distribution, (pbuilder uses the build system release in a chroot) you can use pbuilder-dist [precise/oneric/trusy/etc...] create
Get debian source
pull-debian-source gcc-4.9 [4.9.0-6]
specific debian revision is optional, but can be useful if you want to pull experimental/unstable/testing/stable revisions
you can also pull from specific ubuntu distros by adding them to sources.list as a deb-src and using sudo apt-get src
Build Package
sudo pbuilder build gcc-4.9_4.9.0-6.dsc
In the files downloaded there is a .dsc file, for the most recent gcc it is gcc-4.9_4.9.0-6.dsc which is a package descriptor file. .orig.tar.[gz/xz] is the source tarball.
Create local Apt-repository
mkdir /convenient/place/for/repo
cp /var/cache/pbuilder/result/* /path/to/repo
cd /path/to/repo
apt-ftp archive packages . > Packages
sudo echo "deb [trusted=yes] file:/local/repo/Packages ./" > /etc/apt/sources.list.d/gcc-repo.list`
Note you can also do this step with .debs downloaded from anywhere (skip step 1-3)
Install
apt-get update; apt-get install gcc-4.9 g++-4.9
Instead of using the jessie packages, it would be better to check to see if it's been back-ported to wheezy. Add this to your /etc/apt/sources.list:
deb http://http.debian.net/debian wheezy-backports main
and do an apt-get update and see if you can install it then.
There is a gcc-4.9-backport now.
sudo apt-get update && sudo apt-get install gcc-4.9-backport

Resources