Ubuntu compilation and installation software is that simple

Source: Internet
Author: User
Tags python mysql
The compiling software Ubuntu repository has thousands of software. If you add a third-party repository, you can get more! However, in some cases, you may need to compile and install the software through the source code (for instructions, see CompilingEasyHowTo): 1. The software package in the repository is unavailable; 2. The software package in the repository is too old; 3. software packages in the repository may cause unavailability of individual functions of the Program for some reason; 4. software packages in the repository may have bugs fixed by the owner; 5. You want to pass the test

Compile software

The Ubuntu repository has thousands of software. If you add a third-party repository, you can get more! However, in some cases, you may need To compile and install the software through the source code (for instructions, see Compiling Easy How ):

1. software packages in the warehouse are unavailable;

2. The software packages in the warehouse are too old;

3. software packages in the warehouse may cause unavailability of some functions of the program due to some reasons;

4. Some bugs in the software package in the repository may have been fixed by the owner;

5. You want to pass the test to help the author fix some bugs;

6. or you just want to start from scratch and try to manually compile a program;

Environment

You need to compile the software based on the language of the relevant program. The applications to be compiled are usually written in C and C ++. In this case, you need to install the gcc compiler, which can be obtained by installing the build-essential software package. In general, you need the following command to implement it:

sudo apt-get install build-essential

To run the configure and autogen. sh files, you need more programs:

sudo apt-get install automake

Finally, CheckInstall needs to securely load the program to your system:

sudo apt-get install checkinstall

If the program is written in java, you need a java run-time and compiler. You can install java according to the instructions on the java page. Sometimes a build tool ant-based java is required. The software package can be obtained from the ubuntu Repository:

sudo apt-get install gcj

If a program is written in an interpreted language, such as python and perl, you only need a parser. This is installed in ubuntu by default. You can directly run the program. In most cases, you can install python and perl programs required to run the program directly from the ubuntu repository. For more information about explanation languages, refer to the end of this article!

Do you really need to compile?

If you compile the software only because it is unavailable in the software repository, Search for the software Package in Ubuntu Package Search! Many authors have also created their own PPA, which can also be added to your software source. Launchpad is the source of many PPA prepared by the author. You can also use the following command to search for the keyword of related software through the command line (of course, replace keyword with actual terms )!

apt-cache search 
 
Get Source

Generally, the source code package is provided in some form on the author's website! The common format is tar.gzand tar.gz 2 or zip. You can use the File Extraction Tool and run the following command to decompress them:

tar -xvf file.tar.gz tar -xvf file.tar.bz2 unzip file.zip

Sometimes, you also need to use CVS to cut edge code.SudoApt-get install cvsTo installCVS. For example, searchNetworkManagerTo write the following command:

cvs -d :pserver:anonymous@anoncvs.gnome.org:/cvs/gnome login
cvs -d :pserver:anonymous@anoncvs.gnome.org:/cvs/gnome co NetworkManager

IfYou are fromCVSFor installation instructions, see the last section.

Many software packages, You can useBazaar(Sudo apt-get install bzr) FromUpstreamYou do not need to manually find the version control location to obtain the current code. For example:

bzr get lp:network-manager
Three-step compilation

Vast majorityLinuxYou can use./Configure;Make;Make installThese three steps are used for installation, and the most difficult step is usually in./ConfigureIn this step, the subsequent steps can be easily completed.

Configure

ConfigureIs a script used to do the following:
1. Used to check computer CreationIntegrity required by the package;

2. Help you change the default value as neededPath;

3. Used for activation/Disable CompilationVarious options in;

4. Used to change the program to be installedPath;
You can view the specificConfigureOptions provided by the script:

./configure --help | less

For example, DefaultConfigureThe script will specify/Usr/localNext, if you want to change the path, you can executeConfigureScript command:

./configure --PREFIX=/opt

IfIf you really want to compile from scratch, you can study it carefully.READMEOrINSTALLFile. You will see what kind of software fragment is needed. They usually have different names in these files than in the package system. Next, you can useApt-cacheToolsTo find the corresponding package. If you have compiled the package through the repository, you can also use the following command to install the dependencies of the installation package:

sudo apt-get build-dep 
 

This ensures that all required packages can be installed sinceConfigureNo error will be reported because of the old dependency package. Otherwise, you will have to continue compiling the related dependencies.

Search And repair Configure Fault

CoincidentallyIn the following situations,ConfigureMay fail:
1. CompileWhen needed-DevPackage;

2. CompileGNOMEThe application needs the correspondingGnome-levelWhile compilingKDEThe application requiresKde-level;

3. CAndC ++The Library name is alwaysLibTherefore, if./ConfigureError message: the database is lost.Foo, So you need to installLibfoo-devPackage;

4. IfConfigureSay"X regiondes", You may need to install the following packageXlibs-dev, xlibs-static-dev, x-window-system-dev",Note: Sometimes, you only needXorg-devAndX-deVYou can.-Racecar56 Under JauntyYou need to installXorg-dev and libx11-dev.

5. You can use the auto-apt tool or apt-file tool (auto-apt may be faster) to view the skills required for packages ):

sudo apt-get install auto-aptsudo auto-apt updateauto-apt search missing-file.h

Use auto-apt is the same as above. If you replace auto-apt with auto-apt!

6. If the software compilation fails, you can use the./configure-disable-FEATURE option.

7. If you fail to fix your problem, you can also seek help from the ubuntu official website.
If the configure file does not exist, check configure. ac file (it is necessary to carefully read the INSTALL and README files), if configure. the ac file exists, that is, the developer forgets to create the final configure file. You can create it by yourself, but the autoconf package is required:

sudo apt-get install autoconf

After the installation is successful, type:

autoconf

If you are lucky, a workable configure file should be created.

Compile

Good news. The configure step has been completed, and the real compilation and installation can begin. Very simple:

make

Now, if everything goes well, you should copy a working program to your source directory. You can run the following command to try it out:

src/program_name

If the program fails, it may be a program bug. At this time, you 'd better contact the author to tell him about the program's problems.

Install software package

If everything goes smoothly, you can run the following command to install the program:

sudo checkinstall

You can use CheckInstall to create a. deb package, which can be easily removed later!

However, for some reason, you do not want to use CheckInstall. This is the final method of installation (not recommended ):

sudo make install

Note:

1. If the program is a component of the kernel, you also need gcc-3.4 (on breezy) and kernel-headers, they can use laterSudo apt-get install gcc-3.4 for linux-headers-$ (uname-r). Note that after each kernel upgrade, the kernel components must be re-compiled, and the newHeaderYou must also download it again. To compile the complete kernel, seeKernelCompile.

2If you want to re-compile an existingDebianCan be usedDpkg-buildpackage-RfakerootIf some packages are lost,BuildScriptWill tell you the package name!

3If youRevision control (CVS, Bazaar, etc.) for compilation. You usually need to obtain the source code of revision control, and then add a step to run the autogen. sh script to generate the configure script for you.

Explanation language

Generally, the interpreter fails to run when the component is not installed.

1. perl is usually similar to foo: bar (for example, xml: parser). However, its package is ibfoo-bar-perl (libxml-parser-perl ), you can use apt-cache to search for files with slightly changed names, for example:

apt-cache search foo | grep bar apt-cache search xml | grep parser

2. python components are called python-module. Therefore, python mysql components are called python-mysqldb. The ing is rarely consistent here. apt-cache can help you! Search like this:

apt-cache search python | grep mysql

The required help documents are usually included in the required components!

3. ruby component naming is similar to perl, because activesupport isLibactivesuport-ruby[1.8|1.9] (If there is no special requirement, the default value is 1.8 ). Of course, you can also install the ruby package Management PlatformRubygems, However,Debian/ubuntuSome upgrade functions are disabled to ensureRubygemsAvailableAptNormal Operation. If you want to keepRubyFor more information, seeRubyOnRails.

apt-cache search ruby | grep activesupport
Comment

To find better skillsYou can considerCompilingEasyHowToBetter Retrieval.And, You will findCheckInstallIt is also very helpful:

1,CheckinstallIs it not the default method described in the document? Some people do not like to use it at the beginning of compilation.CheckinstallIs there a reason?

Modify each pageI am very cautious. I hope everyone can agree!

2,File-rollerCannot be used to extract files? No one must remember"-Jxvf"! Please introduce some simple operation tools as much as possible. Advanced users can find command line shortcuts in millions of network documents.This"The document should only provide clear methods so that you can pay more attention to them.UbuntuAnd it is easier to run those little-known software packages!

Actually,"Tar xf file"EnoughNow,GNU tarAutomatic Detection is availableAnd decompress them. If you want to enter detailed information, you can use"Tar xvf file".IfShellThe last step of compilation in providesGUISteps may cause more serious problems!

Is this instruction provided to developers or users?

Original article address: Click to browse

For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2

This article permanently updates the link address: Http://www.linuxidc.com/Linux/2014-09/106306.htm

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.