# Portmanager Questions



## Oak (Dec 31, 2011)

Hello everyone, 

I am a beginner so please bear with me. 

I recently installed FreeBSD on an older machine of mine. My goal with this machine is to learn how to run and admin a secure server, so I didn't want that many programs added with the initial install. My plan was to just add programs (packages?) as I needed them.

First thing I did was *freebsd-update*, and I added a crontab entry to have it done nightly.

I did some more searching online and saw a recommendation to update my ports. 

I installed portmanager, and then did *portsnap fetch extract*. I then did *portmanager -u* to update all my installed ports.

Now I'm not sure if I did something wrong here but it seems like I just installed all kinds of things that I didn't have and didn't want.

Were all these ports originally on my system and I just updated all of them? Or did I get _all_ the available FreeBSD ports by doing *portsnap fetch extract*?

Regardless, how do I go about trimming the fat off my system and getting rid of all these things that I don't want or need? I definitely don't want X11, or any of the foreign language manuals/docs. Only things I really want besides the necessary basics are SSHD, and the C/Python programming languages.

Thanks for your time guys, and lesson learned for me, I wont ever type anything into my console that I don't really understand. 

ï¿½e


----------



## SNK (Dec 31, 2011)

portsnap(8) puts a skeleton (Makefile, description) of all available ports on your system and keeps it up-to-date. So it indeed has to extract 23k directories plus contents.

First
`# portsnap fetch extract`
and subsequently
`# portsnap fetch update`

You might want to use ports-mgmt/portmaster instead of ports-mgmt/portupgrade, together with the following script: http://forums.freebsd.org/showpost.php?p=39092&postcount=37. It requires ports-mgmt/portaudit, which seems useful for you.

To install/update a port, e.g.:
`# whereis wget`
`# portmaster -dbvgP ftp/wget`
See portmaster(8) for the switches.

You may not need to run freebsd-update(8) every night. Subscribe to freebsd-security-notifications (http://lists.freebsd.org/mailman/listinfo/freebsd-security-notifications) to see when you need to update.


----------



## Oak (Jan 1, 2012)

Thank you SNK! 

I will use portmaster from now on for single files along with portaudit. Once I get a grip on things I will try to crontab that script you linked.

Is there any way I can get rid of all these extra ports that were downloaded to my machine that I will most likely never use? Is there some kind of script I can use that will help me clean up, or do I have to go through them one by one?


----------



## wblock@ (Jan 1, 2012)

The "new" ports may have just been updated dependencies.  The documentation is a port, misc/freebsd-doc-all which can be deinstalled.  portmaster(8) has an option to remove ports which are no longer depended on, but ports-mgmt/pkg_cutleaves is more versatile.  There's also just pkg_delete(1), which is what these utilities use behind the scenes and can be used manually.  It will not delete a package that something else is depending on, and will list those other packages.  There may be options that can be set with make config to disable a port's dependency on something you want to remove.


----------



## Oak (Jan 1, 2012)

Thank you wblock! Cutleaves is working out great.


----------



## Oak (Jan 1, 2012)

I can't find a way to edit my last post so...

Happy new year everyone! Thank you for all the help!


----------

