導航:首頁 > 源碼編譯 > centos7內網中安裝編譯器

centos7內網中安裝編譯器

發布時間:2024-10-24 21:18:36

1. centos7 gcc編譯器對c11標準的支持

gcc-std=c11main.c-omain

前提是你的gcc版本得夠新, 支持 c11才可以.

2. centos7怎麼編譯安裝gcc-c++

方法/步驟
1
yum install glibc-static libstdc++-static -y
安裝c和c++的靜態庫(據說如果系統中缺少libc.a和libstdc++.a編譯時會出錯,但是我沒有那麼多閑情逸致去試,實踐過的朋友可以回復一下,分享一下經驗,讓大家都長長見識)

2
下載解壓gcc,我的gcc目錄是gcc-4.8.0
3
進入gcc目錄,執行:
./contrib/download_prerequisites
這個神奇的腳本文件會幫我們下載、配置、安裝那三個依賴的庫。可以節約我們大量的時間和精力。
4
你以為這三個庫自動下載了、自動make install了就沒事了嗎?錯!
很多人在編譯gcc的時候出現各種奇奇怪怪的錯誤就是這步沒有做好。
它們還不在.so文件的搜索路徑裡面,需要加進去,最後切記切記一定要執行一下ldconfig。
大致做法為:
1,找到你的共享庫文件被install到哪個目錄了(updatedb+locate命令)。
2,如果你的庫不是直接放在/lib或/usr/lib下,需要修改/etc/ld.so.conf文件,加入你的共享庫的路徑
3,如果在2中添加了共享庫路徑,切記要執行一下ldconfig,更新響應cache文件讓系統能找到你的共享庫。
5
建立臨時目錄,這個目錄用以存放編譯時的大量臨時文件,是文檔要求中必須的。
我是在gcc-4.8.0下建立了一個名為gcc-build-4.8.0的目錄,進入它。
mkdir gcc-build-4.8.0
cd gcc-build-4.8.0
配置gcc編譯選項
6
強烈建議閱讀INSTALL目錄下的說明文檔,尤其是configure.html,以確定你的編譯選項。
比較基本的選項有--enable-languages,說明你要讓你的gcc支持那些語言,--disable-multilib不生成編譯為其他平台可執行代碼的交叉編譯器。--disable-checking生成的編譯器在編譯過程中不做額外檢查,也可以使用--enable-checking=xxx來增加一些檢查。
網上還說了什麼--with-gmp、--with-mpfr、--with-mpc這三個選項,但是如果你3,4步做好了,就不要配了,反之你還是老實點吧別抱僥幸心理了。
調用gcc-4.8.0目錄下的configure文件:
例如:
../configure --enable-checking=release --enable-languages=c,c++ --disable-multilib
7
執行
../make #不解釋

執行編譯命令(#在8核的虛擬機上進行編譯,每個核分配2個編譯任務)
make -j16
make install編譯過程CPU 核基本100%佔用,整個編譯用時11分50秒。
檢查gcc版本

#你就等吧少年,建議晚上睡覺前做
當然上面三步一定要在前一步順利結束的情況下進行,如果哪一步出錯了,結果都顯示error了,就不要再做後面的了。在shell的輸出里搜索"error"看具體的出錯點是什麼,、google一下為什麼。
如果你求穩的話,可以在make install之前先make check一下。

3. centos7安裝php

centos7系統源碼編譯安裝PHP7.3.5版本

新增系統用戶組和用戶:

下載PHP7.3.5

[root@localhost~]#mkdirdevdir

[root@localhost~]#cddevdir/腔李

[root@localhostdevdir]#wget

-bash:wget:未找到命令

[root@localhostdevdir]#rpm-qa|grepwget

[root@localhostdevdir]#yum-yinstallwget

[root@localhostdevdir]#rpm-qa|grepwget

wget-1.14-18.el7.x86_64

下載PHP7解壓編譯

wget-c

編譯參數解釋

--with-fpm-user=webu--with-fpm-group=webg添加PHP運行用戶和用戶組

配置信息出慶飢錯:

下載gcc軟體編譯器yuminstall-ygcc

configure:error:libxml2notfound..

下載libzip-1.5.2.tar.gz

解決libzip和cmake版本問題

重新配置PHP7編譯環境參數

libzip-1.5.2無法安裝譽圓返,已經取消了。

提示off_t類型沒有定義undefind,解決方法:

編譯安裝

測試PHP是否安裝成功

轉載自:

阿里雲默認centos7上怎麼安裝php

首先更新系統軟體/str

$yumupdate

安裝nginx/str/str

1.安裝nginx源

$yumlocalinstall.安裝nginx

$yuminstallnginx

3.啟動nginx

$servicenginxstart

Redirectingto/bin/systemctlstartnginx.service4.訪問http://你的ip/

如果成功安裝會出來nginx默認的歡迎界面

安裝MySQL5.7.*

/str

1.安裝mysql源/str

$yumlocalinstall.安裝mysql

$yuminstallmysql-community-server

確認一下mysql的版本,有時可能會提示mysql5.63.安裝mysql的開發包,以後會有用

$yuminstallmysql-community-devel

4.啟動mysql

$servicemysqldstart

Redirectingto/bin/systemctlstartmysqld.service5.查看mysql啟動狀態

$servicemysqldstatus

出現pid

證明啟動成功

6.獲取mysql默認生成的密碼

$grep'temporarypassword'/var/log/mysqld.log2015-12-05T05:41:09.104758Z1[Note]@localhost:%G1Rgns!dD!v/str

加粗的就是生成的密碼

7.換成自己的密碼

$mysql-uroot-p

Enterpassword:輸入上面的密碼

成功輸入後進入一下步,這里你估計會輸入好幾次才進去8.更換密碼

mysqlALTERUSER'root'李並@'localhost'IDENTIFIEDBY'MyNewPass4!'這個密碼一定要足夠復雜,不然會不讓你改,提示密碼不合法;9.退出mysql;

mysqlquit;

10.用新密碼再登錄,試一下新密碼

$mysql-uroot-p

Enterpassword:輸入你的新密碼

11.確認密碼正確後,退出mysql;

mysql哪衫跡quit;

編譯安裝php7.0.0

/str

/str

1.下載php7源碼包/str

$cd/rootwget-Ophp7.tar.gz.解壓源碼包/str

$tar-xvfphp7.tar.gz

3./str

$cdphp-7.0.1

4.安塌亂裝php依賴包/str

/str

$yuminstalllibxml2libxml2-developensslopenssl-develbzip2bzip2-devellibcurllibcurl-devellibjpeglibjpeg-devellibpnglibpng-develfreetypefreetype-develgmpgmp-devellibmcryptlibmcrypt-develreadlinereadline-devellibxsltlibxslt-devel5.編譯配置,這一步我們會遇到很多configureerror,我們一一解決,基本都是相關軟體開發包沒有安裝導致/str

/str

$./configure

--prefix=/usr/local/php

--with-config-file-path=/etc

--enable-fpm

--with-fpm-user=nginx

--with-fpm-group=nginx

--enable-inline-optimization

--disable-debug

--disable-rpath

--enable-shared

--enable-soap

--with-libxml-dir

--with-xmlrpc

--with-openssl

--with-mcrypt

--with-mhash

--with-pcre-regex

--with-sqlite3

--with-zlib

--enable-bcmath

--with-iconv

--with-bz2

--enable-calendar

--with-curl

--with-cdb

--enable-dom

--enable-exif

--enable-fileinfo

--enable-filter

--with-pcre-dir

--enable-ftp

--with-gd

--with-openssl-dir

--with-jpeg-dir

--with-png-dir

--with-zlib-dir

--with-freetype-dir

--enable-gd-native-ttf

--enable-gd-jis-conv

--with-gettext

--with-gmp

--with-mhash

--enable-json

--enable-mbstring

--enable-mbregex

--enable-mbregex-backtrack

--with-libmbfl

--with-onig

--enable-pdo

--with-mysqli=mysqlnd

--with-pdo-mysql=mysqlnd

--with-zlib-dir

--with-pdo-sqlite

--with-readline

--enable-session

--enable-shmop

--enable-simplexml

--enable-sockets

--enable-sysvmsg

--enable-sysvsem

--enable-sysvshm

--enable-wddx

--with-libxml-dir

--with-xsl

--enable-zip

--enable-mysqlnd-compression-support

--with-pear

--enable-opcache

configureerror:

1.configure:error:xml2-confignotfound..

解決:

$yuminstalllibxml2libxml2-devel

2.configure:error:CannotfindOpenSSL'sevp.h

解決:

$yuminstallopensslopenssl-devel

3.configure:error:解決:

$yuminstallbzip2bzip2-devel

4.configure:error:-easy.hshouldbeincurl-dir/include/curl/解決:

$yuminstalllibcurllibcurl-devel

5.Ifconfigurefailstry--with-webp-dir=DIRconfigure:error:jpeglib.hnotfound.

解決:

$yuminstalllibjpeglibjpeg-devel

6.Ifconfigurefailstry--with-webp-dir=DIR

checkingforjpeg_read_headerin-ljpeg...yesconfigure:error:png.hnotfound.

解決:

$yuminstalllibpnglibpng-devel

7.Ifconfigurefailstry--with-webp-dir=DIR

checkingforjpeg_read_headerin-ljpeg...yescheckingforpng_write_imagein-lpng...yesIfconfigurefailstry--with-xpm-dir=DIR

configure:error:freetype-confignotfound.

解決:

$yuminstallfreetypefreetype-devel

8.configure:error:Unabletolocategmp.h解決:

$yuminstallgmpgmp-devel

9.configure:error:mcrypt.hnotfound.Pleasereinstalllibmcrypt.

解決:

$yuminstalllibmcryptlibmcrypt-devel

10.configure:error:Pleasereinstallreadline-Icannotfindreadline.h解決:

$yuminstallreadlinereadline-devel

11.configure:error:xslt-confignotfound.Pleasereinstallthelibxslt=1.1.0distribution解決:

$yuminstalllibxsltlibxslt-devel

6.編譯與安裝

$makemakeinstall

這里要make好久,要耐心一下

7.添加PHP命令到環境變數

$vim/etc/profile

在末尾加入

PATH=$PATH:/usr/local/php/bin

exportPATH

要使改動立即生效執行

$./etc/profile

$source/etc/profile

查看環境變數

$echo$PATH

查看php版本

$php-v

8.配置php-fpm

$cpphp.ini-proction/etc/php.ini

$cp/usr/local/php/etc/php-fpm.conf.default/usr/local/php/etc/php-fpm.conf$cp/usr/local/php/etc/php-fpm.d//usr/local/php/etc/php-fpm.d/cpsapi/fpm/init.d.php-fpm/etc/init.d/php-fpm$chmod+x/etc/init.d/php-fpm

9.啟動php-fpm

$/etc/init.d/php-fpmstart

配置nginx虛擬機,綁定域名/str

1.

/str

$vim/etc/nginx/conf.d/php7.thinkcmf.com.conf這里可以把php7.thinkcmf.com.conf改成自己的域名把下面的內容復制到php7.thinkcmf.com.conf里server{

listen80;

server_namephp7.thinkcmf.com;

root/var/www/html/php7.thinkcmf.com;#該項要修改為你准備存放相關網頁的路徑location/{

indexindex.phpindex.htmlindex.htm;

#如果請求既不是一個文件,也不是一個目錄,則執行一下重寫規則if(!-e$request_filename)

{

#地址作為將參數rewrite到index.php上。

rewrite^/(.*)$/index.php/$1;

#若是子目錄則使用下面這句,將subdir改成目錄名稱即可。

#rewrite^/subdir/(.*)$/subdir/index.php/$1;}

}

#proxythephpscriptstophp-fpm

location~.php{

includefastcgi_params;

##pathinfo支持start

#定義變數$path_info,用於存放pathinfo信息set$path_info"";

#定義變數$real_script_name,用於存放真實地址set$real_script_name$fastcgi_script_name;#如果地址與引號內的正則表達式匹配

if($fastcgi_script_name~"^(.+?.php)(/.+)$"){#將文件地址賦值給變數$real_script_name

set$real_script_name$1;

#將文件地址後的參數賦值給變數$path_info

set$path_info$2;

}

#配置fastcgi的一些參數

fastcgi_paramSCRIPT_FILENAME$document_root$real_script_name;fastcgi_paramSCRIPT_NAME$real_script_name;fastcgi_paramPATH_INFO$path_info;

###pathinfo支持end

fastcgi_intercept_errorson;

fastcgi_pass127.0.0.1:9000;

}

}

2.重啟nginx

$servicenginxreload

3.

$vim/var/www/html/php7.thinkcmf.com/index.php/str

把下面的代碼復制到這個文件里

?php

phpinfo();

4.查看訪問

Centos7下PHP7最新版怎麼安裝

步驟1:檢查已安裝的內核版本#uname-sr步驟2:在CentOS7中升級內核接下來,安裝最新的主線穩定內核:#yum--enablerepo=elrepo-kernelinstallkernel-ml最後,重啟機器並應用最新內核,困森鏈接著運行下面的命令檢查汪孫最新內核版本還有一些代碼我不想打了,樓主就自己去後盾人看看吧對你很春盯有幫助的

=0.11)'>CentOS7編譯安裝PHP7.4提示Nopackage'libzip'found或者(libzip>=0.11)

編譯安裝PHP7.4提示Nopackage'libzip'found或者(libzip=0.11),原因凱稿是libzip沒有安裝或者版本太低,解決方法如枝鎮下:

安裝完成後,查看是否存在/usr/local/lib/pkgconfig目錄,如果存在,執行如下命令來設猛孫粗置PKG_CONFIG_PATH:

閱讀全文

與centos7內網中安裝編譯器相關的資料

熱點內容
程序員賽車的gif 瀏覽:407
購買新車能用到什麼app 瀏覽:771
阿里演算法工程師待遇 瀏覽:401
java的jar命令 瀏覽:687
編程渣的人該怎麼辦 瀏覽:714
修改器顯示文件夾為空的 瀏覽:856
單片機按鈕實現播放音樂 瀏覽:972
音量皮膚怎麼設置的安卓 瀏覽:320
編譯目錄無效 瀏覽:967
java韓順平下載 瀏覽:857
用python抓取基金凈值 瀏覽:265
渦旋壓縮機的優點 瀏覽:54
加密提取碼視頻 瀏覽:108
app上地圖用什麼開發的 瀏覽:376
python屏幕截圖選擇屏幕1或者2 瀏覽:466
centos7內網中安裝編譯器 瀏覽:40
手機下載電影無法解壓 瀏覽:95
eos程序員教程 瀏覽:967
法語中的命令式有幾種變位 瀏覽:619
倒排表設計python 瀏覽:910