Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Install software in /opt
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
rapelotus
n00b
n00b


Joined: 12 Sep 2014
Posts: 21
Location: 中国江苏

PostPosted: Fri Jan 23, 2015 11:33 am    Post subject: Install software in /opt Reply with quote

Do many packages reinstall themselves again in /opt when I want to install software in /opt ?
I note that when I want to install stardict in /opt, many system packages like bzip2 install it again in /opt. But I am not quite sure about it.
Does it mean that when I want to install some packages in /opt, there should be a complete environment that can compile other packages in /opt ?


Last edited by rapelotus on Fri Mar 20, 2015 11:12 am; edited 2 times in total
Back to top
View user's profile Send private message
lexflex
Guru
Guru


Joined: 05 Mar 2006
Posts: 363
Location: the Netherlands

PostPosted: Fri Jan 23, 2015 11:59 am    Post subject: Re: Install software in /opt Reply with quote

Hi, Rapelotus,

That should not be the case, bzip should install itself to its default directory i would guess...
(no matter where other software is installed to).

Do you install some packages manually, or what is it that you want to do?
How do you install stardict to /opt ?

alex
Back to top
View user's profile Send private message
rapelotus
n00b
n00b


Joined: 12 Sep 2014
Posts: 21
Location: 中国江苏

PostPosted: Fri Jan 23, 2015 1:12 pm    Post subject: Reply with quote

@lexflex
I didn't install any package manually, they were all installed by emerge.
In fact, I want to seperate from the base system and desktop. I want to install my base system into /usr and desktop environment into /opt. So, I took the stardict as a experiment. But when I did it, I found it would emerge 168 packages as depencencies to install stardict.
The command that I use to install stardict:
Code:
sudo emerge --prefix=/opt stardict
Back to top
View user's profile Send private message
lexflex
Guru
Guru


Joined: 05 Mar 2006
Posts: 363
Location: the Netherlands

PostPosted: Fri Jan 23, 2015 2:25 pm    Post subject: Reply with quote

rapelotus wrote:
@lexflex
I didn't install any package manually, they were all installed by emerge.
In fact, I want to seperate from the base system and desktop. I want to install my base system into /usr and desktop environment into /opt.
The command that I use to install stardict:
Code:
sudo emerge --prefix=/opt stardict


Yes, this would probably install all those packages in /opt.

You can use --onlydeps first ( without the --prefix) so the dependencies get installed in their 'regular' place.

So , basically, you should choose what you consider to be your 'base system' , and install that packages without --prefix, and then install those packages that you consider to belong to your DE, and use --prefix=/opt for that.
In many cases the line between 'base' and 'desktop' will be fairly arbitrary (unless you keep the base very clean, in which case all the other stuff should go to /opt in your plan....

Is there something specific that you try to achieve by putting the 'de'-related packages in /opt ?

Alex.
Back to top
View user's profile Send private message
rapelotus
n00b
n00b


Joined: 12 Sep 2014
Posts: 21
Location: 中国江苏

PostPosted: Sat Jan 24, 2015 1:24 am    Post subject: Reply with quote

@lexflex
First of all, thank you for your patience for answering my questions. It's really kind of you, Alex.
The purpose that I try to put the 'de'-related packages in /opt is because I think it will make my system more robust and stable. For example, if there is any problem with my DE, I think it would not affect my base system. If this is the case, it would not cause the entire system to collapse because of the problem with DE. Afterall, it may just be my personal view.

It seems your solution doesn't work for me. For instance, now I have installed lxde-meta in /usr, then all of its dependencies should have been installed in their 'regular' place. But when I try to install it in /opt using command
Code:
emerge -pv --prefix=/opt lxde-meta
, it hints me there are 258 new packages. But many packages such as sys-auth/consolekit, sys-fs/udisks, app-arch/xz-utils have installed in /usr. It seems there is another entire system to be installed in /opt and I am very confused about it.

Best Wishes!
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Sat Jan 24, 2015 2:37 am    Post subject: Reply with quote

rapelotus wrote:
The purpose that I try to put the 'de'-related packages in /opt is because I think it will make my system more robust and stable. For example, if there is any problem with my DE, I think it would not affect my base system. If this is the case, it would not cause the entire system to collapse because of the problem with DE. Afterall, it may just be my personal view.

rapelotus ... you are mistaken, the Filesystem Hierarchy Standard assigns /opt to "optional application software packages", there is very little installed there generally, those packages that are are often those things that are bundled together and splitting the various files across the filesystem is either difficult, or no logical place exists for them.

There is no robustness and/or stability that can come from its use, if anything your system will become more fragile as /opt isn't in standard paths ... so things like bzip2 will not be found, or if something is looking to link against libbz2.so.1 it won't be found (at least without changes to the build system and/or ldconfig). Also, your reasoning for the separation seems to overlook how your DE (or what-have-you) would cause damage to files installed via the package manager, the package manager is working to maintain all components of the system and keeping track of things, maintaining the separation between one package and another. You complicating things needlessly if you start installing @system packages in non-standard parts of the filesystem.

Linux isn't like other non-unix OSes ... things are generally installed in a certain place, following a certain logic. Things are grouped by what kind of function they serve, so libraries in /lib, /usr/lib, and (perhaps) /usr/local/lib. Similarly, header files are in /usr/include, and (perhaps) /usr/local/include, binaries in /bin, /usr/bin, and (perhaps) /usr/local/bin ... you should be able to see a pattern, because it follows a certain logic. Generally, there isn't a /opt/bin or /opt/lib or /opt/include ... as there really isn't a need of them (/usr/local/{bin,lib,include} exists for such a contingency).

rapelotus wrote:
It seems your solution doesn't work for me. For instance, now I have installed lxde-meta in /usr, then all of its dependencies should have been installed in their 'regular' place. But when I try to install it in /opt using command
Code:
emerge -pv --prefix=/opt lxde-meta
, it hints me there are 258 new packages. But many packages such as sys-auth/consolekit, sys-fs/udisks, app-arch/xz-utils have installed in /usr. It seems there is another entire system to be installed in /opt and I am very confused about it.

--prefix (EPREFIX) is used when installing packages into something other than "/" (the default EPREFIX) ... its not intended as a method of selecting where the packages are installed within the standard prefix. That's why all the additional packages are installed, they don't exist in that EPREFIX but the default.

HTH & best ... khay
Back to top
View user's profile Send private message
rapelotus
n00b
n00b


Joined: 12 Sep 2014
Posts: 21
Location: 中国江苏

PostPosted: Sat Jan 24, 2015 8:03 am    Post subject: Reply with quote

@khayyam:
Thank you for your nice answer! It really helps me understand something.

The reason why I don't want to install packages in /usr/local is that I once read in one book: because /usr/local is the sub-level directory of /usr, when /usr is hung up, anything in /usr/local cann't be used. And conversely, any trouble happened in /usr/local may have a bad effect on /usr. But if packages are installed in /opt, as /opt is another filesystem, /usr won't affect /opt, or vice versa. Such opinion drives me want to install the unimportant packages that I think into /opt.

And I am not very willing to put all packages into /usr, either. Because, I think it just make /usr just too big to get trouble.
Now that if it really becomes more complicate and has no any good effect on robustness and stability on system when I try to install packages into /opt, I would rather quit it.

One more question:
khayyam wrote:
--prefix (EPREFIX) is used when installing packages into something other than "/" (the default EPREFIX)
Then what is the use of --root (ROOT) ? As the man page of emerge said:
Quote:
Use EPREFIX to specify the target prefix to be used for merging packages or ebuilds...Defaults to the prefix where portage is currently installed.
Use ROOT to specify the target root filesystem to be used for merging packages or ebuilds...Defaults to /

Thanks again!
Best Wishes!
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6747

PostPosted: Sat Jan 24, 2015 9:12 am    Post subject: Reply with quote

khayyam is completely right: What you are trying to achieve comes from non-UNIX thinking; it won't work well with a unix operating system and give you only a lot of trouble all over the place. The main reason is that many paths are hardcoded into the binaries, that is, you cannot just move files to another place (unless perhaps you make symlinks to them, but this can also cause various sort of trouble).

This is also the main difference between EPREFIX and ROOT: EPREFIX will manipulate the paths in the installed binaries (where this is supported: It does not work everywhere; for instance, paths in prebuilt binaries cannot be modified) while ROOT generates the "normal" binaries but just puts the generated files into another place.
Neither does do what you want to achieve.

There is nothing wrong with having huge filesystems or huge directories: Unix filesystem are written in a way that they can deal with this.

What can make sense is to have a separate partition with a completely working system which you can boot in case of a fatal corruption in order to repair the main system; you can maintain such a separatie system with "chroot" (after mounting /proc, /sys and /dev into it, e.g. as described in the installation handbook). However, this makes only sense if also /boot is on a separate partition so that grub will not be damaged if your main partition is somehow damaged.
In practice, usually a rescue CD (or rescue USB stick) with sufficient tools to repair (or restore from backup) your original system can replace this extra partition: This extra partition makes only sense if you cannot afford the downtime for restoring a backup or if it is difficult to use a rescue CD for other reasons (e.g. if physical access to your machine is limited, it has no CD drive, cannot boot USB sticks etc.)
Back to top
View user's profile Send private message
rapelotus
n00b
n00b


Joined: 12 Sep 2014
Posts: 21
Location: 中国江苏

PostPosted: Sat Jan 24, 2015 11:17 am    Post subject: Reply with quote

@mv:
Thank you for your answer.
It seems my opinion is totally wrong. In UNIX like system, there is no need to worry about the system's stability due to software installation.

However, please allow me to ask a stupid question again, because I really want to know it:
In gentoo, how to install a package into another place such as /usr/local or /opt ?(In fact, I want to install games into other place :oops: )
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Sat Jan 24, 2015 11:36 am    Post subject: Reply with quote

rapelotus wrote:
However, please allow me to ask a stupid question again, because I really want to know it: In gentoo, how to install a package into another place such as /usr/local or /opt ?(In fact, I want to install games into other place :oops: )

rapelotus ... if you ask NeddySeagoon about stupid questions he'll tell you there are none, everyone asks such questions at some point :)

I think I can only really answer the above with a question of my own: why? /usr/local is for non-package managed software (so software and/or scripts compiled/installed outside of the package manager), /opt is for software that really has no where else to go. Having games under /usr isn't really an issue, as long as its found. Go over the FHS (link above) and get some idea of what goes where, then consider what the package manager is doing (ie, tracking whats installed, its dependencies, etc) and the above need will probably evaporate.

best ... khay
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54216
Location: 56N 3W

PostPosted: Sat Jan 24, 2015 12:29 pm    Post subject: Reply with quote

rapelotus,

man make.conf:
       ROOT = [path]
              Use  ROOT  to  specify  the target root filesystem to be used for merging packages or ebuilds.  Typically, you should set this
              setting in the environment rather than in make.conf itself. It's commonly used for creating new build images.  Make  sure  you
              use  an  absolute path. Refer to the Cross-compilation section of ebuild(5) for information about how dependencies are handled
              for ROOT.
              Defaults to /.

and
man portage:
       /etc/portage/env/
              In this directory additional package-specific bashrc files can be created.  Note that if package-specific environment variable
              settings  are all that's needed, then /etc/portage/package.env should be used instead of the bashrc approach that is described
              here. Also note that special variables such as FEATURES and INSTALL_MASK will not produce the intended results if they are set
              in  bashrc,  and therefore /etc/portage/package.env should be used instead. Lastly, note that these files are interpreted much
              later than the portage environment file package.env.


Taken together tell that you neet to set the ROOT environment variable for portage and further, you can do it on a per package basis.
This means that you don't have to keep fiddling with it by hand. Portage will keep your setings.
Further reading and some trial and error will allow you to build on these pointers. This is the teach you to fish rather than feeding you approach to helping.
Post back for more hints.

As khayyam hints, there is only one stupid questton. That's the one you never ask because then you never know the answer.
Be on your lookout for stupid answers though.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
rapelotus
n00b
n00b


Joined: 12 Sep 2014
Posts: 21
Location: 中国江苏

PostPosted: Sat Jan 24, 2015 12:32 pm    Post subject: Reply with quote

After reading Filesystem Hierarchy Standard in Wikipedia and Filesystem Hierarchy Standard Document, I find I had some wrong concepts about /opt. As khayyam said,
khayyam wrote:
/usr/local is for non-package managed software (so software and/or scripts compiled/installed outside of the package manager)
And in my opinion, /opt is also for non-package managed software like /usr/local. So, with package manager, just install software into where it should be.

In the end, thank khayyam & mv a lot for their wonderful advice!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum