Apt: install packages to a different location

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












Problem:



I have a Lubuntu persistent USB install. I started using it due to problems with my hard drive (Samsung 850 Evo) which used to have Ubuntu installed. My computer (MacBook Pro 9,2) had OSX but after a filesystem corruption I installed Ubuntu. Ubuntu became unbootable shortly after (literally a couple reboots). I formated the disk and decided to start using the live USB with persistence enabled.



Question:



I can't install more packages because I have almost no space left on my 4GB USB. I can perfectly mount the hard drive and store files there, read/write, etc. Is there a way to install the packages into the hard drive and turn /usr to a symlink to /mnt/mydrive ?



I don't care if it's a bad practice or something like that. I would like to know if it's feasible and if so, some instructions and/or recommendations on how to achieve it.










share|improve this question







New contributor




Maganna Dev is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.























    up vote
    1
    down vote

    favorite












    Problem:



    I have a Lubuntu persistent USB install. I started using it due to problems with my hard drive (Samsung 850 Evo) which used to have Ubuntu installed. My computer (MacBook Pro 9,2) had OSX but after a filesystem corruption I installed Ubuntu. Ubuntu became unbootable shortly after (literally a couple reboots). I formated the disk and decided to start using the live USB with persistence enabled.



    Question:



    I can't install more packages because I have almost no space left on my 4GB USB. I can perfectly mount the hard drive and store files there, read/write, etc. Is there a way to install the packages into the hard drive and turn /usr to a symlink to /mnt/mydrive ?



    I don't care if it's a bad practice or something like that. I would like to know if it's feasible and if so, some instructions and/or recommendations on how to achieve it.










    share|improve this question







    New contributor




    Maganna Dev is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.





















      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      Problem:



      I have a Lubuntu persistent USB install. I started using it due to problems with my hard drive (Samsung 850 Evo) which used to have Ubuntu installed. My computer (MacBook Pro 9,2) had OSX but after a filesystem corruption I installed Ubuntu. Ubuntu became unbootable shortly after (literally a couple reboots). I formated the disk and decided to start using the live USB with persistence enabled.



      Question:



      I can't install more packages because I have almost no space left on my 4GB USB. I can perfectly mount the hard drive and store files there, read/write, etc. Is there a way to install the packages into the hard drive and turn /usr to a symlink to /mnt/mydrive ?



      I don't care if it's a bad practice or something like that. I would like to know if it's feasible and if so, some instructions and/or recommendations on how to achieve it.










      share|improve this question







      New contributor




      Maganna Dev is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      Problem:



      I have a Lubuntu persistent USB install. I started using it due to problems with my hard drive (Samsung 850 Evo) which used to have Ubuntu installed. My computer (MacBook Pro 9,2) had OSX but after a filesystem corruption I installed Ubuntu. Ubuntu became unbootable shortly after (literally a couple reboots). I formated the disk and decided to start using the live USB with persistence enabled.



      Question:



      I can't install more packages because I have almost no space left on my 4GB USB. I can perfectly mount the hard drive and store files there, read/write, etc. Is there a way to install the packages into the hard drive and turn /usr to a symlink to /mnt/mydrive ?



      I don't care if it's a bad practice or something like that. I would like to know if it's feasible and if so, some instructions and/or recommendations on how to achieve it.







      apt live-usb lubuntu






      share|improve this question







      New contributor




      Maganna Dev is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question







      New contributor




      Maganna Dev is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question






      New contributor




      Maganna Dev is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked Nov 19 at 15:25









      Maganna Dev

      263




      263




      New contributor




      Maganna Dev is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Maganna Dev is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Maganna Dev is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote



          accepted










          If you are ready to download and install package by package you can use dpkg option --instdir
          For more info what this do you can check with man dpkg



          For apt I am not sure you have such option






          share|improve this answer




















          • So I should uninstall packages installed via apt, and reinstall them using dpkg with --instdir option? I'm also guessing that I need to add /mnt/mydrive to my $PATH.
            – Maganna Dev
            Nov 19 at 15:46











          • @MagannaDev actually you need to add /mnt/mydrive/bin, /mnt/mydrive/sbin and so on. And to add in /etc/fstab this partition. And yes, you can deinstall and then install in new path. Also you should take care about libraries (LD_LIBRARY_PATH or whatever it is in Debian/Ubuntu)
            – Romeo Ninov
            Nov 19 at 15:50











          • @MagannaDev, maybe you can simplify a lot by just buy 32GB flash drive :)
            – Romeo Ninov
            Nov 19 at 15:54






          • 1




            Probably. Thank you very much.
            – Maganna Dev
            Nov 19 at 16:00










          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );






          Maganna Dev is a new contributor. Be nice, and check out our Code of Conduct.









           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f482787%2fapt-install-packages-to-a-different-location%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          1
          down vote



          accepted










          If you are ready to download and install package by package you can use dpkg option --instdir
          For more info what this do you can check with man dpkg



          For apt I am not sure you have such option






          share|improve this answer




















          • So I should uninstall packages installed via apt, and reinstall them using dpkg with --instdir option? I'm also guessing that I need to add /mnt/mydrive to my $PATH.
            – Maganna Dev
            Nov 19 at 15:46











          • @MagannaDev actually you need to add /mnt/mydrive/bin, /mnt/mydrive/sbin and so on. And to add in /etc/fstab this partition. And yes, you can deinstall and then install in new path. Also you should take care about libraries (LD_LIBRARY_PATH or whatever it is in Debian/Ubuntu)
            – Romeo Ninov
            Nov 19 at 15:50











          • @MagannaDev, maybe you can simplify a lot by just buy 32GB flash drive :)
            – Romeo Ninov
            Nov 19 at 15:54






          • 1




            Probably. Thank you very much.
            – Maganna Dev
            Nov 19 at 16:00














          up vote
          1
          down vote



          accepted










          If you are ready to download and install package by package you can use dpkg option --instdir
          For more info what this do you can check with man dpkg



          For apt I am not sure you have such option






          share|improve this answer




















          • So I should uninstall packages installed via apt, and reinstall them using dpkg with --instdir option? I'm also guessing that I need to add /mnt/mydrive to my $PATH.
            – Maganna Dev
            Nov 19 at 15:46











          • @MagannaDev actually you need to add /mnt/mydrive/bin, /mnt/mydrive/sbin and so on. And to add in /etc/fstab this partition. And yes, you can deinstall and then install in new path. Also you should take care about libraries (LD_LIBRARY_PATH or whatever it is in Debian/Ubuntu)
            – Romeo Ninov
            Nov 19 at 15:50











          • @MagannaDev, maybe you can simplify a lot by just buy 32GB flash drive :)
            – Romeo Ninov
            Nov 19 at 15:54






          • 1




            Probably. Thank you very much.
            – Maganna Dev
            Nov 19 at 16:00












          up vote
          1
          down vote



          accepted







          up vote
          1
          down vote



          accepted






          If you are ready to download and install package by package you can use dpkg option --instdir
          For more info what this do you can check with man dpkg



          For apt I am not sure you have such option






          share|improve this answer












          If you are ready to download and install package by package you can use dpkg option --instdir
          For more info what this do you can check with man dpkg



          For apt I am not sure you have such option







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 19 at 15:31









          Romeo Ninov

          4,98431627




          4,98431627











          • So I should uninstall packages installed via apt, and reinstall them using dpkg with --instdir option? I'm also guessing that I need to add /mnt/mydrive to my $PATH.
            – Maganna Dev
            Nov 19 at 15:46











          • @MagannaDev actually you need to add /mnt/mydrive/bin, /mnt/mydrive/sbin and so on. And to add in /etc/fstab this partition. And yes, you can deinstall and then install in new path. Also you should take care about libraries (LD_LIBRARY_PATH or whatever it is in Debian/Ubuntu)
            – Romeo Ninov
            Nov 19 at 15:50











          • @MagannaDev, maybe you can simplify a lot by just buy 32GB flash drive :)
            – Romeo Ninov
            Nov 19 at 15:54






          • 1




            Probably. Thank you very much.
            – Maganna Dev
            Nov 19 at 16:00
















          • So I should uninstall packages installed via apt, and reinstall them using dpkg with --instdir option? I'm also guessing that I need to add /mnt/mydrive to my $PATH.
            – Maganna Dev
            Nov 19 at 15:46











          • @MagannaDev actually you need to add /mnt/mydrive/bin, /mnt/mydrive/sbin and so on. And to add in /etc/fstab this partition. And yes, you can deinstall and then install in new path. Also you should take care about libraries (LD_LIBRARY_PATH or whatever it is in Debian/Ubuntu)
            – Romeo Ninov
            Nov 19 at 15:50











          • @MagannaDev, maybe you can simplify a lot by just buy 32GB flash drive :)
            – Romeo Ninov
            Nov 19 at 15:54






          • 1




            Probably. Thank you very much.
            – Maganna Dev
            Nov 19 at 16:00















          So I should uninstall packages installed via apt, and reinstall them using dpkg with --instdir option? I'm also guessing that I need to add /mnt/mydrive to my $PATH.
          – Maganna Dev
          Nov 19 at 15:46





          So I should uninstall packages installed via apt, and reinstall them using dpkg with --instdir option? I'm also guessing that I need to add /mnt/mydrive to my $PATH.
          – Maganna Dev
          Nov 19 at 15:46













          @MagannaDev actually you need to add /mnt/mydrive/bin, /mnt/mydrive/sbin and so on. And to add in /etc/fstab this partition. And yes, you can deinstall and then install in new path. Also you should take care about libraries (LD_LIBRARY_PATH or whatever it is in Debian/Ubuntu)
          – Romeo Ninov
          Nov 19 at 15:50





          @MagannaDev actually you need to add /mnt/mydrive/bin, /mnt/mydrive/sbin and so on. And to add in /etc/fstab this partition. And yes, you can deinstall and then install in new path. Also you should take care about libraries (LD_LIBRARY_PATH or whatever it is in Debian/Ubuntu)
          – Romeo Ninov
          Nov 19 at 15:50













          @MagannaDev, maybe you can simplify a lot by just buy 32GB flash drive :)
          – Romeo Ninov
          Nov 19 at 15:54




          @MagannaDev, maybe you can simplify a lot by just buy 32GB flash drive :)
          – Romeo Ninov
          Nov 19 at 15:54




          1




          1




          Probably. Thank you very much.
          – Maganna Dev
          Nov 19 at 16:00




          Probably. Thank you very much.
          – Maganna Dev
          Nov 19 at 16:00










          Maganna Dev is a new contributor. Be nice, and check out our Code of Conduct.









           

          draft saved


          draft discarded


















          Maganna Dev is a new contributor. Be nice, and check out our Code of Conduct.












          Maganna Dev is a new contributor. Be nice, and check out our Code of Conduct.











          Maganna Dev is a new contributor. Be nice, and check out our Code of Conduct.













           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f482787%2fapt-install-packages-to-a-different-location%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown






          Popular posts from this blog

          How to check contact read email or not when send email to Individual?

          Bahrain

          Postfix configuration issue with fips on centos 7; mailgun relay