# Is it possible to selectively install packages using pkg?



## ikevin8me (Nov 4, 2017)

The problem:

I installed PowerDNS and it installed PostgreSQL 9._something _client. It was successful and everything worked. (I don't actually need PostgreSQL with PowerDNS because I'm using bind zone files to configure my domains.)

Then, I installed PostgreSQL 10. PostgreSQL 10 worked, but it removed the previous Postgres9._something _*AND *PowerDNS! I didn't realize it until my DNS is failing... Upon investigation, the installation of PostgreSQL 10 caused the previous PostgreSQL9.something to be removed which at the same time removed PowerDNS because they were associated.

I now tried to re-install PowerDNS and got the following:


```
Installed packages to be REMOVED:
        postgresql10-client-10.0
        postgresql10-server-10.0_1

New packages to be INSTALLED:
        powerdns: 4.0.4_5
        postgresql95-client: 9.5.9
```

If I proceed, it will remove my PostgreSQL 10. So, how do I solve my problem?

I need to keep my PostgreSQL 10 - client and server - as it is.
I need to install just "powerdns: 4.0.4_5" without the "postgresql95-client: 9.5.9".

How can I do it?

Can I selective choose the package(s) using the pkg command?

Please advise. Thanks!


----------



## ShelLuser (Nov 4, 2017)

ikevin8me said:


> If I proceed, it will remove my PostgreSQL 10. So, how do I solve my problem?


By using the ports collection and building your software manually.

Binary packages use default values, and by default PowerDNS uses Postgres and PostgreSQL 9.5 is currently the system default. From /usr/ports/Mk/bsd.default-versions.mk:


```
# Possible values: 9.2, 9.3, 9.4, 9.5, 9.6
PGSQL_DEFAULT?=         9.5
```
Another issue is that you can't install 2 versions of some ports, notably MySQL and PostgreSQL, because they install binaries into the same location.

So the solution would be to build PowerDNS manually, and then configure it not to use PostgreSQL. I suppose you could choose MySQL or SQLite instead. After that you're free to install PostgreSQL 10 because it won't interfere with other versions anymore.

However...  always be careful with mixing ports and binary packages because that could cause a bit of a problem. Therefor my suggestion is to keep things as-is (PowerDNS and PSQL 9.5) and if you want to experiment with PSQL 10 simply grab the source code from their website and install it outside the package manager. For example in ~/psql/.

Hope this helps.


----------



## pavetheway91 (Nov 4, 2017)

You can run different versions inside jails.


----------

