Set and view environment variables [turn] Linux software installed at several ways to install the software under Linux in several ways Linux system / usr directory Linux

Transfers are several ways to install the software under Linux

Linux system / usr directory

Linux software is installed where appropriate, explain directory

Linux software installation directory is is a luxurious, understand this is beneficial in the management of the system

/usr: System-level directory, can be understood as               C:/Windows/,

 

/usr/libUnderstood to be                                        C:/Windows/System32.

/usr/bin:Almost all system executables are installed here

/usr/local/bin:It is the user's own system can store some specific executable files, do not worry it will be overwritten behavior like upgrade system, destruction, this directory is not required

/usr/local: User-level program directory, and it can be understood           C:/Progrem Files/. Users compile their own software is installed by default to this directory.

/opt: User-level program directory can be understood as D:/Software, opt optional meaning here can be used to place a large third-party software (or games), when you do not, directly          rm -rf  off the can. When the hard disk capacity is insufficient, it may be / opt to separately mount another disk usage.

Where to put the source code?

 

/usr/src: System-level source directory.

 

/usr/local/src: User-level source directory.

 

-----------------translation-------------------

/opt

Here's where optional stuff is put. Trying out the latest Firefox beta? Install it to / opt where you can delete it without affecting other settings. Programs in here usually live inside a single folder whick contains all of their data, libraries, etc.
here where optional procedures. Do you want to try the latest firefox beta? It is installed in the / opt directory it, so, when you try to finish, would delete firefox, you can simply delete it without affecting any other system settings. To install the program under the / opt directory, all of its data, database files, etc. are placed in the same directory below.
For example: I just installed the beta version of firefox, you can opt to install under / / firefox_beta directory, / opt / firefox_beta directory contains all the files, libraries, data needed to run firefox and so on. To delete firefox, you simply delete the / opt / firefox_beta directory can be very simple.

 

/usr/local

This is where most manually installed(ie. outside of your package manager) software goes. It has the same structure as /usr. It is a good idea to leave /usr to your package manager and put any custom scripts and things into /usr/local, since nothing important normally lives in /usr/local.

Here 's where most manually installed, that is, not through the "Synaptic" or apt-get install the software. It and the / usr directory having a similar directory structure. Let the package manager to manage the / usr directory, and put any custom scripts (scripts) into the / usr / local directory, I think this should be a good idea.

I. Introduction

Linux software installation under way to install the main source, rpm installation, yum installation, and installation packages commonly used mainly in the following three ways:

  • tar package: for example, software-1.2.3-1.tar.gz. It is to use the UNIX system packaging tools tar packaged.

  • rpm package, such as the software-1.2.3-1.i386.rpm. It is to provide a Redhat Linux packet encapsulation format.

      (Now with the full name of the RPM Package Manager, formerly known as Redhat Package Manager)

  • dpkg packages, such as software-1.2.3-1.deb. It is to provide a Debain Linux packet encapsulation format.

Also, most Linux application software package named also has certain rules, it follows:

  Name - version - revision - type 
example: software-1.2.3-1.tar.gz 
Software name: software 
Version: 1.2.3 
Fixed Version: 1 
Type: tar.gz

Second, common installation method

(1) Source Installation

Nearly all open source software support running on Linux, and these software is generally distributed in source form, only Linux installed gcc, make, automake, autoconf support source installation.

① source installation way

1, cd source directory. 
2,. / Configure [the opts] 
. 3, the make 
. 4, the make the install

② source installation advantages

Source installation advantages are the following

  • Complete documentation
  • Because the code may be positioned, it is convenient debug
  • The machine best compatibility (this is because compiled machine, as long as the compiler, there is no problem of the various libraries dependent)

③ source installation disadvantage of

  • Compile trouble
  • The lack of automatic dependency management, software upgrades trouble

(2) rpm package installation

Almost all rpm packages installed on all supported Linux platforms, as exe file to install it just like under Windows, various documents have been compiled, and packaged, specify which files have been good in which folder inside, so it is convenient.

①rpm package installed manner

Since the installation is very simple, we only need to enter a command.

rpm -i xxx.rmp

Through the above command we will be able to complete the installation of the rpm package.

②rpm Pack Uninstall way

Rmp package to uninstall method is also very simple, just the following command:

rpm -e package name

③rpm package to upgrade the way

Upgrade requires the following commands:

rpm -U package name

Note that at this time we need computer networking.

(C) yum install package

yum it is not a package, it is a software installation package is the package manager in CentOS, yum also manage the dependencies, but must be completed in the case of networking.

①yum package installed manner

yum -y install

②yum Pack Uninstall way

yum remove package name

Third, the method performed after installation

  1. Some software will be automatically installed after the application list plus shortcuts, and windows, as to where to find the line.

  2. If you can not find in the application list, you can in / direct start / Run command, enter the command: Start command is the general name of the software, such as firefox, realplay, xmms, etc.

  3. You can also open a shell terminal, enter the name of the software, as in "Run command" in. If you do not know the whole command, you can enter a beginning letter, and then press the tab key to find, the system will automatically display all commands that begin with the letter of the input /

  4. You can also run directly to the installation directory startup files, executable icon under Linux and shell terminal icon like

  5. To / usr / bin directory to find the installed software startup files execute the command. Linux system to all executable file commands are made to initiate a connection in / usr / bin directory, you can go to that directory to find the startup command file of your installation, double-click to start


 

Abbreviations / usr is not the user, in fact usr is the abbreviation for Unix Software Resource, which is the Unix operating system software resources placed in a directory, rather than the user data; all of the default system software will be placed to the / usr, the system is installed, this directory will occupy most of the hard drive capacity

 

 

 

/ Usr directory is an important directory

 

table of Contents

Contents of the file should be placed

/usr/X11R6/

Important data for the X Window System is placed in the directory, the reason is because the last named X11R6 X version of the 11th edition, and the sixth version of the release was intended.

/usr/bin/

Users can use most of the commands are placed here. Please note that the differences between him / bin is. (Whether related to the boot process)

/usr/include/

Head gear c / c ++ programming language and the like (header) containing the file (the include) placed at, when we (.tar.gz mounted * software) installed in tarball some data will be used to contain a number of inside files.

/usr/lib/

Library contains the application software, the target file (object file), and the executable file or script is not the usual end users (script). Some software will provide some special instructions to set the server, these instructions will not always be the operating system administrator, it will be put to this directory friends. Note that, if you are using X86_64 Linux system, it may be / usr / lib64 / directory generated

/usr/local/

Software system administrator to install itself in its own native downloaded (non-default distribution providers), is recommended to install this directory, that would be more manageable. For example, software distribution provided by your older, you want to install newer software but do not want to remove the older version, then you can install new software at / usr / local / directory, with the original legacy software there were friends. You can go to their own / usr / local to see, the directory also has a bin, etc, include, lib ... sub-directory

/usr/sbin/

Non-system normal operation of the system commands required. The most common is that some web server software Services Directive (daemon)

/usr/share/

A place to put shared files placed in this directory data almost regardless of the hardware architecture of data can be read, because almost all text files Well. In this directory there are common these times directory: / usr / share / man: Online Help Files

/ Usr / share / doc: miscellaneous software description file

/ Usr / share / zoneinfo: Time zone and the time zone-related documents

/usr/src/

General recommended to place the source code here, src have source of meaning. As for the kernel source is recommended to be placed under / usr / src / linux / directory.

 


 

Environment Variables  Transfer

Under Linux environment variable settings and view

 

Linux is a variable species

Press the lifetime of variables to divide, Linux variables can be divided into two categories: 
permanent: the need to modify the configuration file, variable permanent. 
2 temporary: Use the export command to declare the variable fail when you close the shell.

Three ways to set variables

Add 1 / etc / profile file variables go into effect (permanent)] for all users 
with variable VI increase in the file / etc / profile files, this variable will be effective for all users of Linux, and is a "permanent" . 
For example: editing / etc / profile file, add the CLASSPATH variable 
# vi / etc / profile 
Export CLASSPATH = / JAVA_HOME / lib; $ JAVA_HOME / jre / lib.

Note: After modifying the file you wish to immediately take effect even run # source / etc / profile or can only take effect the next time the user re-enter.

2 increase in the .bash_profile file in the user directory for a single user variables [entry into force (permanent)] 
with the VI increase in variable .bash_profile file in the user directory, changing the amount of the current user will only be valid, and 'permanent . " 
For example: .bash_profile the Edit guok user directory (/ Home / guok) 
V I / H O m E / G U O K / . B A S H . P R & lt O F I L E additive was added as the internal content : E X P O R & lt T C L A S S P A T H= . / J A V A H O M E / L I B ; VI / Home / guok / .bash.profile add the following: exportCLASSPATH = / JAVAHOME / lib; 
Note: After modifying the file in order to also take effect immediately run $ source /home/guok/.bash_profile or can only take effect the next time the user re-enter.

3 run directly export command [define variables valid only for the current shell (BASH) (temporary)
using [export variable name = variable value] is defined directly in the variable command shell,

The only variable is the current shell (BASH) or a sub-shell (BASH) is valid,

shell closed, the variable also fails, there is no variable when opening a new shell, also you need to use the words need to be redefined.

Environment Variables View

1 Use the echo command to check a single environment variable. For example: 
echo the PATH $ 
2 use env to see all the environment variables. For example: 
env 
3 View all locally defined using a set of environment variables.

Use unset environment variable to delete the specified

You can set a value set environment variables. Clear values of environment variables with the unset command. If no value is specified, the variable value will be set to NULL. Examples are as follows: 
Export TEST = "the Test ..." # add an environment variable TEST Export TEST = "the Test ..." # add an environment variable TEST env | grep TEST # This command has input, to prove the environment variable TEST already exists 
= ... the Test TEST 
U the n- S E t TEST # delete the environment variable TEST 
$ env | grep TEST # this command no output, prove that the environment variable TEST already deleted

Common environment variables

PATH determines the shell to which directories to find commands or programs 
HOME current user's home directory 
history record number HISTSIZE 
LOGNAME current user's login name 
HOSTNAME refers to the name of the host 
SHELL current user Shell type 
LANGUGE language related environment variables, multiple languages can modify this environment variable 
MAIL current user's mail store directory 
PS1 primary prompt is # for the root user, for the average user is $

Guess you like

Origin www.cnblogs.com/peanutk/p/11442444.html