ubuntu17.10 Install LNMP installation package core issue-GCC version, g++ version

Source: Internet
Author: User

The general problem is this, not PHP installation failed, that is, MySQL installation failed, or Nginx installation failed

is basically a fancy error. Later in the military elder brother's forum found this post: https://bbs.vpser.net/viewthread.php?tid=16700&highlight=ubuntu17.10

In simple terms, the GCC version is a problem.

I thought about it--switch version:

Let's see what the GCC and g++ are for our system.

gcc -v

The information you can get is as follows

gcc version 7.2.0

What if we want to use GCC5? First see if there is gcc5 installed,

ls /usr/bin/gcc*

Results only/usr/bin/gcc/usr/bin/gcc-7 Two, then we need to install

sudo apt-get install gcc-5 gcc-5-multilib g++-5 g++-5-multilib

After installation, enter the following command:

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 40 

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 50

Then enter:

sudo update-alternatives --config gcc

You will see the following options, and there are 3 candidates for replacing GCC (providing/USR/BIN/GCC).

Select Path Priority state
------------------------------------------------------------
* 0/USR/BIN/GCC-5 50 Auto mode
1/USR/BIN/GCC-5 50 Manual Mode
2/USR/BIN/GCC-7 40 Manual Mode

To maintain the current value [*], press ENTER, or type the number you selected:
If you want to use which GCC, enter the number.
Also set the g++

sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 50 

sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 40

If you want to delete the optional option, you can type the following command:

sudo update-alternatives --remove gcc /usr/bin/gcc-5

Here is a view of the g++ version switchable

sudo update-alternatives --config g++

One sentence: gcc and g++ versions switch to the same version at the same time, such as: GCC7, g++7, switch to GCC5, g++5, to compile successfully.

Roughly so.

Installation complete, in the browser input: http://localhost/can be normal access--tossing me for two days.

ubuntu17.10 Install LNMP installation package core issue-GCC version, g++ version

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.