Preparing your Linux computer for MX: Difference between revisions

From Cumulus Wiki
Jump to navigationJump to search
m
no edit summary
mNo edit summary
 
:Until somebody creates a separate page for Apple Mac computers (that could be a good idea, as there are some significant differences), this page is the best source of advice.
 
=Operating systems=
 
New hardware might come preloaded with an operating system, or might allow you to choose which operating system to install on it.
 
Please see [[Raspberry Pi computer page]] if you want guidance on choosing which model to buy and how to install an operating system on those computers, so you are ready to install MX.
 
=Interactive Package management=
 
All Linux computers include a package manager, there is some variation between them.
 
 
==Package tool==
 
For the purposes of keeping this Wiki page simple, the package manager described in “apt” meaning “Advance Package Tool” e.g. <code>sudo ''apt'' install package_name</code>.
 
In simple terms, the inclusion of "apt" runs the “package manager” used in Linux. That is certainly true if you use the Raspberry Pi operating system, and it appears it is true for almost all modern Linux operating systems.
 
Some online tutorials refer to “apt-get” or "apt-cache" in examples they quote. My online research suggests using those directly is no longer advisable, and therefore you should leave off the part starting with a hyphen, i.e. it should be safe to replace these older package managers with "apt". I have included [[#Package Manager – a brief technical aside|a little technical explanation]] after this subsection, if this really worries you, it appears that in some variants "apt" is just a more user friendly way to call the older package.
 
If you are using an older operating system, it appears the tool available depends on the variant of Unix you have installed. The contributor of this section has done some online research, but is not familiar with all the Unix variants, so other contributors with fuller technical expertise may need to edit this section to make its applicability wider.
 
According to online documentation seen, some UNIX variants use a tool called '''RPM packet manager''', and this involves a command line specifying "zypper" in the second part of the command e.g. <code>sudo zypper install package_name</code>.
 
== Package Manager – a brief technical aside==
 
Linux operating systems install software by looking in repositories, and checking a register showing dependencies. When you ask Linux to install a particular package using “apt”, it also checks if all dependencies of the selected package are already present, and installs any that are missing.
 
If you look up on-line how to install any software in Linux, it may use “apt-get”, that is an earlier package manager, in general you can use “apt” instead now.
 
The full differences between “apt” and “apt-get” depends on your Linux flavour, so this technical aside now splits further discussion by Linux flavour.
 
===Debian as used by Raspberry Pi===
 
“Debian Linux” (and its derivatives such as “Raspberry Pi Operating System”) uses “apt” to mean a ‘’’Package Manager’’’ that can install, update, and remove packages from these computer systems.
 
For Debian Linux, “apt” is directed at the end-user (it has user friendly features like a staus bar showing progress on a long install or long upgrade, and can produce prompts about what it is doing and can give choices about whether to do individual actions).
 
There is an alternative “apt-get” which is more powerful, but directed at system level users (those who don’t want to be watching progress and possibly responding to prompts).
 
As “apt-get” is updated less frequently than “apt”, it may be it will not work with new packages. Put another way “apt-get” may never change what it can do, but “apt” may get modified to do more than it did before.
 
===Ubuntu===
 
For Ubuntu only “apt-get” was available up to 2014, when “apt” was added. Both work as described above for Debian. Again “apt” is best to use.
 
===Mint===
 
Linux Mint has a different variation. Its “apt” calls its “apt-get” and adds extra features. So both effectively do the same, but (as with previous flavours) “apt” is best to use.
 
===Other Linux===
 
It is likely that other Linux variants will also vary how these alternative commands differ.
 
 
==Interactive Package management on RPi==
 
If you are using a Raspberry Pi computer, and have the full version of the Raspberry Pi Operating System that includes the desktop interactive user interface, click the "raspberry" button on your official keyboard, or the "raspberry start-here" icon in the task bar (by default task bar appears at top of screen, but can be at side or bottom; the position where the menu icon appears is also configurable) giving you access to the '''menu'''. Scroll down to preferences, then find "Add / Remove Software" item and click that. On the top left of the screen that is displayed there is a menu item called "Options", that gives you access to the options relating to installing packages:
* '''Refresh Package Lists''' - although this is not first in list, it is the menu item that you should choose first. You see an indication of progress, but you don't get any feedback on what it finds, which is up-to-date information about status of all your existing packages.
* '''Check for updates''' - this menu item will pop up a "package updater" screen. If you have first selected the "Refresh Package Lists" menu item, then "Check for updates" will show any updates available for your existing packages, and you can tick/untick any in the list, and then click '''Quit''' or ''Install update'' buttons at bottom right of screen as appropriate. This is by far the easiest way to do updates, and avoid any update where the new version might give you problems. If you choose to update, you will be asked to supply the password.
* '''Package Log ...''' - this menu item displays (latest first) every package install or update whether done using the option above or the terminal commands described in subsequent sections.
* '''Package Sources ...''' - avoid this menu item, it should be considered an information only screen, although you could tick/untick entries there is not enough information to understand what each line represents!
The rest of the "Add / Remove Software" screen lists a lot of categories, under a search box, selecting any category causes all software in that category to be listed, component by component. None of this is friendly to novices, and I assume any technical reader can work out how to tick/untick required components. As a quick example, category "Programming" would bring up a huge list, scrolling down that list to find components starting with "php" would list what PHP components, ticking those required and the "Apply" button would install those components.
 
==Using Package Manager in terminal mode==
 
Read on for a short technical digression to explain the commands to use in a terminal session, to install and update software packages (the same commands can be used to install software for [[Your_Own_Server]], or to install software that can read the SQLite databases used by MX [[Cumulusmx.db]] and [[Diary.db]]).
 
==The various components to commands for installation==
 
Linux computers have a “source list” which references the repositories from which software packages can be installed.
 
If a particular package can not be found in repositories already in the source list, then another repository can be added to the source list.
 
===sudo===
 
By default, a Linux user should log in as a default user with limited rights.
 
For example, the Raspberry Pi (Stretch 9, or Buster 10) Operating System has a single default user "pi", with their home folder that can be referenced as "~". (To complicate the matter, RPi Bullseye 11 operating system does not predetermine the default user name, but it does enforce setting up a default user).
 
The limited rights mean that a standard user cannot even see (read) some files, cannot execute some commands, and cannot edit (write to) some files. For full access to files, the <code>sudo</code> instruction gives you (just for the command that follows) the same read/write/execute access that the system root user has.
 
For software packages, the command to be used is <code>apt</code> to invoke the package manager, followed by an "action" and then optionally by the "package name". In that context the default user's limited rights allow use of actions that just read (such as '''search''', ''show''). However, for any action involving writing (such as '''install''', ''full-upgrade'', '''update''', ''autoremove''), the package manager needs additional rights, and we prefix the "apt" with '''sudo'''.
 
: Elsewhere on this page you might notice [[#Running any MX executable with a terminal session left open|'''cd''']] can move round the file structure (without a "sudo"), but "sudo" is used with [[# Installing/Configuring the MX service and the -service parameter|'''cp''']] as that writes a file.
 
Novice readers should exercise caution before using "sudo", changing folder/file ownership, adding write rights, and even using "-R" or "-y" flag. The use of "sudo" makes it very easy to inadvertently do the wrong action, in the worst case making your computer unusable because it can delete vital folders/files because of something as simple as a typo.
 
: '''For technical readers only''', the full use of "sudo" is explained later (see [[#su_and_sudo]]).
 
 
===Action e.g. install===
 
The third part of our installation instruction is the action parameter.
 
In our current context this is “install”, which tells our package manager what we are trying to either update an existing package or install a package that we did not have before, i.e. <code>sudo apt'' install'' package_name</code>.
 
Here is full list of what can follow “apt” (if you are using a different package manager, I cannot guarantee that these can follow that package manager name), as we will use some of the alternatives later:
 
{| class="wikitable" border="1"
|-
!style="width:30px" | Instruction following “apt”
!style="width:600px" | Description
|-
! scope="row"|update
| The "source list" [[#The various components to commands for installation|mentioned earlier]] that references the repositories from which software packages can be installed, needs to be updated periodically so it reflects any changes within those repositories. The instruction "update" is included after "apt" to make sure your computer has up to date information about repositories installed, and to report if these contain packages that can be upgraded.
 
In [[#Interactive Package management on RPi]] there was mention of the need to select "Update" item in menu first, and again in terminal mode, it is necessary to do this action before you do either of the next two actions.
|-
! scope="row"|install
|To upgrade or install a particular package, and its dependencies. It is mandatory to include further parts of the command after "install", see below this table.
 
If a later part of the command includes a package name, then this action applies to the mandatory dependencies, it does not mean all components are installed; but if a later part of the command names multiple components, then dependencies of all those components will be actioned.
|-
! scope="row"|upgrade
| Once your "source list" is up to date, <code>sudo apt upgrade</code>, will actually initiate the download of newer versions now available in repositories.
 
* Note that it is not mandatory to follow this action with further parameters, but you can:
** If you include <code>-y</code> flag, or you answer 'Y' or 'y' to the prompt, then the package manager will continue, and actually replace those packages that are already installed on your computer with the downloaded newer versions, making them available for immediate use.
** If you don't specify a package name, the default "upgrade" action will exclude anything that has had a component affected by a manual "remove" action (see below)
** It is also possible to follow the "upgrade" action (and any flag) with one or more package name(s), then the upgrade will only be done for the named packages. (Does anyone know how to specify with flag, to exclude particular named packages?)
 
(You cannot upgrade the actual kernel within the operating system with this instruction, so there is no necessity to reboot your Linux computer).
|-
! scope="row"|full-upgrade
| Once your "source list" is up to date, the action "full-upgrade" can be included after "apt". The advantage of "full-upgrade" over the simple "upgrade" is that it picks up dependencies, it ensures that every package is able to work with all other packages, and so normally results in more components being upgraded. (Again, this does not affect kernel, and does not require a computer reboot).
|-
! scope="row"|autoremove
| The action "autoremove" can be included after "apt" to check all components in the packages you have installed onto your computer, and remove any components that are not needed by the dependencies of the packages you are using. A download for software frequently includes some components specifically for their software to work with particular other optional packages, and therefore installs more than you actually need.
 
When we install mono-complete later, the other packages we install do not need every component that mono-complete has installed, and “autoremove” can be used to tidy up when all our installations are finished.
|-
! scope="row"|remove
|If you want to remove just one component manually, use <code>sudo apt remove</code> followed by the name of component you no longer want.
 
One advantage of using the "remove" action is that it does not delete any related configuration files, so if we do later decide to install the package again, we don't have to repeat all configuration tasks! As a quick example, PHP is upgraded from time to time, but as an upgrade removes some system functions and adds some new ones, it is possible our existing PHP scripts will stop working if we upgrade PHP. By using the "remove" action, a future "upgrade" action will automatically exclude "php" from its default upgrades.
|-
! scope="row"|purge
| To remove any installed package and delete all related configuration files, use <code>sudo apt purge</code> then the name of the package we no longer want
|-
! scope="row"|search
|To search in repositories in source list for a package you specify after <code>apt search</code>
|-
! scope="row"|show
|To show any information available about a package that you name after the <code>apt show</code>
|}
 
=== Flags ===
 
The basic syntax is either one or two hyphens, followed by one or two letters (each letter has to be a specific case). Various examples will be seen on this page, but here just one is explained here.
 
If we selected "install" or "upgrade" to follow "apt", we can add a “-y” flag to signify that we want the install to not only down load new components but also install them. Without this flag, the package manager will ask periodically if we want it to continue, and we have to then respond with a “y” each time. For example, when we ask to install a package, "apt" will do a search, it will list what components it has found, and output how big their demands are on storage, without "-y" flag, it will then ask (at least once) if it is okay to continue to installing.
 
=== Name ===
 
The final part of the package command is the name of the package or component that we want to install/upgrade/purge/show/remove or search for.
 
=Install starts here=
 
The complete mono package includes a component (mono-xsp4) that creates a simple web server to run ASP.NET 4.0 applications. MX does not need this, so type <code>sudo update-rc.d mono-xsp4 disable</code>, to stop it being used (without needing to do a <code>sudo apt remove</code> followed by the name of component you no longer want).
 
 
=Moving from Microsoft Windows to Linux=
#* exit nano by holding control key and pressing "x" key.
 
=Operating systems=
 
New hardware might come preloaded with an operating system, or might allow you to choose which operating system to install on it.
 
Please see [[Raspberry Pi computer page]] if you want guidance on choosing which model to buy and how to install an operating system on those computers, so you are ready to install MX.
 
=Interactive Package management=
 
All Linux computers include a package manager, there is some variation between them.
 
 
==Package tool==
 
For the purposes of keeping this Wiki page simple, the package manager described in “apt” meaning “Advance Package Tool” e.g. <code>sudo ''apt'' install package_name</code>.
 
In simple terms, the inclusion of "apt" runs the “package manager” used in Linux. That is certainly true if you use the Raspberry Pi operating system, and it appears it is true for almost all modern Linux operating systems.
 
Some online tutorials refer to “apt-get” or "apt-cache" in examples they quote. My online research suggests using those directly is no longer advisable, and therefore you should leave off the part starting with a hyphen, i.e. it should be safe to replace these older package managers with "apt". I have included [[#Package Manager – a brief technical aside|a little technical explanation]] after this subsection, if this really worries you, it appears that in some variants "apt" is just a more user friendly way to call the older package.
 
If you are using an older operating system, it appears the tool available depends on the variant of Unix you have installed. The contributor of this section has done some online research, but is not familiar with all the Unix variants, so other contributors with fuller technical expertise may need to edit this section to make its applicability wider.
 
According to online documentation seen, some UNIX variants use a tool called '''RPM packet manager''', and this involves a command line specifying "zypper" in the second part of the command e.g. <code>sudo zypper install package_name</code>.
 
== Package Manager – a brief technical aside==
 
Linux operating systems install software by looking in repositories, and checking a register showing dependencies. When you ask Linux to install a particular package using “apt”, it also checks if all dependencies of the selected package are already present, and installs any that are missing.
 
If you look up on-line how to install any software in Linux, it may use “apt-get”, that is an earlier package manager, in general you can use “apt” instead now.
 
The full differences between “apt” and “apt-get” depends on your Linux flavour, so this technical aside now splits further discussion by Linux flavour.
 
===Debian as used by Raspberry Pi===
 
“Debian Linux” (and its derivatives such as “Raspberry Pi Operating System”) uses “apt” to mean a ‘’’Package Manager’’’ that can install, update, and remove packages from these computer systems.
 
For Debian Linux, “apt” is directed at the end-user (it has user friendly features like a staus bar showing progress on a long install or long upgrade, and can produce prompts about what it is doing and can give choices about whether to do individual actions).
 
There is an alternative “apt-get” which is more powerful, but directed at system level users (those who don’t want to be watching progress and possibly responding to prompts).
 
As “apt-get” is updated less frequently than “apt”, it may be it will not work with new packages. Put another way “apt-get” may never change what it can do, but “apt” may get modified to do more than it did before.
 
===Ubuntu===
 
For Ubuntu only “apt-get” was available up to 2014, when “apt” was added. Both work as described above for Debian. Again “apt” is best to use.
 
===Mint===
 
Linux Mint has a different variation. Its “apt” calls its “apt-get” and adds extra features. So both effectively do the same, but (as with previous flavours) “apt” is best to use.
 
===Other Linux===
 
It is likely that other Linux variants will also vary how these alternative commands differ.
 
 
==Interactive Package management on RPi==
 
If you are using a Raspberry Pi computer, and have the full version of the Raspberry Pi Operating System that includes the desktop interactive user interface, click the "raspberry" button on your official keyboard, or the "raspberry start-here" icon in the task bar (by default task bar appears at top of screen, but can be at side or bottom; the position where the menu icon appears is also configurable) giving you access to the '''menu'''. Scroll down to preferences, then find "Add / Remove Software" item and click that. On the top left of the screen that is displayed there is a menu item called "Options", that gives you access to the options relating to installing packages:
* '''Refresh Package Lists''' - although this is not first in list, it is the menu item that you should choose first. You see an indication of progress, but you don't get any feedback on what it finds, which is up-to-date information about status of all your existing packages.
* '''Check for updates''' - this menu item will pop up a "package updater" screen. If you have first selected the "Refresh Package Lists" menu item, then "Check for updates" will show any updates available for your existing packages, and you can tick/untick any in the list, and then click '''Quit''' or ''Install update'' buttons at bottom right of screen as appropriate. This is by far the easiest way to do updates, and avoid any update where the new version might give you problems. If you choose to update, you will be asked to supply the password.
* '''Package Log ...''' - this menu item displays (latest first) every package install or update whether done using the option above or the terminal commands described in subsequent sections.
* '''Package Sources ...''' - avoid this menu item, it should be considered an information only screen, although you could tick/untick entries there is not enough information to understand what each line represents!
The rest of the "Add / Remove Software" screen lists a lot of categories, under a search box, selecting any category causes all software in that category to be listed, component by component. None of this is friendly to novices, and I assume any technical reader can work out how to tick/untick required components. As a quick example, category "Programming" would bring up a huge list, scrolling down that list to find components starting with "php" would list what PHP components, ticking those required and the "Apply" button would install those components.
 
==Using Package Manager in terminal mode==
 
Read on for a short technical digression to explain the commands to use in a terminal session, to install and update software packages (the same commands can be used to install software for [[Your_Own_Server]], or to install software that can read the SQLite databases used by MX [[Cumulusmx.db]] and [[Diary.db]]).
 
==The various components to commands for installation==
 
Linux computers have a “source list” which references the repositories from which software packages can be installed.
 
If a particular package can not be found in repositories already in the source list, then another repository can be added to the source list.
 
===sudo===
 
By default, a Linux user should log in as a default user with limited rights.
 
For example, the Raspberry Pi (Stretch 9, or Buster 10) Operating System has a single default user "pi", with their home folder that can be referenced as "~". (To complicate the matter, RPi Bullseye 11 operating system does not predetermine the default user name, but it does enforce setting up a default user).
 
The limited rights mean that a standard user cannot even see (read) some files, cannot execute some commands, and cannot edit (write to) some files. For full access to files, the <code>sudo</code> instruction gives you (just for the command that follows) the same read/write/execute access that the system root user has.
 
For software packages, the command to be used is <code>apt</code> to invoke the package manager, followed by an "action" and then optionally by the "package name". In that context the default user's limited rights allow use of actions that just read (such as '''search''', ''show''). However, for any action involving writing (such as '''install''', ''full-upgrade'', '''update''', ''autoremove''), the package manager needs additional rights, and we prefix the "apt" with '''sudo'''.
 
: Elsewhere on this page you might notice [[#Running any MX executable with a terminal session left open|'''cd''']] can move round the file structure (without a "sudo"), but "sudo" is used with [[# Installing/Configuring the MX service and the -service parameter|'''cp''']] as that writes a file.
 
Novice readers should exercise caution before using "sudo", changing folder/file ownership, adding write rights, and even using "-R" or "-y" flag. The use of "sudo" makes it very easy to inadvertently do the wrong action, in the worst case making your computer unusable because it can delete vital folders/files because of something as simple as a typo.
 
: '''For technical readers only''', the full use of "sudo" is explained later (see [[#su_and_sudo]]).
 
 
===Action e.g. install===
 
The third part of our installation instruction is the action parameter.
 
In our current context this is “install”, which tells our package manager what we are trying to either update an existing package or install a package that we did not have before, i.e. <code>sudo apt'' install'' package_name</code>.
 
Here is full list of what can follow “apt” (if you are using a different package manager, I cannot guarantee that these can follow that package manager name), as we will use some of the alternatives later:
 
{| class="wikitable" border="1"
|-
!style="width:30px" | Instruction following “apt”
!style="width:600px" | Description
|-
! scope="row"|update
| The "source list" [[#The various components to commands for installation|mentioned earlier]] that references the repositories from which software packages can be installed, needs to be updated periodically so it reflects any changes within those repositories. The instruction "update" is included after "apt" to make sure your computer has up to date information about repositories installed, and to report if these contain packages that can be upgraded.
 
In [[#Interactive Package management on RPi]] there was mention of the need to select "Update" item in menu first, and again in terminal mode, it is necessary to do this action before you do either of the next two actions.
|-
! scope="row"|install
|To upgrade or install a particular package, and its dependencies. It is mandatory to include further parts of the command after "install", see below this table.
 
If a later part of the command includes a package name, then this action applies to the mandatory dependencies, it does not mean all components are installed; but if a later part of the command names multiple components, then dependencies of all those components will be actioned.
|-
! scope="row"|upgrade
| Once your "source list" is up to date, <code>sudo apt upgrade</code>, will actually initiate the download of newer versions now available in repositories.
 
* Note that it is not mandatory to follow this action with further parameters, but you can:
** If you include <code>-y</code> flag, or you answer 'Y' or 'y' to the prompt, then the package manager will continue, and actually replace those packages that are already installed on your computer with the downloaded newer versions, making them available for immediate use.
** If you don't specify a package name, the default "upgrade" action will exclude anything that has had a component affected by a manual "remove" action (see below)
** It is also possible to follow the "upgrade" action (and any flag) with one or more package name(s), then the upgrade will only be done for the named packages. (Does anyone know how to specify with flag, to exclude particular named packages?)
 
(You cannot upgrade the actual kernel within the operating system with this instruction, so there is no necessity to reboot your Linux computer).
|-
! scope="row"|full-upgrade
| Once your "source list" is up to date, the action "full-upgrade" can be included after "apt". The advantage of "full-upgrade" over the simple "upgrade" is that it picks up dependencies, it ensures that every package is able to work with all other packages, and so normally results in more components being upgraded. (Again, this does not affect kernel, and does not require a computer reboot).
|-
! scope="row"|autoremove
| The action "autoremove" can be included after "apt" to check all components in the packages you have installed onto your computer, and remove any components that are not needed by the dependencies of the packages you are using. A download for software frequently includes some components specifically for their software to work with particular other optional packages, and therefore installs more than you actually need.
 
When we install mono-complete later, the other packages we install do not need every component that mono-complete has installed, and “autoremove” can be used to tidy up when all our installations are finished.
|-
! scope="row"|remove
|If you want to remove just one component manually, use <code>sudo apt remove</code> followed by the name of component you no longer want.
 
One advantage of using the "remove" action is that it does not delete any related configuration files, so if we do later decide to install the package again, we don't have to repeat all configuration tasks! As a quick example, PHP is upgraded from time to time, but as an upgrade removes some system functions and adds some new ones, it is possible our existing PHP scripts will stop working if we upgrade PHP. By using the "remove" action, a future "upgrade" action will automatically exclude "php" from its default upgrades.
|-
! scope="row"|purge
| To remove any installed package and delete all related configuration files, use <code>sudo apt purge</code> then the name of the package we no longer want
|-
! scope="row"|search
|To search in repositories in source list for a package you specify after <code>apt search</code>
|-
! scope="row"|show
|To show any information available about a package that you name after the <code>apt show</code>
|}
 
=== Flags ===
 
The basic syntax is either one or two hyphens, followed by one or two letters (each letter has to be a specific case). Various examples will be seen on this page, but here just one is explained here.
 
If we selected "install" or "upgrade" to follow "apt", we can add a “-y” flag to signify that we want the install to not only down load new components but also install them. Without this flag, the package manager will ask periodically if we want it to continue, and we have to then respond with a “y” each time. For example, when we ask to install a package, "apt" will do a search, it will list what components it has found, and output how big their demands are on storage, without "-y" flag, it will then ask (at least once) if it is okay to continue to installing.
 
=== Name ===
 
The final part of the package command is the name of the package or component that we want to install/upgrade/purge/show/remove or search for.
== A very quick introduction to Linux ==
 
5,838

edits

Navigation menu