Linux what is configured

What is a configuration file?

A configuration file (config file) is code on your computer that allows the selection of various features and settings. It can determine parameters, preferences, and alternative options in the many realms of your IT environment. Despite the complexity and vast operating systems that digital devices can contain, config files allow an operator to simplify, to choose specific preferences for a particular user experience.

In this article, we are asking (and answering) questions like: What are configuration files? What’s their functionality? And, how can they work to your advantage in a Linux® environment?

Configuration files explained

A configuration file is known by many names: Config file, conf., cfg., cf., and so on. And its function varies even more than its name. There are thousands of different config files, hard at work, on your own personal computer. In its simplest form, config files are a form of user interface. Instead of clicking buttons to make things happen, you edit text.

It’s easy to think of a config file as a high-tech customization tool. Config files allow an operator to determine storage paths, select which plug-ins to include (and not include), and even which colors and images are allowed for backgrounds and interfaces.

Config files store data for applications that enable users to interact with those applications in a specific and purposeful way. Because there are so many of them, config files can support multiple purposes. For example, if you’re trying to configure a SQL (Structured Query Language) server, you may use a configuration file to determine which IP addresses can access the database.

Config files act as a bridge between the user, a program, or an aspect of the operating system. It allows you to get into a piece of software and get a sense of what’s going on behind the scenes.

How to manage config files

Luckily, config files are as flexible as they are functional. They can be managed with a variety of different tools, whether you want to edit, change, or even create a config file from scratch.

Before you begin working with config files, you’ll need to identify which file format you’ll be working in: YAML, INI, JSON, XML, etc. Each file format works a little bit differently, so you’ll need to be aware of their particularities.

In the instance of a change, you’ll want to establish a system that allows you to comment in order to communicate changes and new standards within each config file. This will keep track of ongoing activity and alterations to the file. Make sure to leave comments that will be clear to others. Version control will be another essential facet of the config file to grant more flexibility when working through a series of changes like storage paths, ports, or time-outs

Читайте также:  Linux echo with new line

Testing will be imperative when creating a config file and changing its functionality. The testing and launch should be treated as critical in order to reach the desired result and function.

Why do configuration files matter?

Config files are a pillar of your computer. While config files can be very simple structures, they simplify extremely complex interfaces. One config file may not seem like it makes a big difference, but when that config file determines thousands of features on your device, you’ll quickly realize it’s necessary. If one minor config file goes awry, you may not notice. But if they all stopped working one day, your apps would look a lot different and you’d expect some serious technical difficulties ahead.

A major benefit is reproducibility. It makes troubleshooting a lot easier when you have just one file governing a system. Now, when you move to a different, system, all it takes is migrating a copy of your config files to replicate your settings.

Why you should keep up with config files

The purpose of config files is to make a complex system, just the opposite: simple. Config files allow you to organize, manage, and customize the applications that communicate with your operating system. These files allow operators to control extensive and often complicated systems that decide how your device functions. Without config files, there would be a lot of gaps in your operating system and your experience with technology would look very different.

What can happen if you don’t manage your config files

Managing config files can be intimidating, but what’s even more intimidating is fixing a mistake after mismanagement. It’s critical to manage your config files properly in order to keep them running like a well-oiled machine. This is one of the main reasons why it’s so important to keep track of changes within each config file. Each change may need to be referred to, reconciled, or built upon at a later date. Having the correct config file parameters at the beginning will help, but continuous management is the key to running your applications successfully.

One of the biggest challenges is knowing the options available to you. A config file may not make all of its flexibility and options known to the user. There are a finite number of buttons available on a graphical interface, but in a config file, not all of the options are written out. For instance, it will present the options «yes» and «no», but there may be another option available that isn’t visible on the surface. At first glance, it can be difficult to understand the entire scope. The more you manage and interact with your config files, the more aware you will be of your options.

Worst case scenario: things break. If you don’t know the previous settings by heart, you’re left with documentation and trial and error to get back to where you were. If the config files are completely wiped, without a backup, your computer may not run at all. This is why it is imperative that you save a backup of a config file before you make changes.

Читайте также:  Альт линукс удаленный доступ

How to manage configuration files with Linux

Linux configuration files make up a large portion of Linux operating systems. There are numerous config files for each Linux distribution. While each configuration file functions differently, they all allow you to customize your computer. Linux relies on files that you can use to change settings in a way that is understandable for the user. Linux config files are easy to change and are capable of migrating to other systems.

How Red Hat manages config files with Linux

OpenShift is managed with YAML config files. They act as a central interface for Linux, as well as Kubernetes and other systems.

It helps to think of the tabs and colons as their way of communicating. The different combinations of symbols define what the file looks like and is your tool to manipulate the system. If you want to configure something with the YAML file, there’s going to be one combination of terms that will unlock the change in the system. Knowing which «vocabulary» to use is key. Unlike the human language, where we have various vocabularies to help us get our point across, the computer needs one combination of symbols to understand the config files.

Источник

What does a typical ./configure do in Linux?

It also provides an interface to configure (aptly) compilation options. ./configure —help will (usually?) give a list of available options.

It runs a script which typically produces makefiles and «configure.h».

The script is written in the lanugage «m4» which is a macro language. The top level macros are found in autoconf.ac or (in older systems) autoconf.in. These expand containing lower level macros which in turn expand into actual tests which create small programs or tasks to check what kind of system you have.

For example AC_CHECK_HEADER([myheader.h], . ) might generate a tiny C program like:

#include "myheader.h" int main(int argc, char** argv)

If the program compiles, the check is considered «passing» otherwise it «fails». The status of such checks often gets reflected in the config.h file. On a passing check, you might find a line in config.h that looks like:

while on a test that fails, it might look like

When configured to work with autoconf in AM_INIT_AUTOMAKE macro, the Makefile can also reference the results of the tests if the variable containing the test result is exported. So if a needed library is located a few different typical locations, or the syntax of «what works» with one of your standard tools (like tar, ar, etc) is different, or the preferred tool is not available, the Makefile will be able to still build the project properly using the different library locations, the different tool syntax, or a different set of tools.

So when dealing with an Autotools project (configure / make / make install) the Makefile really doesn’t contain everything necessary to build the project, it’s generated from the Makefile.in template to specifically match your system when you type «configure».

Источник

Чарующая магия configure, make и make install

Это небольшая заметка для начинающих линуксоидов, о том что же означают эти три замечательные команды и для чего одни нужны. Начнём, как говорится, с начала. Большинство программ перед использованием надо скомпилировать, то есть преобразовать из текста понятного человеку в набор единиц и нулей, понятных компьютеру. Процесс условно разделён на три этапа: конфигурирование (configure), сборка (make) и установка (make install). Подробности под катом 🙂

Читайте также:  Kaspersky safe kids linux

./configure

Данная команда выполняет поиск необходимых для компиляции библиотек и заголовочных файлов (это для программ частично или полностью написанных на C/C++ и подобных языков), а так же настройку особых параметров или подключение специальных библиотек, в случае если ./configure обнаружит всё что ему нужно, он создаст Makefiles — файл, необходимый для сборки программы

Выполнить настройку параметров конфигуратора можно при помощи ключей и аргументов этих самых ключей, например:

./configure —prefix=/opt/my_program

При помощи ключа —prefix= Вы можете указать директорию, которая в дальнейшем будет выступать как префикс для вашей программы (то есть корневая директория). Это связанно с тем что в мире Linux и не только, существует специальная Иерархия Файловой Системы (HFS) в соответствии с которой любая программа, чтобы работать без ошибок, должна быть собрана и установлена.

В файловой системе есть три основных префикса, относительно которых большинство программ конфигурируется, а именно:

  • / — корневая директория операционной системы, так называемый ROOT
  • /usr — директория, в которой находятся приложения пользовательского окружения
  • /usr/local — дополнительная директория для пользовательских программ, собираемых вручную, специально для того чтобы операционная система не превратилась в свалку

Если открыть любую из этих директорий, то можно увидеть очень схожую структуру, как минимум там будут папки: bin, etc, include, libs, sbin.

Если запустить ./configure без ключей, то префиксом по умолчанию (директория, в которую будет установлена собираемая программа) будет /usr/local, помните это если не можете запустить свою программу, возможно у Вас не прописан путь в PATH.

Кроме ключа —prefix в конфигураторе, как правило, имеется ещё множество других ключей, посмотреть их все можно если выполнить:

./configure —help

make

Самая важная и простая команда/программа, выполняет запуск процедуры компиляции приложения из исходного кода. Для своей работы данная программа использует специальные файлы Makefiles, в которых подробно описан процесс сборки приложения со всеми параметрами, которые мы указали конфигуратору. Результатом успешного выполнения команды make будет собранная программа в текущей директории.

make install

Данная команда выполняет непосредственную установку приложения в указанную, на этапе конфигурирования, директорию, после выполнения команды make install вы можете запустить свежеустановленную программу.

Послесловие

Чтобы не писать три команды по очереди можно написать их в одну строку:

./configure && make && make install

&& — это оператор И пришедший из языка C/C++, однако, с точки зрения оболочки он означает то, что следующую команду нужно выполнить только в случае успешного выполнения предыдущей команды, это очень удобно если один из этапов завершается с ошибкой.

На самом деле make install так же может выполнить сборку, потому как задача install зависит от задачи all (то есть непосредственно сборки приложения), это означает что этап make можно пропустить и выполнить всего две команды, если записать их в одну строку получится:

./configure && make install

Удачи Вам! И спасибо за то что дочитали!

Источник

Оцените статью
Adblock
detector