{"id":2468,"date":"2018-11-03T15:58:42","date_gmt":"2018-11-03T15:58:42","guid":{"rendered":"https:\/\/www.appservgrid.com\/paw92\/?p=2468"},"modified":"2018-11-04T08:37:36","modified_gmt":"2018-11-04T08:37:36","slug":"how-to-easily-remove-packages-installed-from-source-in-linux","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2018\/11\/03\/how-to-easily-remove-packages-installed-from-source-in-linux\/","title":{"rendered":"How to Easily Remove Packages Installed From Source in Linux"},"content":{"rendered":"<p><a href=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/10\/How-to-Easily-Remove-Packages-Installed-From-Source-in-Linux.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/10\/How-to-Easily-Remove-Packages-Installed-From-Source-in-Linux.jpg\" alt=\"How to Easily Remove Packages Installed From Source in Linux\" width=\"742\" height=\"372\" \/><\/a><\/p>\n<p>How to Easily Remove Packages Installed From Source in Linux<\/p>\n<p>In one of our previous articles, we\u2019d shown you how to <a href=\"https:\/\/www.rosehosting.com\/blog\/how-to-install-tar-gz-in-centos\/\">install and uninstall software in Linux outside the regular package managers<\/a>. In that, we also saw that well-constructed software comes with built-in uninstallers. This way, you can remove the packages as easily as you install them.<\/p>\n<p>Unfortunately, this isn\u2019t always the case. There are plenty of packages out in the wild which don\u2019t allow for clean removal. Sometimes you have no choice but to use a package like this because you need the functionality. However, there is a solution to the problem. In this article, we\u2019ll show you how to use the software called \u201cstow\u201d to easily remove packages installed from in Linux.<\/p>\n<h2>Step 1: Install Stow<\/h2>\n<p>The \u201cstow\u201d package should be available in your regular package repositories. In this example, we are using CentOS so we need the extended EPEL libraries. You can install them using the command:<\/p>\n<p>yum install epel-release<\/p>\n<p>And after that, install stow like this:<\/p>\n<p>yum install stow<\/p>\n<p>Press yes to confirm the installation:<\/p>\n<p><a href=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/10\/Installing-Stow.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/10\/Installing-Stow.jpg\" alt=\"Installing Stow\" width=\"650\" height=\"480\" \/><\/a><\/p>\n<p>Now that stow is installed, we have to choose where to store our package files.<\/p>\n<h2>Step 2: Choose Where to Store Package Files<\/h2>\n<p>The normal \u201cmake install\u201d command copies the package files into a variety of places. Stow works by keeping them all in one place in a single directory, and then creating symlinks to where they should have gone originally.<\/p>\n<p>So we need to choose a directory for where stow keeps all the package files. By convention, this is usually:<\/p>\n<p>\/usr\/local\/stow\/<\/p>\n<p>And in this location, we have one single directory for each package. So if we want to install the \u201chello\u201d program that we used as an example in the previous article, the files will be stored in:<\/p>\n<p>\/usr\/local\/stow\/hello<\/p>\n<p>But this location can be anything. Just to show, we\u2019ll be storing the files in the following location:<\/p>\n<p>\/home\/bhagwad\/stow\/<\/p>\n<h2>Step 3: Using \u201cmake install\u201d with the \u201cprefix\u201d Option<\/h2>\n<p>We saw in the previous article that installing from source requires these commands:<\/p>\n<p>.\/configure<br \/>\nmake<br \/>\nmake install<\/p>\n<p>To install with stow, we just change the last step to:<\/p>\n<p>make install prefix=\/home\/testuser\/stow\/hello<\/p>\n<p>The \u201cprefix\u201d option tells us to place the packages in the given location. This location is nothing but the selected directory in Step 2 with the package name added on as a separate folder. This causes the files to be installed into the given location as shown here:<\/p>\n<p><a href=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/10\/Installing-Files-in-Stow-Directory.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/10\/Installing-Files-in-Stow-Directory.jpg\" alt=\"Installing Files in Stow Directory\" width=\"650\" height=\"286\" \/><\/a><\/p>\n<p>Now we have all the files required for the package in a folder in the stow directory. Time for the magic to happen!<\/p>\n<h2>Step 4: Completing the Installation with stow<\/h2>\n<p>To install the package, first \u201ccd\u201d into the stow directory like this:<\/p>\n<p>cd \/home\/testuser\/stow<\/p>\n<p>Ensure that the folder with the files is just one directory below your current location. Now type:<\/p>\n<p>stow hello<\/p>\n<p>That\u2019s it! The package is now installed on your system. Here\u2019s a screenshot of the \u201chello\u201d command working as intended:<\/p>\n<p><a href=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/10\/Installing-with-Stow.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/10\/Installing-with-Stow.jpg\" alt=\"Installing with Stow\" width=\"650\" height=\"230\" \/><\/a><\/p>\n<p>But wait. The real benefit is yet to come. Uninstallation.<\/p>\n<h2>Step 5: Removing Packages<\/h2>\n<p>The coolest part about stow is how easy it is to remove packages from the system. No need to keep the source packages or anything. Just navigate to the stow directory as in Step 4 and type:<\/p>\n<p>stow &#8211;delete hello<\/p>\n<p>And it\u2019s done! You can see below that the command no longer works after this step:<\/p>\n<p><a href=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/10\/Removing-Software-with-Stow.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/10\/Removing-Software-with-Stow.jpg\" alt=\"Removing Software with Stow\" width=\"650\" height=\"206\" \/><\/a><\/p>\n<p>As far as the system is concerned, the package has been completely removed! It\u2019s good to remember that the files haven\u2019t actually vanished. They\u2019re still in the \u201chello\u201d directory. You could just as easily install the package again with the stow command. If you don\u2019t require the files anymore, just delete the \u201chello\u201d folder and your system is clean!<\/p>\n<p>We recommend using stow every single time you install a package from source. It\u2019s not worth the risk to have a badly written package spray your system with files everywhere, and which are a nuisance to remove afterward. Stow ensures that they\u2019re all neatly contained in one location, then keeps track of the symlinks and deletes them afterward. It\u2019s a fantastic solution!<\/p>\n<p>Of course, if you are one of our <a href=\"https:\/\/www.rosehosting.com\/\">Managed VPS hosting<\/a> customers, you don\u2019t have to remove packages installed from source, simply ask our admins, sit back and relax. Our admins will do this for you immediately.<\/p>\n<p>PS. If you liked this post about how to easily remove packages installed from source in Linux, please share it with your friends on the social networks using the buttons below or simply leave a comment in the comments section. Thanks.<\/p>\n<p><a href=\"http:\/\/lxer.com\/module\/newswire\/ext_link.php?rid=262450\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to Easily Remove Packages Installed From Source in Linux In one of our previous articles, we\u2019d shown you how to install and uninstall software in Linux outside the regular package managers. In that, we also saw that well-constructed software comes with built-in uninstallers. This way, you can remove the packages as easily as you &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2018\/11\/03\/how-to-easily-remove-packages-installed-from-source-in-linux\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;How to Easily Remove Packages Installed From Source in Linux&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2468","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/2468","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=2468"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/2468\/revisions"}],"predecessor-version":[{"id":2585,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/2468\/revisions\/2585"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=2468"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=2468"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=2468"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}