Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ Linux Basic Course: Install the software from source code     - OpenSSL Introduction and compilation steps on Windows, Linux, Mac systems (Linux)

- Object-oriented language Java some of the basic features (Programming)

- How to build a container cluster (Server)

- Use Bosh deploy CloudFoundry problems encountered on OpenStack (Server)

- Linux System Getting Started Tutorial: How to change the default Java version in Linux (Linux)

- Safety testing Unix and Linux server entry succinctly (Linux)

- MongoDB Installation under CentOS 6.6 (Database)

- CentOS boot image to achieve semi-automatic installation (Linux)

- Installation of Theano + CUDA under Ubuntu (Linux)

- Linux operating system security management skills (Linux)

- Linux system performance monitoring with Nmon (Linux)

- Linux 6 install Oracle 11g (64bit) (Database)

- Volatile keyword in C language understanding (Programming)

- MySQL query plan key_len know all (Database)

- Piostat - Monitoring and Statistics Linux process (Linux)

- AIX system file security aspects (Linux)

- OpenDJ installed on RHEL6 (Linux)

- Spring WebSocket Comments (Programming)

- CentOS 5.5 install ntop (Linux)

- Fatal: unable to connect to github.com problem solving (Linux)

 
         
  Linux Basic Course: Install the software from source code
     
  Add Date : 2018-11-21      
         
         
         
  Why install software from source code

    Under what circumstances, we need to install software from the source code? I would like nothing more than these scenarios: one is that the release of a new software version, and release used does not timely follow-up, this time, you want early adopters, then it should not have to rely on their own; the other is the case regardless of software developer, or active systems do not provide binary packages can be used directly, while he have to use the software, you also need to personally it; of course, there are other circumstances. In short, learn to install software from the source code is a very important skill.

What is the make and configure

    make is a program that, when executed make, make will look makefile text file in the current directory. makefile defines the source is more information about how to compile, how to call gcc to compile the source code to generate the target file, how to link an executable file.

    How makefile is generated it? Typically, software developers will offer a test to detect the user's operating system environment, the program after testing is completed, it will take the initiative to establish the makefile.

Ready to work

    So, how to install software from the source code? First, you have to do is compile the source code required preparatory work. This has two aspects:

Compilation Tools: To compile the source code into an executable binary file compiler tools essential: gcc, g ++, make, autoconfig like. CentOS in the series, can be installed via yum -y groupinstall "Development Tools". In Ubuntu, you can install the basic compilation tools to perform sudo apt-get install build-essential instruction from the terminal. According to the actual situation of the compiler, you may need to install some other tools.

Compilation dependencies: In addition to installing the basic compilation tools in order to successfully compile the source code, we have to take this program the required dependencies installed. It contains the library functions provided by the system, as well as third-party software dependencies. CentOS in the series, you can install the appropriate dependent packages through yum -y install xxxx xxxx-devel. Ubuntu system via sudo apt-get build-dep command followed by the package name way to prepare the required dependencies. Under normal circumstances, if you configure or make an error, the error message clearly pointed out the lack of dependence, just asked to do can be. Or copy the error message to google it, you can happily resolved.

 

Source Installation 3 steps: ./configure; make && make install

    Before compiling the source code, you must download the software source code packages to your hard drive it. Generally, program source packages often are packaged as .tar.gz and .tar.bz2 both formats. The former can be used tar zxvf * .tar.gz to unpack, the latter with tar jxvf * .tar.bz2. It is recommended to extract to / usr / local / src directory: # tar xf * .tar.gz -C / usr / local / src

    Typically, after unpacking, we should read the instructions that came with the program files such as README (readme file), INSTALL (installation file), in order to understand the compiler presentation program. This step is super important! ! !

When all things are ready after, then let us to compile the source code of the trilogy it.

Configuring, building the makefile: This is the first step to compile the source code by ./configure command completes. Perform this step in order to compile the source code to prepare. Common options are --prefix = PREFIX, specify the location to install the program. More options can be found by --help. There are also some programs you need to perform this step.

Compile: Once configured through, can immediately make use of the instruction definition makefile call gcc to compile the source code for the procedure. Depending on the software, depending on the time required to compile also have differences, we have to do is be patient and wait and see. Although at this stage only simple instructions, but the problem sometimes encountered is very complex. Case more often encounter is compiled into the middle can not successfully concluded. In this case, an error message need to analyze in order to find countermeasures. You need to do make clean, then re-execute the make command.

Installation: If the compiler no problem, then run make install can install the program to the system.

Note: You must be a step by step the above steps, just one step not succeed, then there is no way to completely follow then.

Management: Planning directory, uninstalling, upgrading

Source usually extract to / usr / local / src directory

When the installation is best to install in / usr / local directory

The man page man path software is added, edit /etc/man.config, increase MANPATH entries.

The software bin directory to the PATH environment variable, edit /etc/profile.d/xxxx.sh, increase export PATH = $ PATH: / usr / local / xxx / bin

If you feel that not enough suitable compiled software you want to remove, and how to do it? We just need to compile the source code directory, execute sudo make uninstall command.

and /etc/ld.so.conf ldconfig

 Through the above explanation, we can know that the dynamic library at the assembly time and is not connected to the object code, but the program was only running is loaded into memory. If you read from the hard disk, the program will affect the efficiency of the loading operation, we can pre-load the DLL into memory cache, so in order to improve efficiency.

    How to load dynamic library cache to cache as well?

Edit /etc/ld.so.conf, add a dynamic library to be read into the cache directory

/etc/ld.so.conf Ldconfig executable will use the data read into the cache

Meanwhile, the above command also records data in the /etc/ld.so.cache

 

    ldconfig is a dynamic link library management commands, in order to allow for the dynamic link library system shared management commands needed to run the dynamic link library

Order ldconfig. Use ldconfig command, mainly in the default search directories (/ lib and / usr / lib) and the dynamic library configuration file

/etc/ld.so.conf Listed within the directory to search out shareable dynamic link library (format as previously described, lib * .so *), and then create a dynamic load

Program (ld.so) the desired connection and cache file cache file default /etc/ld.so.cache, save this file has been ranked the dynamic link library list of the names of good order.

    Shared library mechanism under linux using a mechanism similar to the cache, the information is stored in the library /etc/ld.so.cache inside.

The role of ldconfig command is:
    ldconfig creates the necessary links and cache to the most recent shared libraries found in the directories specified on the command line, in the file /etc/ld.so.conf, and in the trusted directories (/ lib and / usr / lib). The cache is used by the run-time linker, ld.so or ld-linux.so. ldconfig checks the header and filenames of the libraries it encounters when determining which versions should have their links updated.

ldconfig command issues that need attention:

1. Fill / lib and / usr / lib which add something, it does not modify /etc/ld.so.conf, but after the expiry like to stress ldconfig, otherwise the library will not be found

2. want to go outside of the top two directories add something, be sure to modify /etc/ld.so.conf, then call ldconfig, or will not be found

For example, to install a mysql / usr / local / mysql, mysql have a bunch library in / usr / local / mysql / lib below, then you need to add the following line in /etc/ld.so.conf / usr / local / mysql / lib, ldconfig after saving it, the new library can be found in the program is running.

3. If you want to put those two in the lib directory, but do not want in /etc/ld.so.conf added something (or do not have permission plus something). That may be, it is to export a global variable LD_LIBRARY_PATH, then when the program will go to this directory to find the library. In general, this is only a temporary solution, in the absence of authority or temporary candidates need to use.

4. ldconfig do these things when you run the program with relevant when compiled with nothing to do. The compile time or add -L must add, not confuse.

5. In short, no matter what changes are on the library, the best are ldconfig it, otherwise there will be some unexpected results. I do not spend too much time, but will save a lot of things.
     
         
         
         
  More:      
 
- Linux uses shared memory communication process synchronization Withdrawal (Programming)
- Linux Variable content removal and replacement (Linux)
- ActiveMQ memory settings and flow control (Linux)
- MongoDB query statistics grouping remove duplicate records (Database)
- Ubuntu 15.04 installed Nvidia Quadro series graphics driver (Linux)
- Linux Learning Notes: Users and Groups (Linux)
- CentOS 6 Install Linux kernel source (Linux)
- Inject script commands manually annotated summary (Linux)
- Use IP address spoofing Intrusion Prevention Firewall (Linux)
- Swift rewrite initialize method of navigation controller class (Programming)
- linux system optimization and security configuration (Linux)
- Source code compiled by the installation program under Linux (Linux)
- MySQL how to export files with the date format (Database)
- How to install web crawler tool in Ubuntu 14.04 LTS: Scrapy (Linux)
- Oracle 11g 10g induced into error (Database)
- Mumble installation source VoIP application on Ubuntu (Linux)
- CentOS 6.4 of cron scheduled task configuration (Linux)
- Memcached source installation and configuration under CentOS 6.6 (Server)
- File upload via AngularJS and ASP.NET MVC5 (Programming)
- Vi (Vim) keyboard map and its basic commands (Linux)
     
           
     
  CopyRight 2002-2020 newfreesoft.com, All Rights Reserved.