Computer lessons

Synology installation MC (midnight commander). Installing mc - midnight commander install Creating virtual servers

To save yourself the hassle of using the command line, and to avoid losing your mind with the VI text editor, you need to install a file manager. Which will allow you not only to freely “travel” around the disk of your server, but also to create and edit folders (directories) and files.

How to install Midnight Commander on CentOS

For CentOS, there is the file manager Peter Norton Norton Commander, which is painfully similar to the file manager Peter Norton has known since DOS times, both in appearance and color scheme, and in functionality, the file manager Midnight Commander.
Installing it comes down to one command:

Yum install mc

To launch the Midnight Commander file manager use:

After which, communication with CentOS takes on the familiar appearance of DOS times.

YUM Package Manager

This is not the first time in this article that I have referred to the YUM command for installing software. It's time to get to know her better.

What is yum

YUM (Yellow dog Updater, Modified) is a package manager that can query package information, retrieve packages from repositories, install and remove them using automatic dependency resolution, and update the entire system to the latest package versions.

Basic yum commands

Checking for updates:

Yum check-update

Whole system update:

Yum update

Updating only a specific package:

Yum update<имя пакета>

Install package:

Yum install<имя пакета>

Remove package:

Yum remove<имя пакета>

Show all packages available in the repository:

Yum list

Check package availability in the repository (you can use wildcards ? and * in the package name):

Yum list<имя пакета>

Find a package whose name or description contains the specified value:

Yum search<строка поиска>

Clear system cache:

Yum clean all

How to roll back an update:

Yum downgrade<имя пакета>

What is the difference between the YUM UPDATE and YUM UPGRADE commands?

I kept silent about one more command - YUM UPGRADE. The action of which is similar to YUM UPDATE. The difference is that when updating packages, UPDATE saves outdated versions of packages, that is, when installing a new version of a package, the old one also remains in the system.
UPGRADE does not save previous versions. That is, complete replacement occurs.

After this, you can connect to the server via port 22 via putty. You must specify root as your username and your administrator account as your password. We go in and see the usual black console:

Although I know all the popular UNIX commands, I still prefer to use Midnight Commander or just mc. Synology doesn't have it by default and you can't just install it. I first decided to download the sources, compile and install as is usually done. But before that I decided to google the question, maybe there is a simpler way.

And he really is. To quickly and easily install MC on Synology, you just need to connect an alternative repository through the control panel and install Midnight Commander in a few mouse clicks. To do this we go to Package Center, press Settings, open the tab Package sources and add a new one:

Name - SynoCommunity

Location - http://packages.synocommunity.com

Click OK. All. Now you can select a section in the list of packages Community and there select Midnight Commander, or something else you need:

Now go to the Synology console, write 2 simple characters there mc and we work in our favorite and familiar midnight commander.

By the way, everything inside is arranged very curiously. Looks like a heavily modified RHEL or CentOS. httpd is used as a web server, but both nginx and php-fpm are installed and running in the system. The system is installed on raid1, built on mdadm, which includes a partition from each disk in the system. User volumes on lvm. Maybe someday I’ll find the time and desire, I’ll dig around and tell you more about the insides.

Online course Linux Security

If you want to understand in more detail the processes of setting up and ensuring the security of local and network infrastructure built on the Linux OS, I recommend that you get acquainted with online course "Linux Security" in OTUS. The training lasts 3 months, after which successful course graduates will be able to undergo interviews with partners. The course program is developed as a series of practical workshops and is aimed at trained students who already have knowledge and experience in Linux administration. What you'll learn:
  • Apply the best global practices and information security standards (Debian, RedHat, MitRE);
  • Use tools to detect and exploit vulnerabilities in the Linux OS;
  • Install and configure network attack detection and prevention systems;
  • Work with monitoring and containerization systems based on Docker;
Test yourself on the entrance test and see the program for more details.

Being a fan of dual-panel file managers, I simply could not pass by such a significant event! Midnight Commander, aka MC, after many years of inactivity, has been updated to version 4.6.3. It suppresses many beetles and cockroaches to the delight of ordinary users. This is what this note is dedicated to.

It must be said that Midnight Commander is the heir to the traditions of norton commander, so if anyone misses the legendary two-panel file manager, they will find its worthy replacement in Linux in the person of Midnight Commander.

What's changed in the new Midnight Commander?
Among the most striking changes: the default highlighting of file types has changed, the old and very annoying bug “The interpreter is busy executing a command” has been fixed, the amount of free space at the current mount point is displayed, and just a huge number of other changes. The developers also promise to continue hunting for bugs in the near future and combine all the accumulated patches to make Midnight Commander, beloved by many, even more beautiful.

Overall, all this is worth updating the good old Midnight Commander. There are assemblies for some distributions, so you can download mc from the project page immediately in a form assembled for your distribution. For those of us who like the author of these lines uses Rock-Solid Debian Stable, building Midnight Commander from source directly into a package will not be a problem. Just download the slice you like from here and give a few simple commands:

and write that we assembled the package ourselves, after which:
and watch how Midnight Commander comes together in a few moments. The build should go without problems, and the resulting deb package can be easily and simply installed:
This completes the installation of mc, the existing Midnight Commander will be updated to version 4.6.3. After that, type the usual mc and enjoy. This is what Midnight Commander looks like in my computer:

MC Keyboard Shortcuts
To squeeze out Midnight CommanderThat’s all, it’s worth remembering at least a few keyboard shortcuts, which can make completing tasks much easier. Keyboard shortcuts inMidnight Commanderhave a feature: combination Ctrl + x c means you need to press CTRL and X, release and then press the C key.

So, some Midnight Commander key combinations:

  • Ctrl+R updates the active panel;
  • Ctrl + X C view/change permissions (chmod) for marked files;
  • Ctrl + X O view/change owner (chown) for marked files;
  • Ctrl+S or Alt+S opens a quick search dialog (the characters entered are displayed not in the command line, but in the search line);
  • Ctrl + X A opens the virtual file systems dialog;
  • Ctrl+ \ brings up a menu of frequently used directories.
  • Ctrl+X J All background tasks are shown.
  • Ctrl + X T send selected objects to the command line
  • Ctrl + X S create a symbolic link (symlink)
  • Ctrl + X Q quick view of the file contents in the second panel.
  • Ctrl + X I quick viewing of information about the current object in the second panel.
  • ESC + T or ALT + T change the panel type (standard, shortened, extended);
  • ESC + H or ALT + H calls a list of recently executed commands;
  • Alt+G marks the first file or directory in the displayed list in the panel
  • Alt+R marks the middle file or directory in the displayed list in the panel
  • Alt+J marks the last file or directory in the displayed list in the panel
  • Alt+O the inactive panel goes to the directory pointed to by the active panel.
  • Alt + . do not show or show hidden files or directories.
  • Alt + , switch panel display mode (vertical/horizontal).
  • +(Plus) calls a window to select a group of files (regular expressions can be used)
  • \ (Backslash) unchecks a group of files (the opposite action of
    called by the "+" key).
It should be noted that at least in version 4.6.3, keyboard shortcuts may not work if the Russian layout is turned off.

Application association in Midnight commander
For example, if you highlight a PDF file and press Enter, KPDF/Evince should launch and open the PDF file. If this does not happen, go copy the settings file from /etc/mc and put it in .mc/bindings
The fact is that MC does not read the global config, which people on forums often do not write about. So you need to edit a local copy.

You can also edit this directly inside MC: F9 - Command - Edit extension file
and edit associations with file extensions there.

Links
Now the main development of Midnight Commander is underway

Operating systems of the Unix family are famous for their ghostly black screen, which for people far from the computer can often seem like something wildly unearthly, in turn, the administrators who work behind this spectacle are representatives of some secret organization.
Overall a good story that could have had an exciting sequel. However, those who have had to deal with the administration of these systems see a completely different picture. Console mode – in this mode, many servers of different plans continue to operate, the main part of the administration of which is carried out through the management console. Sometimes it is convenient to use file managers to work with the file system; we will talk about one of them, the most popular of its kind for unix systems, here.

Midnight Commander is a popular file manager that has a characteristic interface, usually blue, similar to Norton Commander or Far. If you have ever worked with similar programs, then you can guess what we are talking about. The running file manager program occupies the entire working area of ​​the screen. Visually, the interface is divided into two parts. Each part displays the contents of the current directory, as well as brief information about the files. Of course, the program can do all the basic things needed to work with files.
Now let's talk about how to install Midnight Commander on the Linux CentOS operating system.

Installing Midnight Commander from the Internet

Attention, make sure that you have access to the Internet, because... This installation method requires the presence of Internet on your server.
For convenience, you can also familiarize yourself with the information on. For example, you can check the sending of packets using the ping utility. After which you can proceed with the installation, run the command:

# yum install mc

Using the package manager, all necessary files will be downloaded automatically. You will then be asked to confirm your actions, after this procedure the file manager will be installed.

To run the program, just enter the command on the command line:

Installing Midnight Commander from CD/DVD

Everything seems beautiful, but there are times when you don’t have access to the Internet, you have an installation disk with a distribution kit, what should you do in this case? In general, there are many ways to install packages on a Linux system, and one of them is the ability to install from disk. So let's get started. As you know, in order to use a CD/DVD disk in Linux, and indeed in operating systems of the Unix family, you need to “mount” the device, in our case it is a drive with a disk. Mounting is carried out in the usual way into the file system; in our case, we will mount it into the directory that we will now create.
Create a directory:

# mkdir /media/centos

Mount the drive in the directory we just created:

# mount /dev/cdrom /media/centos

Let's check if our disk was mounted successfully:

# cd /media/centos/ # ls

After entering the commands, the contents of the disk should be displayed, if there is, then everything is as it should. After that, we use the same installation:

# yum --disablerepo=\* --enablerepo=c5-media install mc

Entering the command will initiate a dependency check, after which you will be asked to confirm the installation of the application, as in the previous method, installation from the Internet, after which the installation will be performed.