{"id":573,"date":"2019-05-30T23:41:57","date_gmt":"2019-05-30T22:41:57","guid":{"rendered":"https:\/\/notiz.comanet.xyz\/?p=573"},"modified":"2019-05-30T23:44:31","modified_gmt":"2019-05-30T22:44:31","slug":"linux-raspberry-pi-apt-update","status":"publish","type":"post","link":"https:\/\/notiz.comanet.xyz\/?p=573","title":{"rendered":"Linux \u2013 Raspberry Pi \u2013 APT Update"},"content":{"rendered":"<p>The easiest way to manage installing, upgrading, and removing software is using APT (Advanced Packaging Tool) from Debian. If a piece of software is packaged in Debian and it works on the Raspberry Pi&#8217;s ARM architecture, it should also be available in Raspbian.<\/p>\n<p>To install or remove packages you need root user permissions, so your user needs to be in<strong> <em>sudoers<\/em><\/strong> or you must be logged in as <strong><em>root<\/em><\/strong>. Read more about users and root.<\/p>\n<p>To install new packages, or update existing ones, you&#8217;ll need an internet connection.<\/p>\n<p>Note that installing software uses up disk space on your SD card, so you should keep an eye on disk usage and use an appropriately sized SD card.<\/p>\n<p>Also note that a lock is performed while software is installing, so you can&#8217;t install multiple packages at the same time.<\/p>\n<h1>Software sources<\/h1>\n<p>APT keeps a list of software sources on your Pi in a file at \/etc\/apt\/sources.list. Before installing software, you should update your package list with apt update:<\/p>\n<pre>sudo apt update<\/pre>\n<h1>Installing a package with APT<\/h1>\n<pre>sudo apt install tree<\/pre>\n<p>Typing this command should inform the user how much disk space the package will take up and asks for confirmation of the package installation. Entering Y (or just pressing Enter, as yes is the default action) will allow the installation to occur. This can be bypassed by adding the -y flag to the command:<\/p>\n<pre>sudo apt install tree -y<\/pre>\n<p>Installing this package makes tree available for the user.<\/p>\n<p>Using an installed package<\/p>\n<p>tree is a command-line tool which provides a visualisation of the structure of the current directory, and all its contents.<\/p>\n<p>Typing tree runs the tree command. For example:<\/p>\n<pre>tree\r\n..\r\n\u251c\u2500\u2500 hello.py\r\n\u251c\u2500\u2500 games\r\n\u2502 \u251c\u2500\u2500 asteroids.py\r\n\u2502 \u251c\u2500\u2500 pacman.py\r\n\u2502 \u251c\u2500\u2500 README.txt\r\n\u2502 \u2514\u2500\u2500 tetris.py<\/pre>\n<p>Typing <strong><em>man tree<\/em><\/strong> gives the manual entry for the package <em><strong>tree<\/strong><\/em>.<br \/>\nTyping <em><strong>whereis tree<\/strong><\/em> shows where tree lives:<\/p>\n<pre>tree: \/usr\/bin\/tree<\/pre>\n<p>Uninstalling a package with APT<\/p>\n<p><strong>Remove<\/strong><\/p>\n<p>You can uninstall a package with apt remove:<\/p>\n<pre>sudo apt remove tree<\/pre>\n<p>The user is prompted to confirm the removal. Again, the -y flag will auto-confirm.<\/p>\n<p><strong>Purge<\/strong><\/p>\n<p>You can also choose to completely remove the package and its associated configuration files with apt purge:<\/p>\n<pre>sudo apt purge tree<\/pre>\n<h1>Upgrading existing software<\/h1>\n<p>If software updates are available, you can get the updates with<\/p>\n<pre>sudo apt update<\/pre>\n<p>and install the updates with<\/p>\n<pre>sudo apt upgrade<\/pre>\n<p>which will upgrade all of your packages. To upgrade a specific package, without upgrading all the other out-of-date packages at the same time, you can use<\/p>\n<pre>sudo apt install somepackage<\/pre>\n<p>(which may be useful if you&#8217;re low on disk space or you have limited download bandwidth).<\/p>\n<h1>Searching for software<\/h1>\n<p>You can search the archives for a package with a given keyword with apt-cache search:<\/p>\n<pre>apt-cache search locomotive\r\nsl - Correct you if you type `sl' by mistake<\/pre>\n<p>You can view more information about a package before installing it with apt-cache show:<\/p>\n<pre>apt-cache show sl\r\nPackage: sl\r\nVersion: 3.03-17\r\nArchitecture: armhf\r\nMaintainer: Hiroyuki Yamamoto &lt;yama1066@gmail.com&gt;\r\nInstalled-Size: 114\r\nDepends: libc6 (&gt;= 2.4), libncurses5 (&gt;= 5.5-5~), libtinfo5\r\nHomepage: http:\/\/www.tkl.iis.u-tokyo.ac.jp\/~toyoda\/index_e.html\r\nPriority: optional\r\nSection: games\r\nFilename: pool\/main\/s\/sl\/sl_3.03-17_armhf.deb\r\nSize: 26246\r\nSHA256: 42dea9d7c618af8fe9f3c810b3d551102832bf217a5bcdba310f119f62117dfb\r\nSHA1: b08039acccecd721fc3e6faf264fe59e56118e74\r\nMD5sum: 450b21cc998dc9026313f72b4bd9807b\r\nDescription: Correct you if you type `sl' by mistake\r\nSl is a program that can display animations aimed to correct you\r\nif you type 'sl' by mistake.\r\nSL stands for Steam Locomotive.<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>The easiest way to manage installing, upgrading, and removing software is using APT (Advanced Packaging Tool) from Debian. If a piece of software is packaged in Debian and it works on the Raspberry Pi&#8217;s ARM architecture, it should also be available in Raspbian. To install or remove packages you need root user permissions, so your&#8230;<\/p>\n","protected":false},"author":1,"featured_media":576,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,6],"tags":[],"class_list":["post-573","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-how-to-s","category-linux"],"_links":{"self":[{"href":"https:\/\/notiz.comanet.xyz\/index.php?rest_route=\/wp\/v2\/posts\/573","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/notiz.comanet.xyz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/notiz.comanet.xyz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/notiz.comanet.xyz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/notiz.comanet.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=573"}],"version-history":[{"count":2,"href":"https:\/\/notiz.comanet.xyz\/index.php?rest_route=\/wp\/v2\/posts\/573\/revisions"}],"predecessor-version":[{"id":577,"href":"https:\/\/notiz.comanet.xyz\/index.php?rest_route=\/wp\/v2\/posts\/573\/revisions\/577"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/notiz.comanet.xyz\/index.php?rest_route=\/wp\/v2\/media\/576"}],"wp:attachment":[{"href":"https:\/\/notiz.comanet.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=573"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/notiz.comanet.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=573"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/notiz.comanet.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=573"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}