What is source directory linux

Standard location for holding software source files

Is there a standard location in Linux for holding source files for example OpenSSL. I am building Nginx from source with non default version of OpenSSL. I need to download and untar OpenSSL and I did it in home directory. Now, I wonder is there a standard location in Linux maybe /opt ?

As terdon wrote /usr/src is the standard location, and you may here find directories for the kernel source (/usr/src/linux linked to /usr/src/linux-version) and for example X11. Source-code for packages installed locally (/usr/local) fits better in /usr/local/src. If you want to build packages «manually» yourself, creating a src-directory in your homedir is probably a good idea. Remember you should not download, unpack or build as root — only install as! If you build deb/rpm-packages, temporary build directories (eg. under /var/tmp) are typically used instead. TBC

If you build and install a package — or create a package (rpm/dem) — yourself, you usually don’t need the source-code anymore after it’s installed. The reason why you may have the source-code for some packages — like the kernel or X11 — under /usr/src (or /usr/local/src if it was created locally), is mostly because you may need them if you’re building (or writing) some software package yourself (eg. some obscure header-files from the kernel, matching your actual system set-up). (Of course, you’ll need it if you want to build your own kernel too. ) But this applies to few packages.

4 Answers 4

Whenever you ask yourself something like this, check out the Filesystem Hierarchy Standard (FHS).There, you will find the following entry:

usr/src : Source code (optional)

Purpose

Source code may be placed in this subdirectory, only for reference purposes

So you can put your source files in subdirectories of /usr/src . That said, this is an optional directory so you can really keep them wherever you like. Source code is not relevant after you’ve compiled it into an executable so the system will never require the source of something to be accessible at a specific location.

In conclusion: /usr/src is a pretty standard location but feel free to choose your own if you prefer.

Just be aware that you really do not want to be messing with /usr/src on a non-Linux system. The BSDs keeps their base system sources there by default and you don’t want to intermingle them with third-party software. Just build in your $HOME somewhere.

The same applies to some sub-directories of /usr/src on Debian derivatives, if you have certain packages installed ( gcc-6-source , binutils-source , DKMS packages, the kernel headers etc.). On Debian, there’s a nice feature where you can add yourself to the src group which owns /usr/src , and then just write there as yourself (without needing to sudo or whatever).

Читайте также:  Linux find file with spaces

I’ll go further and say you shouldn’t really be touching /usr on any system. You should be putting things in /usr/local . Do BSDs mind you using /usr/local/src ?

It says «only for reference purposes». The same standard says you should not build source code in there, so /usr/src is definitely not the place to put your source code if you plan to do any development.

/usr/local/src is a safe place to keep source code, and build it too. The FHS says: (last line on the table):

/usr/local : Local hierarchy [. ] Requirements: The following directories, or symbolic links to directories, must be in /usr/local Directory Description [. ] src Local source code 

The /usr/local hierarchy is for use by the system administrator when installing software locally. It needs to be safe from being overwritten when the system software is updated.

It’s not clear what «Local source code» means, but it’s clear the system isn’t going to try to place anything in /usr/local/src , unlike /usr/src , so there seems to be little downside to putting code there.

In fact, I have mine on a separate filesystem:

Filesystem Size Used Avail Use% Mounted on /dev/mapper/data-local_src 79G 46G 30G 61% /usr/local/src 

Note: at least on Debian, your user needs to be added to the staff group in order to write to /usr/local .

As for what «local source code» means, in general it means controlled by the local sysadmin rather than by a distribution. The same as everything else under /usr/local (in theory). So essentially it means exactly what you described.

I don’t see the description you shared at the FHS link (pathname.com/fhs/pub/fhs-2.3.html#USRLOCALLOCALHIERARCHY). Would you be specific? (or did you grab information seperately)

@CloudCho: Look more carefully. It’s the last line on the table. I’ve now added more context, though I don’t think it’s necessary.

If by «standard» you mean conventional, then the place to unpack and build source code is your home directory. Such files are expected to be transient, deleted when you are done, or kept if you like, organised however you please. Your home directory is your area to play with all this kind of stuff.

If you do wish to keep them afterwards, for reference, the «Filesystem Hierarchy Standard» recommends /usr/src . However, this is a guide not a law; and, if you were to get into this habit then venture onto a non-Linux system, you are liable to cause trouble by following it. For example, on a BSD system, base system sources are kept there and you really don’t want to be messing with those. Even on Linux you may run the risk of mingling with any source stored by package managers, which is not desirable.

I would recommend avoiding /usr/src overall. There’s no obvious benefit to keeping anything there at all, and potential risk if you confuse its intended meaning.

Источник

Best Way To Resolve The Kernel_src_dir Directory Containing The Linux Kernel Source

It is worth trying these recovery methods if you get the kernel_src_dir with a Linux kernel source error.

Читайте также:  Linux connect to windows desktop
Question from: Hodei Mazzeo

Popular Category: Compared to General Last Updated: Jun 29, 2020

On Debian, Ubuntu and their derivatives, every bit of the kernel header files can be viewed in the / usr / src directory. You can make sure the kernel headers are the same since your kernel version is already in use on your system using the previous command.

By default, the kernel bonsai should be located in the usr / src / directory.

Likewise, is the source directory on Linux nearly definite? original command in Linux with examples. source is a sequence built into the shell that is used to execute the contents of almost any file (usually a series of commands) for reading, and is passed as a new impressive argument in the history of the current shell. txt, whose argument is usually stored in the home directory, also contains a list of commands, such as Mark vii, date and time. See also

The question will probably be where is the source code for the computer kernel in Ubuntu?

Where is the kernel tree folder?

1 answer. The bzip file containing the source code is loaded into / usr / src /. However, Ubuntu writes from the correspondingthe current source Linux kernel, which is available for download at http://www.kernel.org/. Understanding the kernel often starts with the rules of the operating system.

kernel_src_dir directory containing linux kernel source

To check your Linux kernel version, try the following instructions:

  1. uname -r: Check Linux kernel version.
  2. cat / proc / version Show: Linux kernel version with special file support.
  3. hostnamectl | grep Kernel: For a full system Linux distribution, you can use hotnamectl to display the hostname and current Linux kernel version.

How Can I Find The Source Code For The Kernel?

Where is Linux kernel source directory?

The source code that generated a specific trusted binary package can be obtained using the apt-get source

command. For example, to get the starting point of a running kernel, you can use the command: apt-get root linux-image – $ (uname -r)

What Is An Energy Guide?

Source List – Computer definition The directory / folder from which data is typically retrieved. Contrast with the list of holes.

Where Is The Linux Kernel For Photography Stored?

The kernel file in Ubuntu is stored in someone’s / boot folder and is named vmlinuz-version. The name vmlinuz currently comes from the Unix world where they only called us “Unix” because of their kernels in the 1960s, so Linux started with the “Linux” kernel when it was first developed in the 1990s in the United States.

Where Are Each Of Our Linux Sources?

Kernel.org. kernel.is org is the main source point for the Linux kernel type, which is the root of the Linux operating system.

How Do I Install The Kernel Sources?

Install kernel headers on Ubuntu along with Debian. First check the found version of your kernel as well as the kernel header package that matches your kernel performance using the following commands. On Debian, Ubuntu and all their derivatives, the kernel header files can be found in the / usr / src directory.

What Is A Hyphen In Linux?

kernel_src_dir directory containing linux kernel source

A double hyphen after a space can also be used to indicate that “this is the conclusion of orders; everything that follows is literally a filename, even if it looks like a command. ” And a real abbreviated single with no subsequent emails could mean “reading from the standard.”There is no more input, presumably from a file.”

Читайте также:  Linux socks to http proxy

What Does The Bash Command Contain?

Bash is a real shell, which usually looks at a text window where user commands are styled and triggers actions. Bash can also read execution and instructions from a file called a system script.

What Is Getting A Complete File?

What is provisioning file preparation? a file is nothing, even if the file is executed, and more importantly, changes to the file are fixed in the current shell itself, the shell we are currently working in. Typically, when a call or script is executed, another subshell is created and now the script is executed in the subshell.

What Is $ Bash_source?

Is your PC running slow? Do you have problems starting up Windows? Don’t despair! ASR Pro is the solution for you. This powerful and easy-to-use tool will diagnose and repair your PC, increasing system performance, optimizing memory, and improving security in the process. So don’t wait — download ASR Pro today!

  • 1. Download ASR Pro
  • 2. Follow the on-screen instructions to run a scan
  • 3. Restart your computer and wait for it to finish running the scan, then follow the on-screen instructions again to remove any viruses found by scanning your computer with ASR Pro

    bash_source system variable. Bash documentation: an array variable whose members are usually the source file names, in which the corresponding level function names are defined in the FUNCNAME series variables.

    What Does Additional Control Do?

    Which directory is present at the top of the Linux kernel source tree?

    The Sell to Be source can be used to load many function files the current commit script or to the command line. It reads and executes the commands of the assigned FILENAME and returns. The paths associated with $ PATH are used to find out what is in the FILENAME directory.

    What Does F Linux Stand For?

    -f –force (or) usually tells the command line software to do something, although this may not be the safest solution or even if it realizes that it is not necessary; –help (if you have knowledge of GNU, but others as well) primarily means displaying quick help, which the command line program does nothing.

    What Commands Can Be In Linux?

    Which command in Linux is the most recent command used to find the executable file associated with a given command by looking for it in the environment path variable. In fact, it has the following status Return 3: Three: when all of the specified commands are frequently encountered and executed.

    Who Designed The Bash?

    Richard Stallman and a number of like-minded developers primarily wrote Unix functionality under a license that is availableand free under the GNU license. One of the developers was hired to create a custom shell. This developer was Brian Fox.

    Where Is Bashrk?

    There are many. bashrc in each client’s home folder (99.99% of the time) and also in the system-wide (although I don’t know where it is on Ubuntu). The fastest way to access it is to go through nano ~ /. bashrc via terminal a (completely replace nano with whatever you want to use).

    Источник

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