Monday, November 25, 2019

Mageia, open-source operating system (OS)

 


Mageia is a free, open-source operating system (OS) based on the Linux kernel. It was created as a fork of the popular Linux distribution Mandriva Linux. The goal of Mageia is to provide a stable, user-friendly, and accessible operating system for personal computers and servers.

Mageia includes a wide range of software applications, including office tools, multimedia players, web browsers, and programming tools, among others. The OS is designed to be easy to install and use, with a graphical user interface that makes it accessible for people with little or no technical knowledge.

Mageia is maintained by a community of volunteers who contribute to the development and distribution of the OS. The project aims to provide a reliable and secure operating system that respects the freedom of users and the open-source philosophy.

How to install Mageia, 

  1. Download the Mageia ISO file: You can download the latest version of Mageia from the official website.

  2. Create a bootable USB drive: You can use a tool such as Rufus or Etcher to create a bootable USB drive with the Mageia ISO file.

  3. Boot from the USB drive: Restart your laptop and enter the BIOS or UEFI setup to change the boot order, so that the USB drive is recognized as the first boot device.

  4. Start the Mageia installer: Once the USB drive is booting, you will be presented with the Mageia planner, which will guide you through the installation process.

  5. Select the installation options: You will be prompted to select your preferred language, keyboard layout, and time zone. You will also be asked to partition your hard drive and create a user account.

  6. Install the system: The Mageia planner will then proceed to install the operating system and configure the system settings. This process may take a while, depending on the speed of your laptop.

  7. Reboot and enjoy: After the installation is complete, you will be prompted to reboot your laptop. Once the system reboots, you will be presented with the Mageia desktop and ready to start using your new operating system.

Note: Before installing Mageia, it is recommended that you backup your important data and files, as the installation process may erase any data stored on your hard drive.

 

First step with the command line of Mageia Linux OS 

When you start using Mageia Linux, one of the first things you may want to do is become familiar with the command line interface. The command line, also known as the terminal, is a powerful tool that allows you to interact with the system and perform various tasks. Here are some of the first steps you can take with the command line in Mageia Linux:

  1. Open the terminal: You can open the terminal by clicking on the terminal icon in the application menu or by using the keyboard shortcut Ctrl + Alt + T.

  2. Check the system information: To view information about your system, you can use the "uname" command. For example, to see the Linux kernel version, you can run the following command: "uname -r".

  3. List files and directories: To view the files and directories in the current directory, you can use the "ls" command. To see the contents of a directory in more detail, you can use the "ls -l" command.

  4. Change directories: To change to a different directory, you can use the "cd" command. For example, to change to the home directory, you can run the following command: "cd ~".

  5. Create and delete files and directories: To create a new file, you can use the "touch" command. To create a new directory, you can use the "mkdir" command. To delete a file, you can use the "rm" command. To delete a directory, you can use the "rmdir" command.

  6. View the contents of a file: To view the contents of a file, you can use the "cat" command. For example, to view the contents of a file named "file.txt", you can run the following command: "cat file.txt".

  7. Get help: To get help with a specific command, you can use the "man" command. For example, to get help with the "ls" command, you can run the following command: "man ls".

These are just some of the basic commands you can use to get started with the command line in Mageia Linux. With time and practice, you will be able to perform more advanced tasks and become more familiar with the system.

https://www.mageia.org/en/
1.  To become root, open a console and enter: su –
2.    To be user again, enter: exit.
3.    write the first letters and type the TAB (tabulation) key, the system will complete the name
4.    case sensitive, Image.jpg and Image.JPG are different file-names.
5.    A console opens in the folder /home/<user>.
6.    pwd (Print working directory) -> to know where you are
7.    cd (Change directory) -> to go elsewhere.
Example: cd /home/<user>/Documents/linux. This example is called an absolute path, it starts at /. If you are in /home/<user>, you can more simply write cd Documents/linux. It is called a relative path, it starts where you are. (take care to the case !)
8.       cd .. -> to go in the parent directory
9.       ls -lh -> to list what is in the directory.
10.   What is my Mageia version ? -> cat /etc/release.
11.   And the Linux one -> uname -a
12.   How is used my computer memory -> free
13.   What is consuming the computer resources -> top.
14.   How many bad blocks in my partition -> e2fsck -cyv /dev/sdxy
15.   Last installed packages -> rpm -qa --last.
Software management
·         Delete the sources -> urpmi.removemedia -a
·         Add sources -> urpmi.addmedia --distrib --mirrorlist 'http://mirrors.mageia.org/api/mageia.4.x86_64.list'
·         Update -> urpmi --auto-update --auto (execute twice if used after new sources installation)

Mounting and unmounting
·         Mounting sdb1 into /media -> mount -t ext4 /dev/sdb1 /media. ext4 is the sdb1 format. You may have ext3, vfat (DOS) or ntfs-3g (Windows XP and after).
·         Mounting a floppy ->  mount -t vfat /dev/fd0
·         Mounting a CDROM -> mount -t iso9660 -r /dev/cdrom
·         Unmounting ->  umount /dev/sdb1. Note there is no n before the m in the command name: umount
·         Suppose you want to see your USB keys automatically mounted in /media instead of /run/media/<user>/<key name>, open kwrite and copy paste:
·         To halt properly the system -> shutdown -h now without reboot, shutdown -r now with reboot.

Basic commands: Install, remove, update
urpmi PKG..                 Install or update the specified package(s).
urpme PKG..                Remove the specified package(s)
urpmi --auto-update     Update all:




Sunday, November 17, 2019

Read ADC value with nodeMCU





This is an extention for the previous post... I have added the ADC read button to get the current ADC Value.

Source Code:

#include <ESP8266WiFi.h>

const char* ssid = "Dialog 4G"; //your WiFi Name
const char* password = "YJNHQ102RD8";  //Your Wifi Password
int ledPin = D0;
int ledPin2 = D1;
const int analogInPin = A0;  // ESP8266 Analog Pin ADC0 = A0
int sensorValue = 0;  // value read from the pot
WiFiServer server(80);
//-----------------------------------------------------------------------
void setup() {
  Serial.begin(115200);
  delay(10);

  pinMode(ledPin, OUTPUT);
  digitalWrite(ledPin, LOW);
  pinMode(ledPin2, OUTPUT);
  digitalWrite(ledPin2, LOW);
//  pinMode(ADC, INPUT);
 // digitalRead(ADC);

 
 

// Connect to WiFi network------------------------------------------------
  Serial.println();
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid);

  WiFi.begin(ssid, password);

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("WiFi connected");

  // Start the server by NodeMCU
  server.begin();
  Serial.println("Server started");

  // Print the IP address on serial Monitor
  Serial.print("Use this URL to connect: ");
  Serial.print("http://");
  Serial.print(WiFi.localIP());
  Serial.println("/");

}

void loop() {
// Check if a client has connected---------------------------------------
  WiFiClient client = server.available();
  if (!client) {
    return;
  }

// Wait until the client sends some data----------------------------------
  Serial.println("new client");
  while(!client.available()){
    delay(1);
  }

// Read the first line of the request---------------------------------------
  String request = client.readStringUntil('\r');
  Serial.println(request);
  client.flush();

// Match the request-------------------------------------------------------

  int value = LOW;
  if (request.indexOf("/LED=ON") != -1)  {
    digitalWrite(ledPin, HIGH);
    value = HIGH;
  }
  if (request.indexOf("/LED=OFF") != -1)  {
    digitalWrite(ledPin, LOW);
    value = LOW;
  }
//-------------------------------------------------------------------------
   int value2 = LOW;
  if (request.indexOf("/LED2=ON") != -1)  {
    digitalWrite(ledPin2, HIGH);
    value2 = HIGH;
  }
  if (request.indexOf("/LED2=OFF") != -1)  {
    digitalWrite(ledPin2, LOW);
    value2 = LOW;
  }

// Set ledPin according to the request---------------------------------------
//digitalWrite(ledPin, value);

  // Return the response
  client.println("HTTP/1.1 200 OK");
  client.println("Content-Type: text/html");
  client.println(""); //  do not forget this one
  client.println("<!DOCTYPE HTML>");
  client.println("<html>");
 
  client.println("  <br><br>");
  client.print(" &nbsp;&nbsp;&nbsp;&nbsp;  Led is now: "); // add 4 tab spaces
   if(value == HIGH) {
    client.print("On");
  } if(value == LOW) {
    client.print("Off");
  }
  client.println(" <br><br>");
  client.println("  &nbsp;&nbsp;&nbsp;&nbsp;  <a href=\"/LED=ON\"\"><button>On </button></a>");
  client.println("  &nbsp;&nbsp;&nbsp;&nbsp;  <a href=\"/LED=OFF\"\"><button>Off </button></a><br />"); 
  client.println("</html>");
  client.println("<br><br>");

 
  client.print("  &nbsp;&nbsp;&nbsp;&nbsp;  Led2 is now: ");

  if(value2 == HIGH) {
    client.print("On");
  } if(value2 ==LOW) {
    client.print("Off");
  }
  client.println("<br><br>");
  client.println("  &nbsp;&nbsp;&nbsp;&nbsp;  <a href=\"/LED2=ON\"\"><button>On </button></a>");
  client.println("  &nbsp;&nbsp;&nbsp;&nbsp;  <a href=\"/LED2=OFF\"\"><button>Off </button></a><br />"); 
  client.println("</html>");


  sensorValue = analogRead(analogInPin); // read the analog in value
  client.println("<br><br><br>");
  client.println(" &nbsp;&nbsp;&nbsp;&nbsp; ADC:   ");
  client.println(sensorValue);
  Serial.println("ADC:   ");
  Serial.println(sensorValue);


 client.println("<br><br>");
   client.println("  &nbsp;&nbsp;&nbsp;&nbsp;  <a href=\"/sensorValue = analogRead(analogInPin)\"\"><button>Room Temperature </button></a><br />"); 
  client.println("</html>");


  delay(25);
  Serial.println("  Client disonnected");


}

Search This Blog