问题
Running sudo pkg install mongodb
produces an error stating that no such package exists. I figured this is because it says on this website https://www.freshports.org/databases/mongodb/ that the MongoDB port has expired and has been removed. How do I get a version of MongoDB on my FreeBSD server now?
回答1:
I recommend that every time you want to install a package you perform a pkg search
pkg search packagename
For MongoDB:
root@demo:/ # pkg search mongodb
mongodb32-3.2.11_2 Distributed document-oriented "NoSQL" database
mongodb32-tools-3.2.11 Tools for MongoDB
mongodb34-3.4.16 Distributed document-oriented "NoSQL" database
mongodb34-tools-3.4.9 Tools for MongoDB
mongodb36-3.6.6_2 Distributed document-oriented "NoSQL" database
mongodb36-tools-3.6.3 Tools for MongoDB
p5-Mojolicious-Plugin-Mongodb-1.16_1 Use MongoDB in Mojolicious
p5-MongoDB-2.0.1 Mongo Driver for Perl
php56-pecl-mongodb-1.5.2 PECL classes for MongoDB
php70-pecl-mongodb-1.5.2 PECL classes for MongoDB
php71-pecl-mongodb-1.5.2 PECL classes for MongoDB
php72-pecl-mongodb-1.5.2 PECL classes for MongoDB
py27-mtools-mongodb-1.2.3_2 Setup test environments; parse, filter and visualize MongoDB log files
py27-nagios-check_mongodb-0.1 Nagios plugin to check mongodb server
As you can see there are mongodb32, mongodb34 and mongodb36 You can then perform the following:
pkg install mongodb36-3.6.6_2
You could also install packages from ports but it's more time consuming and in the most cases is not necessary, unless you want to enable custom flags/modules to your mongodb installation.
https://www.freebsd.org/doc/handbook/ports-using.html
回答2:
There is a note on the website you linked to that the MongoDB port was moved to databases/mongodb34.
Chapter 4.4. Using pkg for Binary Package Management of the FreeBSD Handbook might help you to deal with the situation you describe (especially 4.4.9. Modifying Package Metadata).
I am not sure, however, if there is an easy update path. I've never tried it.
来源:https://stackoverflow.com/questions/53214130/how-do-i-install-mongodb-on-freedsb-if-the-port-was-apparently-removed