DaemonForums  

Go Back   DaemonForums > FreeBSD > FreeBSD Ports and Packages

FreeBSD Ports and Packages Installation and upgrading of ports and packages on FreeBSD.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 13th July 2008
disappearedng disappearedng is offline
Shell Scout
 
Join Date: May 2008
Posts: 128
Default Why ports?

Hi
everyone I have been using freebsd for about a month now and I have the following questions:

1) Why ports? It often takes such a long time to compile these packages and to install it. For example, it took me like an hour to compile azureus and mozilla. Why then is this preferred?

2) What controls the network service in FreeBSD? I tried to back up everything I have on my laptop, and I used scp. Whenever it uploads after a certain amount of time, my freebsd 's internet connection gets completely cut off. How do I diagnose this problem?
Reply With Quote
  #2   (View Single Post)  
Old 13th July 2008
graudeejs's Avatar
graudeejs graudeejs is offline
Real Name: Aldis Berjoza
ISO Quartermaster
 
Join Date: Jul 2008
Location: Riga, Latvia
Posts: 589
Default

1) you can use pkg_add, to add packages (there are many available, but not all), however, when packages aren't available (and they are outdated), you can use ports
When using ports you can chose which components you want to include.... also ports might be optimized for your machine


to back up i'd use dump -0Lauf /output/file /dev/device to backup
or dump -0Lauf - /dev/device to backup | bzip2 > /output/file.bz2
if you want to compress it...

Last edited by graudeejs; 13th July 2008 at 09:00 PM.
Reply With Quote
  #3   (View Single Post)  
Old 13th July 2008
scottro's Avatar
scottro scottro is offline
Real Name: Scott Robbins
ISO Quartermaster
 
Join Date: Apr 2008
Location: NYC
Posts: 662
Default

To elaborate a little more on ports--they sometimes have a newer version than does the package. Plus they allow more flexibility in configuration.

It's a bit of a trade off, but most of the time, not really a noticeable one.

However, there are over 16,000 ports and not all have packages, especially for say, CURRENT. There are ports vs. packages threads all over, including, I believe, in the handbook. For mozilla, for example, with its long compile time especially when the chances are that you won't be customizing the installation, packages are almost certainly the better choice.
Reply With Quote
  #4   (View Single Post)  
Old 14th July 2008
cajunman4life cajunman4life is offline
Real Name: Aaron Graves
Package Pilot
 
Join Date: May 2008
Location: Coolidge, Arizona
Posts: 203
Default

Quote:
Originally Posted by scottro View Post
...there are over 16,000 ports...
There are over 18,000

http://www.freebsd.org/ports/
__________________
I just saved a bunch of money on my car insurance by fleeing the scene of the accident!
Reply With Quote
  #5   (View Single Post)  
Old 14th July 2008
disappearedng disappearedng is offline
Shell Scout
 
Join Date: May 2008
Posts: 128
Default

But how does that provide benefits from the user's point of view? Linux has repositories which they can download precompiled binaries.

FreeBSD allows you to compile from scratch. What is the advantages to this???
(Aside from optimization; if it is a huge factor, how much more optimized can it be?)
Reply With Quote
  #6   (View Single Post)  
Old 14th July 2008
Carpetsmoker's Avatar
Carpetsmoker Carpetsmoker is offline
Real Name: Martin Tournoij
Tcpdump Spy
 
Join Date: Apr 2008
Location: Ireland
Posts: 2,245
Default

From the FreeBSD handbook, chapter 4.2:

Package Benefits
  • A compressed package tarball is typically smaller than the compressed tarball containing the source code for the application.
  • Packages do not require any additional compilation. For large applications, such as Mozilla, KDE, or GNOME this can be important, particularly if you are on a slow system.
  • Packages do not require any understanding of the process involved in compiling software on FreeBSD.

Ports Benefits
  • Packages are normally compiled with conservative options, because they have to run on the maximum number of systems. By installing from the port, you can tweak the compilation options to (for example) generate code that is specific to a Pentium 4 or Athlon processor.
  • Some applications have compile-time options relating to what they can and cannot do. For example, Apache can be configured with a wide variety of different built-in options. By building from the port you do not have to accept the default options, and can set them yourself.
  • In some cases, multiple packages will exist for the same application to specify certain settings. For example, Ghostscript is available as a ghostscript package and a ghostscript-nox11 package, depending on whether or not you have installed an X11 server. This sort of rough tweaking is possible with packages, but rapidly becomes impossible if an application has more than one or two different compile-time options.
  • The licensing conditions of some software distributions forbid binary distribution. They must be distributed as source code.
  • Some people do not trust binary distributions. At least with source code, you can (in theory) read through it and look for potential problems yourself.
  • If you have local patches, you will need the source in order to apply them.
  • Some people like having code around, so they can read it if they get bored, hack it, borrow from it (license permitting, of course), and so on.
Reply With Quote
  #7   (View Single Post)  
Old 14th July 2008
Weaseal's Avatar
Weaseal Weaseal is offline
Package Pilot
 
Join Date: May 2008
Location: East Coast, US
Posts: 177
Default

Quote:
Originally Posted by disappearedng View Post
But how does that provide benefits from the user's point of view? Linux has repositories which they can download precompiled binaries.

FreeBSD allows you to compile from scratch. What is the advantages to this???
(Aside from optimization; if it is a huge factor, how much more optimized can it be?)
Actually, to my knowledge, all linux distributions are either binary packages or compilable packages, but almost never (for example, Gentoo is all source, where Debian is all binary). Actually, Arch linux has both a binary and source option, but I find their package system extremely immature (lots of broken dependencies, and poor management tools).

FreeBSD offers you both choices, and leaves it up to you. Packages = binary, ports = source.

If you need compile-time optimizations and/or customizations, use ports. Maybe you need an application to rely on PostgreSQL instead of MySQL, but the package is compiled against MySQL! Use ports there. In a binary-only linux distribution, you'd be out of luck, and forced to compile your own, outside of any package management.

Know that all packages you download are actually just pre-compiled versions of the exact same things in your ports tree. Try it yourself:
cd /usr/ports/category/port && make package
__________________
FreeBSD addict since 4.2-RELEASE.
My FreeBSD wiki.
Reply With Quote
  #8   (View Single Post)  
Old 14th July 2008
TerryP's Avatar
TerryP TerryP is offline
Arp Constable
 
Join Date: May 2008
Location: USofA
Posts: 1,547
Default

I think Carpetsmoker said it best hehe.


Simply put, packages are created from ports, binaries are created from source code, and you can't really modify binaries very well !!!


One of the things I love most about ports is the possibility to build packages with the desired build options on one machine then nfs or sftp them over to other systems to be installed that also need them :-)
__________________
My Journal

Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''.
Reply With Quote
  #9   (View Single Post)  
Old 14th July 2008
mousesack's Avatar
mousesack mousesack is offline
Port Guard
 
Join Date: May 2008
Posts: 18
Default

Quote:
Originally Posted by TerryP View Post
One of the things I love most about ports is the possibility to build packages with the desired build options on one machine then nfs or sftp them over to other systems to be installed that also need them :-)
First post eh, consider me a lurker of sorts.

Anyway, reading your post TerryP made me ask a question related to the original point in ways. I understand you compile from source on one machine and make those build packages of some use on another machine etc.

As I've seen myself building everything from Ports with basic Make.conf optimizations, would you or, anyone reading, happen to have any tips or tricks on compiling on one machine and using them later on or on a another machine?
Reply With Quote
Old 14th July 2008
TerryP's Avatar
TerryP TerryP is offline
Arp Constable
 
Join Date: May 2008
Location: USofA
Posts: 1,547
Default

the easiest way is to make a package with what ever build options you need.


When you do a 'make package' or 'make package-recursive' in a ports directory (e.g. /usr/ports/x11-wm/blackbox) and use the environment variables out lined in ports(7) to control their placement.


Generally if you create /usr/ports/packages/ they will go there by default; last time I needed to make packages.

A nice trick is to mount the build machines /usr/ports/packages/All/ on the target system over nfs and pkg_add them.



When it comes to deploying them on another PC, you have to watch the optimizations and build options to make sure it will work. For example, if your system is set to generate code that will only execute on an i686 CPU and you need to get the package installed on a system running an i586 you've got to rebuild the package for it.


That's why the GENERIC kernel configuration has 'cpu I486_CPU', cpu I586_CPU', and 'cpu I686_CPU'. The Intel 80486 is basically the lcd, even though most users would hopefully have newer chips even in older serves... (I've bumped into a few netizens with 486/pentium pro servers).


What kind of stuff do you have in make.conf and whats the difference between the build and target machines?
__________________
My Journal

Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''.
Reply With Quote
Old 15th July 2008
windependence's Avatar
windependence windependence is offline
Real Name: Tim
Shell Scout
 
Join Date: May 2008
Location: Phoenix, Arizona
Posts: 116
Default

My experience with packages on FreeBSD has been dismal at best, but on OpenBSD it is stellar. I do really like the ports way of doing things in FBSD. I can see a large difference in performance on my Apache servers and more so on my MySQL servers. IMHO, on FBSD use ports, and on OpenBSD use packages. Of course, YMMV.

-Tim
__________________
www.windependence.org
Get your Windependence today!
Reply With Quote
Old 15th July 2008
tanked tanked is offline
Fdisk Soldier
 
Join Date: May 2008
Posts: 56
Default

I believe the FreeBSD team are working on better package tools but yes, I agree the pkg system on FreeBSD is pretty crappy and ports are by far the more preferred option.
Reply With Quote
Old 15th July 2008
phoenix's Avatar
phoenix phoenix is offline
Risen from the ashes
 
Join Date: May 2008
Posts: 696
Default

Personally, I find packages better suited for getting a system up and running right away (just a bunch of # pkg_add -r commands), but ports are better for keeping a system up-to-date and only using/installing/running the bits you want.

To get the best of both worlds, configure a build system where you use the ports tree to build packages, and then use the pkg_* tools on the target system to install them. That way, you don't even need a compiler toolchain or ports tree on your in-use systems.
__________________
Freddie

Help for FreeBSD: Handbook, FAQ, man pages, mailing lists.
Reply With Quote
Old 20th July 2008
mousesack's Avatar
mousesack mousesack is offline
Port Guard
 
Join Date: May 2008
Posts: 18
Default

Quote:
Originally Posted by TerryP View Post
What kind of stuff do you have in make.conf and whats the difference between the build and target machines?
Oh, I'm late to this thread. Anyway, thanks for the advice.

I would just say that basically as I'm still young and all, I tend to break things over and over again giving myself good "build & .conf -weekends" with freebsd... Time to time that starts to get a bit repetitive, and usually it ends with my face on the keyboard...

So that obviously means, I would use the packages usually on a single i686 machine...
Reply With Quote
Old 20th July 2008
TerryP's Avatar
TerryP TerryP is offline
Arp Constable
 
Join Date: May 2008
Location: USofA
Posts: 1,547
Default

Breaking and having to fix stuff is usually a good way to learn ;-)

Keyboards probably make worse pillows then laptops..... hehe
__________________
My Journal

Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
packages vs ports zelut FreeBSD Ports and Packages 17 28th October 2009 08:19 AM
Broken ports in /usr/ports/x11 DNAeon FreeBSD Ports and Packages 3 5th July 2009 08:20 PM
How do you update ports? disappearedng FreeBSD General 6 8th November 2008 05:59 AM
no /usr/ports or /usr/src/ports ?? ukulele OpenBSD Installation and Upgrading 3 27th July 2008 09:50 PM
Install ports from cd? xCipherx OpenBSD Packages and Ports 5 2nd June 2008 06:35 PM


All times are GMT. The time now is 03:33 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick