Pinning package using own repository and apt-get












3















I created my own repository so I can provide a newer version of a package than the one the Ubuntu repository currently holds. Everything works fine, with the exception that I have to specify the version when installing it:



sudo apt-get install package=1.2.1


If I don't specify the version, then it will install it from Ubuntu's repository.



I tried to put my repository at the top of the sources.list but it doesn't make any difference.



So I'm wondering if there's a flag when building the .deb package that will give priority to my repository at all times? or a flag in the actual repository? I'd prefer not having the user to change their /etc/apt/preferences to set the priority, nor using apt-get -t repo.



I tried to install the Tor browser given this instructions and it does install the latest version from their custom repo. I don't know what they're doing but it does work with only the steps they list.










share|improve this question



























    3















    I created my own repository so I can provide a newer version of a package than the one the Ubuntu repository currently holds. Everything works fine, with the exception that I have to specify the version when installing it:



    sudo apt-get install package=1.2.1


    If I don't specify the version, then it will install it from Ubuntu's repository.



    I tried to put my repository at the top of the sources.list but it doesn't make any difference.



    So I'm wondering if there's a flag when building the .deb package that will give priority to my repository at all times? or a flag in the actual repository? I'd prefer not having the user to change their /etc/apt/preferences to set the priority, nor using apt-get -t repo.



    I tried to install the Tor browser given this instructions and it does install the latest version from their custom repo. I don't know what they're doing but it does work with only the steps they list.










    share|improve this question

























      3












      3








      3








      I created my own repository so I can provide a newer version of a package than the one the Ubuntu repository currently holds. Everything works fine, with the exception that I have to specify the version when installing it:



      sudo apt-get install package=1.2.1


      If I don't specify the version, then it will install it from Ubuntu's repository.



      I tried to put my repository at the top of the sources.list but it doesn't make any difference.



      So I'm wondering if there's a flag when building the .deb package that will give priority to my repository at all times? or a flag in the actual repository? I'd prefer not having the user to change their /etc/apt/preferences to set the priority, nor using apt-get -t repo.



      I tried to install the Tor browser given this instructions and it does install the latest version from their custom repo. I don't know what they're doing but it does work with only the steps they list.










      share|improve this question














      I created my own repository so I can provide a newer version of a package than the one the Ubuntu repository currently holds. Everything works fine, with the exception that I have to specify the version when installing it:



      sudo apt-get install package=1.2.1


      If I don't specify the version, then it will install it from Ubuntu's repository.



      I tried to put my repository at the top of the sources.list but it doesn't make any difference.



      So I'm wondering if there's a flag when building the .deb package that will give priority to my repository at all times? or a flag in the actual repository? I'd prefer not having the user to change their /etc/apt/preferences to set the priority, nor using apt-get -t repo.



      I tried to install the Tor browser given this instructions and it does install the latest version from their custom repo. I don't know what they're doing but it does work with only the steps they list.







      apt repository localrepository






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Apr 18 '14 at 3:57









      Pete DarrowPete Darrow

      333




      333






















          1 Answer
          1






          active

          oldest

          votes


















          2














          Solution 1: (using Debian epoch)



          Prefix your package version with 1: so that it will be 1:1.2.1 and thus it will always be seen as a higher version. This is very handy if you build your own modified packages and don't want them replaced by Ubuntu upgrades.




          When comparing two version numbers, first the epoch of each are
          compared, then the upstream_version if epoch is equal, and then
          debian_revision if upstream_version is also equal. epoch is compared
          numerically.




          Source: https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version



          Solution 2 (using Pinning)



          To set up AptPreferences for a given package add a new file in /etc/apt/preferences.d/.



          sudo gedit /etc/apt/preferences.d/my-package-pin


          Add add the following lines in that file:



          Package: my_package
          Pin: release o=Ubuntu
          Pin-Priority: -10


          I will prevent Ubuntu repository versions to replace the one provided by your local repo.



          To check if the package pin version run:



          sudo apt-cache policy my_package


          Visit https://help.ubuntu.com/community/PinningHowto






          share|improve this answer

























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "89"
            };
            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',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            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
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f449426%2fpinning-package-using-own-repository-and-apt-get%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









            2














            Solution 1: (using Debian epoch)



            Prefix your package version with 1: so that it will be 1:1.2.1 and thus it will always be seen as a higher version. This is very handy if you build your own modified packages and don't want them replaced by Ubuntu upgrades.




            When comparing two version numbers, first the epoch of each are
            compared, then the upstream_version if epoch is equal, and then
            debian_revision if upstream_version is also equal. epoch is compared
            numerically.




            Source: https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version



            Solution 2 (using Pinning)



            To set up AptPreferences for a given package add a new file in /etc/apt/preferences.d/.



            sudo gedit /etc/apt/preferences.d/my-package-pin


            Add add the following lines in that file:



            Package: my_package
            Pin: release o=Ubuntu
            Pin-Priority: -10


            I will prevent Ubuntu repository versions to replace the one provided by your local repo.



            To check if the package pin version run:



            sudo apt-cache policy my_package


            Visit https://help.ubuntu.com/community/PinningHowto






            share|improve this answer






























              2














              Solution 1: (using Debian epoch)



              Prefix your package version with 1: so that it will be 1:1.2.1 and thus it will always be seen as a higher version. This is very handy if you build your own modified packages and don't want them replaced by Ubuntu upgrades.




              When comparing two version numbers, first the epoch of each are
              compared, then the upstream_version if epoch is equal, and then
              debian_revision if upstream_version is also equal. epoch is compared
              numerically.




              Source: https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version



              Solution 2 (using Pinning)



              To set up AptPreferences for a given package add a new file in /etc/apt/preferences.d/.



              sudo gedit /etc/apt/preferences.d/my-package-pin


              Add add the following lines in that file:



              Package: my_package
              Pin: release o=Ubuntu
              Pin-Priority: -10


              I will prevent Ubuntu repository versions to replace the one provided by your local repo.



              To check if the package pin version run:



              sudo apt-cache policy my_package


              Visit https://help.ubuntu.com/community/PinningHowto






              share|improve this answer




























                2












                2








                2







                Solution 1: (using Debian epoch)



                Prefix your package version with 1: so that it will be 1:1.2.1 and thus it will always be seen as a higher version. This is very handy if you build your own modified packages and don't want them replaced by Ubuntu upgrades.




                When comparing two version numbers, first the epoch of each are
                compared, then the upstream_version if epoch is equal, and then
                debian_revision if upstream_version is also equal. epoch is compared
                numerically.




                Source: https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version



                Solution 2 (using Pinning)



                To set up AptPreferences for a given package add a new file in /etc/apt/preferences.d/.



                sudo gedit /etc/apt/preferences.d/my-package-pin


                Add add the following lines in that file:



                Package: my_package
                Pin: release o=Ubuntu
                Pin-Priority: -10


                I will prevent Ubuntu repository versions to replace the one provided by your local repo.



                To check if the package pin version run:



                sudo apt-cache policy my_package


                Visit https://help.ubuntu.com/community/PinningHowto






                share|improve this answer















                Solution 1: (using Debian epoch)



                Prefix your package version with 1: so that it will be 1:1.2.1 and thus it will always be seen as a higher version. This is very handy if you build your own modified packages and don't want them replaced by Ubuntu upgrades.




                When comparing two version numbers, first the epoch of each are
                compared, then the upstream_version if epoch is equal, and then
                debian_revision if upstream_version is also equal. epoch is compared
                numerically.




                Source: https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version



                Solution 2 (using Pinning)



                To set up AptPreferences for a given package add a new file in /etc/apt/preferences.d/.



                sudo gedit /etc/apt/preferences.d/my-package-pin


                Add add the following lines in that file:



                Package: my_package
                Pin: release o=Ubuntu
                Pin-Priority: -10


                I will prevent Ubuntu repository versions to replace the one provided by your local repo.



                To check if the package pin version run:



                sudo apt-cache policy my_package


                Visit https://help.ubuntu.com/community/PinningHowto







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Apr 18 '14 at 8:34

























                answered Apr 18 '14 at 8:21









                Sylvain PineauSylvain Pineau

                49.3k16107150




                49.3k16107150






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Ask Ubuntu!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f449426%2fpinning-package-using-own-repository-and-apt-get%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

                    Human spaceflight

                    Can not write log (Is /dev/pts mounted?) - openpty in Ubuntu-on-Windows?

                    File:DeusFollowingSea.jpg