5,838
edits
m (change sequence) |
mNo edit summary |
||
<pre>sudo apt-get update
sudo apt-get upgrade</pre>
'''or''' to insert in single line type instead <
= Installing Mono =
== Installing Mono instruction ==
With all the pre-requisites correct as in previous steps, you can install mono package by simply typing <
*The "sudo" part of this gives us super-user rights when executing the instruction that follows
*The "apt-get" is one of the ways to search the Raspberry repository for applications, it is more powerful than just "apt"
*The "mono-complete" is the package we want.
With latest installs of rPi, you can also use <
It is important to note that MX requires the ''complete'' edition of mono. (There is also a cut-down developer edition of Mono that can be downloaded/installed, and that is the default installation).
==Tidying Mono Installation==
Installing mono-complete has probably added some components not needed for your particular Linux distribution. To remove unneeded components type <
Now you have what is needed to run any executable related to Cumulus, not just '''CumulusMX.exe'''.
As the Pi does not know exactly which components are needed when multiple packages are installed with various dependencies, sometimes extra components are installed which in the end are not needed when you complete all your installations.
To clear up, delete any components that are not included in dependencies by typing <
=Cumulus MX =
The download and unzip procedure is exactly same on your Raspberry Pi, as it would be on a Windows PC:
# It is recommended, you type <
#Run the browser you have available on your Raspberry Pi (the installed browser depends on what Operating System you installed)
#To find the link to latest release distribution zip in the Cumulus Wiki, open the [[Software#Current_Release|Software article in the Current_Release section]].
Follow above instructions, again.
'''Either''' install new release on top of old release, '''or''' install in new place (follow all instructions as if new installation for adding existing log files) remembering that <
== MX Back-up issues ==
**Your remote file names, if you have a local server as set up in the notes in the optional sections later, will look like ''/var/www/html/weather/trends.html'' or '''/var/www/html/weather/js/valuesRecentForTrends.js''', depending on your folder structure.
**If you pay for a commercial web server, remote file names will be as specified by them and not dependent on what device MX is on.
**Remember ''if web site is on your Pi'', MX needs full '''rw''' permissions to the HTML folder on your web site, so give permissions recursively using <
== Keeping existing data and Reports files ==
*The quickest way in WinSCP is to use its command line options.
*The following apply to all clients using GUI.
* Host - this is the IPv4 address of your Pi, I can't tell you what it is, but it is likely to be '''192.168.z.xy''' where the z is probably "1", but it could be another single figure like 0, and the xy is two (or perhaps three) figures you can find out by looking for "pi" (or whatever host username you have set on your Pi) in the admin interface for your hub or router. (It can also be found out by typing <
**If your Raspberry Pi has both Wireless and Ethernet connections, you will have two possible IPv4 addresses, choose either, the Ethernet one is likely to be quicker.
* Username - the default for this is '''raspberrypi''' (although on older Pi it might be '''Pi'''), but you can may have changed this (as described earlier). (It can be found by typing <
* Password - again the default for this is '''raspberry''' but we changed it as one of the mandatory configurations earlier.
* Port - 22 is the default, (and I have not said how you can change this on a RPi!)
=== Optional parameters to add to the instruction to run the MX engine ===
Beta builds in MX version 3.0.0 had an optional parameter <
==== Parameter for changing Port ====
#Find the '''EXISTING PATH/CumulusMX/MXutils/linux/''' sub-folder, that might be in home directory and therefore found using "~/CumulusMX/MXutils/linux" as explained elsewhere on this page
#* At time of typing this, the sub-folder only contains one file, the one we need to edit
# As described later there is a choice of editors, but you can use <
# Look for '''ExecStart=/usr/bin/mono-service -d:'''
#* Replace the path that follows the above text with the path to your CumulusMX.exe, add the '''-service''' and optionally add any other parameter (e.g. '''-debug''', -locale, -port) as described in sub-sections above.
#save file
#now copy file
:<
If you upgrade to a new release, the file in EXISTING PATH will be overwritten, but the critical file in "/etc/sytemd/system" will not be affected.
===Running as a service===
If you want MX to automatically start when your Linux computer is booted, just type <
To manually start MX as a service, (such as after any MX upgrade to a new release, or when you want to first run it), simply type <
Use <
Whichever operating system you are using, to run MX requires an instruction that changes to the directory (EXISTING PATH) where it is installed (the instruction below is assuming it is in the standard Pi user home directory, the change directory command will be different if you have installed it elsewhere), and then starting the executable (using mono in the instruction below that applies to any non-Windows operating system). You may wish to add [[Cumulus_MX#Optional_parameters_to_add_to_the_instruction_to_run_the_MX_engine|Optional_parameters]].
The simplest instruction to run Cumulus MX is <
You can start it off directly on your Pi, and then
*Just ensure you leave Pi on (with that window minimised) so that terminal session continues running.
Use <
You need to use the raspbian configuration tool '''raspi-config''',
*this can be accessed on your Pi either in a Graphical User Interface (GUI) where fewer options are available,
*or by running a command <
==== Mandatory configurations ====
Anyway, we need to replace the host name to personalise it to you, and make it harder for a hacker to know what device is represented by that network name.
*The name can most easily be changed within either Raspberian configuration utility, you will see a '''Network Options''' option, it is there that you change the network name.
*but it can also be edited by opening the file where it is stored using <
Some network options can sometimes (depends on permissions) be configured by clicking an icon on the Pi (this icon might be two red crosses if network settings are missing, two parallel arrows if the network settings are not correctly set, or the wireless symbol if your wireless network is working).
== su and sudo ==
There is a command <
Normally, all terminal sessions will use the default "pi" user, and for individual commands, you will use a "sudo" prefix each time that command needs administrative rights, as this allows a standard Pi user to do tasks that otherwise only work for the root user.
If you are using the RPi OS GUI, it provides a file manager that displays folders and files, and if you have a mouse you can click on an object to see what actions are available. The file manager has "Home" and "Root" as bookmarks by default, you can bookmark others. Typically, any new partitions created can also be accessed from bookmarks. Depending on options you select, there may be icons on the GUI desktop to link to particular folders and clicking on these offers various options including opening them in file manager.
In a terminal environment, to see what files and folders are in the current directory, type <
== external storage ==
#if your drive has partitions, then you will see further entries like '''/dev/sda1''' and ''/dev/sda2''.
#type '''df''' to see whether your drive is currently mounted (being used by computer system)
#if it is mounted, the command to use next is (type this accurately, there is a temptation to type an English word that adds an extra "n"!) <
#if the drive does not have a partition, create one using <
#*"fdisk" is a utility, it will wait for further instructions, follow each with pressing "Enter"
#*type '''n''' as instruction to create a new partition
#*type '''w''' to create the partition you have now specified for Linux.
#Now we have a partition table and a partition on our drive, we can repeat '''fdisk -l''' to see the entry now added, it might be '''/dev/sda1''', where again the "a" might be a different letter
#To format this partition for Linux, we specify "ext4" as the way to format it using <
#we need to create a folder within
#*"/media" for Linux in general
#*"/media/pi" for Raspberry PI OS
# As we will learn later, the relevant command (in RPi OS) is '''mkdir /media/pi/my_short_name''', where "my_short_name" is selected by you
#To mount our partition, we type <
#To (optionally) get our partition mounted at boot, we can use an editor (see later) to change the boot instructions, by typing <
#*In the editor, use the down arrow on your keyboard to move to last line, and then type '''/dev/sda1''' (change the "a" as necessary), then press "tab", then type '''/media/pi/my_short_name''' (change "pi/my_short_name" to whatever we used in our make directory command), then press "tab", then type '''ext4''' (again matching the format type we selected earlier), then press "tab", then type '''defaults''', then press "tab", then type '''1''', then press "tab", then finally type '''2'''
#*save the file (as described later in nano sub-section), hold down control key and press '''o'' letter key. Press "enter" again to confirm same file name.
== folder commands ==
To make a new folder in the current directory, type <
To remove a directory type in a particular path, type <
To copy folders/files from one directory to another use <
To create a logical pointer to a folder or file elsewhere, within a folder that does not have that folder/file, <
=== chmod ===
When you are attempting any of the actions listed in this article that involve reading, creating, editing, exeduting, or moving, files; you might see an error message generally because of a lack of write (or execute) permissions on an existing file or folder. Whilst <
====nano====
The full syntax is <
After typing the nano command you need to specify a filename (it might include a path, see earlier sub-section for use of '''/''' and '''~''') and there are examples later in this article, but if you decide to ''host a web site on your Pi'' then you might want to edit its home page with (.html or .php) name like <
After you have made an alteration to the current contents of the file, various options are shown at the bottom. Here are two key ones:
*Another is '''^X''' which means if you press the control key down and type X you get the exit dialogue. If you have not made any edits, or have already saved the file, this just exits the editor. If you have not used control and O to save the file, it asks whether you want to save the edited file (type '''Y'''), typing just the Y key lets save continue (any other key stroke exits without saving), then it shows the current file name, if you press '''Enter''' then that file will be overwritten.
You might find it useful to type <
====Geany====
== removing an unwanted file ==
You can remove a file with various commands, including <
== install ==
== Standard action before adding any extra packages ==
*We run <
*I remind you here that this does not update everything on your computer to the latest versions available for a Pi, that requires a different (more risky) command not taught here.
*Instead, the instruction quoted above just updates your Pi to a consistent state; based on what is in the repository you are already using.
You can install phpLiteAdmin (the significant part of that name is in the middle) to read (you can display the whole table very easily) and edit (via a friendly GUI) either, or both, of those SQLite databases.
Install it using <
I find the admin interface is not always reliable for updating the weather diary, MX uses a very simple way to access hardware;
I will mention 3 possible web servers:
#You might choose '''Apache 2''' as it is probably the most comprehensive, so if you have enough space on your Pi, install it using <
#*You might want to add Fast CGI (if you don't know what that is, skip this) and therefore add <
#You might choose '''nginx''', as it is quite popular for small computers like the Pi, install that web server with <
#You might choose '''lighttpd''', as it is designed to use as little space on your Pi as possible, install it with <
=== Install PHP Hypertext Pre-processor ===
**being able to be used either in a fairly simple way by non-technical people
**or in an object-oriented way for those more technical to achieve success with more complex scripts.
*The simplest instruction to install it is <
*To check which PHP modules have been installed by the above command, type <
*If you later want to use a database (and a tool like PhpMyAdmin), then your php modules loaded must include at least '''mysqli''' and '''mbstring'''.
*I will explain how to find the .ini files later, but unwanted modules can be commented out in your .ini file.
'''Alternatively''', you can install particular php modules, or a particular PHP version, by selecting components from a list. To do this type something like <
To test that php is installed, type <
===Creating a Home web page on your web server===
You may need to edit this file for example to specify where your include files are stored (if not in same folder as script with require/include). Replace "apache2" by "cli" in the path for the ''batch'' '''php.ini''' file that you may also need to edit.
To run a php script in batch, type <
If you want the MX external commands to run a PHP script for you, use something like "sh" as the program to run (i.e. run shell script); and in the parameters something like
Maria is an alternative that has largely similar command syntax so is likely to work with code (like MX) designed to work with MySQL. Since the MX developer (Mark Crossley) actually uses Maria DB, we can have plenty of confidence it is suitable.
To install this database server, we type <
Our database files will be stored at '''/var/lib/mysql''' by default. Our MariaDB configuration is stored at '''/etc/mysql/mariadb.conf.d/50-server.cnf''', and it is the ''datadir='' entry that controls where the database files are stored.
=== Making your database secure ===
We need to assign passwords to control access to the database by typing into terminal <
# where we are asked to type current password for the root (as no password has yet been set, simply press Enter),
# next type '''Y''' to signify we are going to set a new password for '''root''',
* a selection approach (you select a database, then select a table, then select an action)
#Start the install with <
#The PhpMyAdmin installer will ask some questions.
#Use your tab key to select <Yes> when it asks whether you want to configure with '''dbconfig-common'''.
You may prefer to install a different tool, perhaps '''adminer''' that works using a drill down approach. A drill down approach is when you select the database, then select the table, then select the row, then select the column, then select the action. This logical step by step approach is a popular approach, but does not suit everyone.
Install this drill down package with <
===Getting web and database servers ready for use===
You might have started using MX before you set up your database. There is a option in that part of the admin interface to create database tables (as required) for each of the 3 updating intervals. For example, the default name for the table updated at the standard interval is "monthly", but you could give it a name of "standard" or whatever you like.
The MX release distribution includes another executable. Type <
#if the table name is defined in the admin interface, and the table already exists in the database with the correct columns defined, then the executable will use that table.
#There is an optional second parameter that specifies the log file name to read.
#*the SQL syntax used is "insert ignore", so if the row for that log file line already exists in the table, it will skip onto next line of log file.
Similar instructions apply for the end of day table, although as there is only one daily summary log file, there is no optional second parameter, just type <
There is no way to use this executable for insert of past rows into the real-time table.
=== Restarting Web Server ===
After all these installs, we need to restart Apache (so it loads the PHP and MariaDB), by typing <
We will need to restart Apache (or whichever web server we installed) any time we change our php.ini files, database passwords, and anything else that is checked when the web server starts.
*On a Windows PC, if you right click (while viewing the boot directory on the card) there is an option called '''New''' and if you select ''a text file'' it will create an empty file with the extension '''.txt'''. (In windows there is an option to hide extensions which is on by default, so you may need to deselect this option ['''New''' menu -> ''Options''] to see this extension). On Windows you can open the file using Notepad to verify it is empty, if you gave accidentally created a file of another type like word processing it will be full of characters some of which do not display. Anyway, you must remove any extension from the file name so it is really just '''SSH'''.
Type into the file <
When the card is inserted into your Pi, on boot this file will be removed and the SSH option will be enabled. The default password is '''raspberry''', once you have successfully got SSH working. You should then use '''sudo raspi-config''' (choose option 1 = ''Change User Password'', and set the new password you will use for your SSH session next time).
If you have a Linux or Mac device, open '''Terminal'''.
Next, (assuming your Pi is running, and that your other device is on the same local network), type <
(As an alternative for Windows operating system, you can install PuTTY, this has the advantage that you can enter the connection settings into it, and configure various other options, and these are remembered, so might make it easier to use. As mentioned earlier, PuTTY and winSCP work well togther because they share settings. '''PuTTY''' software (an SSH client for Windows) can be downloaded from <
When you are using a terminal, it is a sequential device, each line is either a string of characters that you type in (these might include a backspace character) or something sent back in response. The action that result from any key combinations depend on your terminal application, not just whatever you are running on your Pi. Your mouse can't affect cursor location, but the mouse might be needed to select text, the left click might copy what is selected, and the right click might paste (what is in your PC's clipboard) at current cursor position.
== Running MX from your PC ==
If you choose to use the simple <
As I type this a new release 3.8.0 is to allow MX to run as a service, and a future release is planned to change the associated script, so anything I write here might become obsolete, and the next sub-section gives you some links to the support forum about alternatives to the new feature. Hopefully, someone will edit this article, when instructions have settled down and won't change on next release. Basically, the ability to run MX as a service, means that MX actually runs independent of the session that starts or stops the service; and therefore implies you can shut down your PC without stopping MX.
|
edits