PC-BSD Forums

PC-BSD Forums (http://forums.pcbsd.org/index.php)
-   Guides (http://forums.pcbsd.org/forumdisplay.php?f=34)
-   -   Installing apps from ports using PCBSD 7.1 / Vanilla FreeBSD (http://forums.pcbsd.org/showthread.php?t=12254)

graedus 06-03-2009 02:28 AM

Installing apps from ports using PCBSD 7.1 / Vanilla FreeBSD
 
This procedure works for PCBSD 7.1 "Galileo".
If you wish to use this procedure in FreeBSD or a previous version of PCBSD, ignore all instances of "runports".


First of all, understand how ports and packages work by first reading the FreeBSD handbook's Chapter 4 on Ports


*** ATTENTION: Vanilla FreeBSD users skip this section until further notice! ***


Second, understand that PCBSD is tweaked and hacked to the bone, and, even though you might be savvy and seasoned enough with FreeBSD, you might break it if you mess with the base system. In the same line, understand that KDE is an essential part of PCBSD and PBI's and that you can't strip it away without breaking all PCBSD functionality (you can install other desktop environments alongside and still get less than full functionality). I totally ignore and doubt if there is any kind of documentation or even if it is possible to convert a vanilla FreeBSD installation into PCBSD. And one last thing on this respect, I'm completely certain that you can't upgrade any FreeBSD-6-based PCBSD system (such as 1.4 or 1.5) into PCBSD 7 by upgrading the underlying FreeBSD system using by making buildworld from cvsup'd source or freebsd-update.

Third, read (the still a bit lacking) PCBSD's User Handbook section on Changing the LOCALBASE to understand how PCBSD treats ports.

*** ATTENTION: Vanilla FreeBSD users RESUME reading from this point forward ***

Now, onto business:

- I highly recommend you install the ports-mgmt/portupgrade suit of tools. The procedures I explain mostly deal with it. I also, prefer packages over ports whenever necessary, to avoid compile time. Most of the computers I deal with don't have enough muscle to compile very large ports in a short time.

- There is no reliable ports-gui available. Even the BPM frontend is lacking in information as a reference source. For reference purposes, consult the Freshports Database http://www.freshports.org/

0. Open Konsole or other terminal emulator, get root credentials and switch LOCALBASE. You do this the quick way by:

Alt+F2, type "Konsole" press enter.
In Konsole run the following commands
Code:

su
runports

Make sure you do this procedure before managing ports!
The command prompt will be a # if root. If it's > , then you invoked it as a normal user. Exit, su, and runports once again.

1/A. If you didn't add the ports tree at the installation time, run the following command:
Code:

portsnap fetch extract
You can do this too with csup, but IMHO portsnap is easier to use.

1/B. If you already have the ports tree in place, update it before installing new ports:
Code:

portsnap fetch update
2. In order to install a port from scratch, change directory to that port's sourcedir. The location is /usr/ports/{ports-category}/{port-name}. You can obtain this information from freshports. You can find other ways to search for ports using the command line at this link in the FreeBSD Handbook. I find useful having /usr/ports/ as a working directory, you can pretty much complete the names of the ports with the directory hierarchy or ls * with the help of the tab button.

I'll use as an example for this ports-mgmt/portupgrade, which by the way is a tool that I'll keep making reference, so it's a good idea to install it right away.

Code:

cd /usr/ports/ports-mgmt/portupgrade && make install clean
At this time, the system will download all files necessary and install all dependencies for this application before adding the application itself.

This will take a few minutes, and some compiling will be done. Be patient. It is important to at least have this application installed from source using the latest ports.

3. Once you have portupgrade installed, you can proceed and easily install any other application in ports.

In a nutshell, what I suggest to do is the following:

- First, attempt to fetch the latest binary packages.

- If some dependency fails to be fetched, then force to fetch the available binary packages in the whole dependency chain (even if not the latest).

- If still some dependencies couldn't be fetched as binary packages, compile just those needed.

- This procedure tries to avoid adding "building" dependencies (those required to compile the port), since portinstall -F will fetch those anyway.

3/A. To fetch the latest binary packages, run:
Code:

pkg_fetch -R port-category/port-name
If you receive no failed packages list, you're good to install straight away to 3/C with no issues, if not, check 3/B

3/B If you do receive a list of failed packages it means the latest version is not available as a package. Force fetch a not so new version of those dependencies:

Code:

portinstall -fFPPk port-category/port-name
Using the -PP will force to download packages only, -k will skip those failed dependencies, and -f will force the download of a previous version as necessary.

3/C. After fetching all binary packages from the internet, go ahead and install the application (You can do this offline). The name of the tarball appears on the output of either pkg_fetch or portinstall.
Code:

pkg_add /usr/ports/packages/All/portname-version.tbz
rehash
pkgdb -u

For your convenience, if using csh or similar shell, you can type part of the package name and complete it using the tab button.

If still some fetching failed, execute portinstall. It will compile just the missing ports.
Code:

portinstall -P port-category/port-name
I wish pkg_fetch, portinstall and portupgrade behaved this way automatically.


Some final notes:

0. This procedure works, and will be foolproof most of the time. I've lost a lot of time in the past installing and updating ports so I know pretty much what I'm doing. If this procedure looks long or tedious to you, you're free to do otherwise and learn the hard way of your mistakes. My advice is to follow these suggestions, this is the shortest path I've found to get ports going. If you have any ideas on how make this procedure easier, shorter, and foolproof, please don't hesitate and let me know.

*** ATTENTION: Vanilla FreeBSD users, the guide ends here, PCBSD specifics follow ***

1. Don't try to install desktop environments such as gnome or windowmaker using runports. Those won't work (at least not with full pcbsd functionality and without further tweaking things). Stick with the PBI's, or try to modify the PCBSD base at your own risk of breaking it up.

2. I wished there would be a special instance of the run window (alt+f2, perhaps meta+alt+f2, which would allow to run commands with a switched LOCALBASE (equivalent of executing runports and the application name).

3. In order to run an application (either command line based or with graphical user interface), you must do it from the command line. If it has a graphical user interface, you must do it from a terminal emulator (such as Konsole) within a graphical desktop environment (such as KDE, the default DE that appears when you login to PCBSD normally).

So, open up Konsole, and type the following command
Code:

runports
the following message will appear:
Code:

Running as user "user". You may now run programs in the FreeBSD Ports tree
The prompt will change to a ">"

Once this is achieved, type the name of the port you wish to run. For example, portinstall is an application installed from ports, and was executed using this premise. If editors/emacs or sysutils/rename was installed, then by typing "emacs" or "rename", the respective application will be executed.

Note: Do not try and execute a graphical application as root using this procedure, since it will fail to run.

Here's why: Since you logged in as a user using a graphical desktop environment, a graphic server was already started, in this case it's called x.org. If you try to execute a graphical application as root, root will try to start x.org by its own, but since FreeBSD can only have one instance of x.org running, it will fail to start the graphical server, ergo the application won't start. No, you can't initially login as root, this is disabled by default, and I suggest you not to tweak the system to be able to do that.


Instead, to run a graphical application as root, press alt+f2 and type:
Code:

kdesu application-name
Common application names you might wish to run are the editor "kwrite" and the file manager "konqueror".

- EDIT: I updated this procedure.

graedus 10-01-2009 08:33 PM

Re: Installing apps from ports using PCBSD 7.1 / Vanilla FreeBSD
 
Bump. I've CORRECTLY sorted and updated the procedure. Applies to Vanilla FreeBSD as well.

TerryP 10-21-2009 04:34 AM

Re: Installing apps from ports using PCBSD 7.1 / Vanilla FreeBSD
 
If you don't mind, I think I might move this to a sticky in Guides

graedus 10-21-2009 04:38 AM

Re: Installing apps from ports using PCBSD 7.1 / Vanilla FreeBSD
 
Please, be my guest.

TerryP 10-21-2009 04:40 AM

Re: Installing apps from ports using PCBSD 7.1 / Vanilla FreeBSD
 
done

helix 01-30-2014 09:54 PM

This thread too old to be sticky?
 
I think this post should be "de-stickiyed" <- not sure if this word exists (meaning opposite from sticky), because with new versions of PCBSD, these instructions can be kind of misleading (considering most of the stuff nowdays install from console with pkg command)

DJ9 01-31-2014 01:45 AM

Done. Thanks for the pointer.


All times are GMT. The time now is 11:18 AM.

Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.


Copyright 2005-2010, The PC-BSD Project. PC-BSD and the PC-BSD logo are registered trademarks of iXsystems.
All other content is freely available for sharing under the terms of the Creative Commons Attribution License.