標籤:nload centos tab 執行命令 需要 ati 列表 system ram
本分類下有一個環境一鍵安裝.那這背後發生了什麼呢?咱們手動使用源碼進行安裝.
1.首先保證有一個能連網的centos.
2.百度 ningx 官網 點download http://nginx.org/en/download.html 找到最新版的nginx. 發貼時最新的是1.12 http://nginx.org/download/nginx-1.12.0.tar.gz
3.進行centos 執行命令
[Shell]
純文字查看
複製代碼?
| 1234 |
#安裝wgetyum install wget -y#安裝gcc和c++編譯器yum install gcc gcc-c++ -y |
4.建立臨時目錄 /temp 然後下載並解壓. 命令如下
[Shell]
純文字查看
複製代碼?
| 12345 |
mkdir /temp;cd /temp;wget http://nginx.org/download/nginx-1.12.0.tar.gztar zxvf ./nginx-1.12.0.tar.gzcd /temp/nginx-1.12.0 |
得到目錄
[[email protected] nginx-1.12.0]# pwd
/temp/nginx-1.12.0
[[email protected] nginx-1.12.0]# ll
total 724
drwxr-xr-x. 6 1001 1001 4096 Apr 17 11:42 auto
-rw-r--r--. 1 1001 1001 277049 Apr 12 22:46 CHANGES
-rw-r--r--. 1 1001 1001 421985 Apr 12 22:46 CHANGES.ru
drwxr-xr-x. 2 1001 1001 4096 Apr 17 11:42 conf
-rwxr-xr-x. 1 1001 1001 2481 Apr 12 22:46 configure
drwxr-xr-x. 4 1001 1001 4096 Apr 17 11:42 contrib
drwxr-xr-x. 2 1001 1001 4096 Apr 17 11:42 html
-rw-r--r--. 1 1001 1001 1397 Apr 12 22:46 LICENSE
drwxr-xr-x. 2 1001 1001 4096 Apr 17 11:42 man
-rw-r--r--. 1 1001 1001 49 Apr 12 22:46 README
drwxr-xr-x. 9 1001 1001 4096 Apr 17 11:42 src
5.linux三大安裝步驟 配置,編譯,安裝 第一步,配置
--prefix=/安裝後的路徑 注意這基本是所有安裝程式的通用的配置屬性
輸入命令
[Shell]
純文字查看
複製代碼?
| 1 |
./configure --prefix=/usr/local/nginx-mytest |
接下來會報錯 如下
./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.
咱們需要安裝一個這樣的環境對能繼續 . 根據上面的意思.咱們先安裝 pcre 再指定路徑 指定方法在上面就是 --with-pcre=<path>
6.安裝pcre.百度這個詞得到官網. 然後找到下載路徑如下
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/ 這裡面有一些列表.咱們找到最新的即可 . 目前是
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.tar.gz下載,解壓,編譯
[Shell]
純文字查看
複製代碼?
| 1234 |
mkdir /temp;cd /temp;wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.tar.gztar zxvf pcre-8.39.tar.gz |
到此得到了pcre的源碼路徑 為/temp/pcre-8.39
7.上一步得到安裝路徑/usr/local/pcre-8.39 接下來咱們從新編譯 nginx 注意別忘記 --with-pcre=<path>
[Shell]
純文字查看
複製代碼?
| 12 |
cd /temp/nginx-1.12.0./configure --prefix=/usr/local/nginx-mytest --with-pcre=/temp/pcre-8.39 |
發現完成
第二個命令就是 make 也就是編譯, 一般可以跟第三步一起執行,第三步是make install .所以我們得到命令
[Shell]
純文字查看
複製代碼?
接下來去/usr/local/nginx-mytest看看吧.安裝成功了
Linux中nginx手動安裝