# 安裝所需環(huán)境
# Nginx 是 C語言開發(fā)
# gcc 安裝
安裝 nginx 需要先將官網(wǎng)下載的源碼進(jìn)行編譯,編譯依賴gcc環(huán)境,如果沒有g(shù)cc環(huán)境,則需要安裝:
[root@localhost local]# yum install gcc-c++
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.ustc.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package gcc-c++.x86_64 0:4.8.5-44.el7 will be installed
--> Processing Dependency: libstdc++-devel = 4.8.5-44.el7 for package: gcc-c++-4.8.5-44.el7.x86_64
--> Processing Dependency: libstdc++ = 4.8.5-44.el7 for package: gcc-c++-4.8.5-44.el7.x86_64
--> Processing Dependency: gcc = 4.8.5-44.el7 for package: gcc-c++-4.8.5-44.el7.x86_64
--> Processing Dependency: libmpfr.so.4()(64bit) for package: gcc-c++-4.8.5-44.el7.x86_64
--> Processing Dependency: libmpc.so.3()(64bit) for package: gcc-c++-4.8.5-44.el7.x86_64
--> Running transaction check
---> Package gcc.x86_64 0:4.8.5-44.el7 will be installed
--> Processing Dependency: libgomp = 4.8.5-44.el7 for package: gcc-4.8.5-44.el7.x86_64
--> Processing Dependency: cpp = 4.8.5-44.el7 for package: gcc-4.8.5-44.el7.x86_64
--> Processing Dependency: libgcc >= 4.8.5-44.el7 for package: gcc-4.8.5-44.el7.x86_64
--> Processing Dependency: glibc-devel >= 2.2.90-12 for package: gcc-4.8.5-44.el7.x86_64
---> Package libmpc.x86_64 0:1.0.1-3.el7 will be installed
---> Package libstdc++.x86_64 0:4.8.5-36.el7 will be updated
---> Package libstdc++.x86_64 0:4.8.5-44.el7 will be an update
---> Package libstdc++-devel.x86_64 0:4.8.5-44.el7 will be installed
---> Package mpfr.x86_64 0:3.1.1-4.el7 will be installed
--> Running transaction check
---> Package cpp.x86_64 0:4.8.5-44.el7 will be installed
---> Package glibc-devel.x86_64 0:2.17-325.el7_9 will be installed
--> Processing Dependency: glibc-headers = 2.17-325.el7_9 for package: glibc-devel-2.17-325.el7_9.x86_64
--> Processing Dependency: glibc = 2.17-325.el7_9 for package: glibc-devel-2.17-325.el7_9.x86_64
--> Processing Dependency: glibc-headers for package: glibc-devel-2.17-325.el7_9.x86_64
---> Package libgcc.x86_64 0:4.8.5-36.el7 will be updated
---> Package libgcc.x86_64 0:4.8.5-44.el7 will be an update
---> Package libgomp.x86_64 0:4.8.5-36.el7 will be updated
---> Package libgomp.x86_64 0:4.8.5-44.el7 will be an update
--> Running transaction check
---> Package glibc.x86_64 0:2.17-260.el7 will be updated
--> Processing Dependency: glibc = 2.17-260.el7 for package: glibc-common-2.17-260.el7.x86_64
---> Package glibc.x86_64 0:2.17-325.el7_9 will be an update
---> Package glibc-headers.x86_64 0:2.17-325.el7_9 will be installed
--> Processing Dependency: kernel-headers >= 2.2.1 for package: glibc-headers-2.17-325.el7_9.x86_64
--> Processing Dependency: kernel-headers for package: glibc-headers-2.17-325.el7_9.x86_64
--> Running transaction check
---> Package glibc-common.x86_64 0:2.17-260.el7 will be updated
---> Package glibc-common.x86_64 0:2.17-325.el7_9 will be an update
---> Package kernel-headers.x86_64 0:3.10.0-1160.59.1.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
============================================================================================================ Package Arch Version Repository Size
============================================================================================================Installing:
gcc-c++ x86_64 4.8.5-44.el7 base 7.2 M
Installing for dependencies:
cpp x86_64 4.8.5-44.el7 base 5.9 M
gcc x86_64 4.8.5-44.el7 base 16 M
glibc-devel x86_64 2.17-325.el7_9 updates 1.1 M
glibc-headers x86_64 2.17-325.el7_9 updates 691 k
kernel-headers x86_64 3.10.0-1160.59.1.el7 updates 9.1 M
libmpc x86_64 1.0.1-3.el7 base 51 k
libstdc++-devel x86_64 4.8.5-44.el7 base 1.5 M
mpfr x86_64 3.1.1-4.el7 base 203 k
Updating for dependencies:
glibc x86_64 2.17-325.el7_9 updates 3.6 M
glibc-common x86_64 2.17-325.el7_9 updates 12 M
libgcc x86_64 4.8.5-44.el7 base 103 k
libgomp x86_64 4.8.5-44.el7 base 159 k
libstdc++ x86_64 4.8.5-44.el7 base 306 k
Transaction Summary
============================================================================================================Install 1 Package (+8 Dependent packages)
Upgrade ( 5 Dependent packages)
Total download size: 58 M
Is this ok [y/d/N]: y
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/14): glibc-2.17-325.el7_9.x86_64.rpm | 3.6 MB 00:00:00
(2/14): glibc-devel-2.17-325.el7_9.x86_64.rpm | 1.1 MB 00:00:00
(3/14): glibc-headers-2.17-325.el7_9.x86_64.rpm | 691 kB 00:00:00
(4/14): glibc-common-2.17-325.el7_9.x86_64.rpm | 12 MB 00:00:02
(5/14): kernel-headers-3.10.0-1160.59.1.el7.x86_64.rpm | 9.1 MB 00:00:01
(6/14): libgcc-4.8.5-44.el7.x86_64.rpm | 103 kB 00:00:00
(7/14): libmpc-1.0.1-3.el7.x86_64.rpm | 51 kB 00:00:00
(8/14): libstdc++-4.8.5-44.el7.x86_64.rpm | 306 kB 00:00:00
(9/14): libstdc++-devel-4.8.5-44.el7.x86_64.rpm | 1.5 MB 00:00:00
(10/14): mpfr-3.1.1-4.el7.x86_64.rpm | 203 kB 00:00:00
(11/14): libgomp-4.8.5-44.el7.x86_64.rpm | 159 kB 00:00:03
cpp-4.8.5-44.el7.x86_64.rpm FAILED MB/s | 32 MB 00:00:09 ETA
http://mirrors.cn99.com/centos/7.9.2009/os/x86_64/Packages/cpp-4.8.5-44.el7.x86_64.rpm: [Errno 14] HTTP Error 502 - Bad Gateway
Trying other mirror.
gcc-4.8.5-44.el7.x86_64.rpm FAILED
http://mirrors.cn99.com/centos/7.9.2009/os/x86_64/Packages/gcc-4.8.5-44.el7.x86_64.rpm: [Errno 14] HTTP Error 502 - Bad Gateway
Trying other mirror.
(12/14): cpp-4.8.5-44.el7.x86_64.rpm | 5.9 MB 00:00:00
(13/14): gcc-4.8.5-44.el7.x86_64.rpm | 16 MB 00:00:02
(14/14): gcc-c++-4.8.5-44.el7.x86_64.rpm | 7.2 MB 00:00:12
------------------------------------------------------------------------------------------------------------Total 4.6 MB/s | 58 MB 00:00:12
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Updating : libgcc-4.8.5-44.el7.x86_64 1/19
Updating : glibc-common-2.17-325.el7_9.x86_64 2/19
Updating : glibc-2.17-325.el7_9.x86_64 3/19
warning: /etc/nsswitch.conf created as /etc/nsswitch.conf.rpmnew
Installing : mpfr-3.1.1-4.el7.x86_64 4/19
Installing : libmpc-1.0.1-3.el7.x86_64 5/19
Updating : libstdc++-4.8.5-44.el7.x86_64 6/19
Installing : libstdc++-devel-4.8.5-44.el7.x86_64 7/19
Installing : cpp-4.8.5-44.el7.x86_64 8/19
Updating : libgomp-4.8.5-44.el7.x86_64 9/19
Installing : kernel-headers-3.10.0-1160.59.1.el7.x86_64 10/19
Installing : glibc-headers-2.17-325.el7_9.x86_64 11/19
Installing : glibc-devel-2.17-325.el7_9.x86_64 12/19
Installing : gcc-4.8.5-44.el7.x86_64 13/19
Installing : gcc-c++-4.8.5-44.el7.x86_64 14/19
Cleanup : libstdc++-4.8.5-36.el7.x86_64 15/19
Cleanup : libgomp-4.8.5-36.el7.x86_64 16/19
Cleanup : glibc-common-2.17-260.el7.x86_64 17/19
Cleanup : glibc-2.17-260.el7.x86_64 18/19
Cleanup : libgcc-4.8.5-36.el7.x86_64 19/19
Verifying : gcc-c++-4.8.5-44.el7.x86_64 1/19
Verifying : libstdc++-4.8.5-44.el7.x86_64 2/19
Verifying : libgomp-4.8.5-44.el7.x86_64 3/19
Verifying : glibc-devel-2.17-325.el7_9.x86_64 4/19
Verifying : mpfr-3.1.1-4.el7.x86_64 5/19
Verifying : cpp-4.8.5-44.el7.x86_64 6/19
Verifying : gcc-4.8.5-44.el7.x86_64 7/19
Verifying : glibc-headers-2.17-325.el7_9.x86_64 8/19
Verifying : libstdc++-devel-4.8.5-44.el7.x86_64 9/19
Verifying : libmpc-1.0.1-3.el7.x86_64 10/19
Verifying : kernel-headers-3.10.0-1160.59.1.el7.x86_64 11/19
Verifying : glibc-2.17-325.el7_9.x86_64 12/19
Verifying : libgcc-4.8.5-44.el7.x86_64 13/19
Verifying : glibc-common-2.17-325.el7_9.x86_64 14/19
Verifying : glibc-2.17-260.el7.x86_64 15/19
Verifying : libgomp-4.8.5-36.el7.x86_64 16/19
Verifying : libgcc-4.8.5-36.el7.x86_64 17/19
Verifying : glibc-common-2.17-260.el7.x86_64 18/19
Verifying : libstdc++-4.8.5-36.el7.x86_64 19/19
Installed:
gcc-c++.x86_64 0:4.8.5-44.el7
Dependency Installed:
cpp.x86_64 0:4.8.5-44.el7 gcc.x86_64 0:4.8.5-44.el7
glibc-devel.x86_64 0:2.17-325.el7_9 glibc-headers.x86_64 0:2.17-325.el7_9
kernel-headers.x86_64 0:3.10.0-1160.59.1.el7 libmpc.x86_64 0:1.0.1-3.el7
libstdc++-devel.x86_64 0:4.8.5-44.el7 mpfr.x86_64 0:3.1.1-4.el7
Dependency Updated:
glibc.x86_64 0:2.17-325.el7_9 glibc-common.x86_64 0:2.17-325.el7_9 libgcc.x86_64 0:4.8.5-44.el7
libgomp.x86_64 0:4.8.5-44.el7 libstdc++.x86_64 0:4.8.5-44.el7
Complete!
# PCRE pcre-devel 安裝
PCRE(Perl Compatible Regular Expressions) 是一個(gè)Perl庫,包括 perl 兼容的正則表達(dá)式庫。nginx 的 http 模塊使用 pcre 來解析正則表達(dá)式,所以需要在 linux 上安裝 pcre 庫,pcre-devel 是使用 pcre 開發(fā)的一個(gè)二次開發(fā)庫。nginx也需要此庫。命令:
[root@localhost local]# yum install -y pcre pcre-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.ustc.edu.cn
Package pcre-8.32-17.el7.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package pcre-devel.x86_64 0:8.32-17.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
============================================================================================================ Package Arch Version Repository Size
============================================================================================================Installing:
pcre-devel x86_64 8.32-17.el7 base 480 k
Transaction Summary
============================================================================================================Install 1 Package
Total download size: 480 k
Installed size: 1.4 M
Downloading packages:
pcre-devel-8.32-17.el7.x86_64.rpm | 480 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : pcre-devel-8.32-17.el7.x86_64 1/1
Verifying : pcre-devel-8.32-17.el7.x86_64 1/1
Installed:
pcre-devel.x86_64 0:8.32-17.el7
Complete!
# zlib安裝
zlib 庫提供了很多種壓縮和解壓縮的方式, nginx 使用 zlib 對 http 包的內(nèi)容進(jìn)行 gzip ,所以需要在 Centos 上安裝 zlib 庫。
[root@localhost local]# yum install -y pcre pcre-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.ustc.edu.cn
Package pcre-8.32-17.el7.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package pcre-devel.x86_64 0:8.32-17.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
============================================================================================================ Package Arch Version Repository Size
============================================================================================================Installing:
pcre-devel x86_64 8.32-17.el7 base 480 k
Transaction Summary
============================================================================================================Install 1 Package
Total download size: 480 k
Installed size: 1.4 M
Downloading packages:
pcre-devel-8.32-17.el7.x86_64.rpm | 480 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : pcre-devel-8.32-17.el7.x86_64 1/1
Verifying : pcre-devel-8.32-17.el7.x86_64 1/1
Installed:
pcre-devel.x86_64 0:8.32-17.el7
Complete!
[root@localhost local]# yum install -y zlib zlib-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.ustc.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package zlib.x86_64 0:1.2.7-18.el7 will be updated
---> Package zlib.x86_64 0:1.2.7-19.el7_9 will be an update
---> Package zlib-devel.x86_64 0:1.2.7-19.el7_9 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
============================================================================================================ Package Arch Version Repository Size
============================================================================================================Installing:
zlib-devel x86_64 1.2.7-19.el7_9 updates 50 k
Updating:
zlib x86_64 1.2.7-19.el7_9 updates 90 k
Transaction Summary
============================================================================================================Install 1 Package
Upgrade 1 Package
Total download size: 140 k
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/2): zlib-1.2.7-19.el7_9.x86_64.rpm | 90 kB 00:00:00
(2/2): zlib-devel-1.2.7-19.el7_9.x86_64.rpm | 50 kB 00:00:00
------------------------------------------------------------------------------------------------------------Total 535 kB/s | 140 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Updating : zlib-1.2.7-19.el7_9.x86_64 1/3
Installing : zlib-devel-1.2.7-19.el7_9.x86_64 2/3
Cleanup : zlib-1.2.7-18.el7.x86_64 3/3
Verifying : zlib-devel-1.2.7-19.el7_9.x86_64 1/3
Verifying : zlib-1.2.7-19.el7_9.x86_64 2/3
Verifying : zlib-1.2.7-18.el7.x86_64 3/3
Installed:
zlib-devel.x86_64 0:1.2.7-19.el7_9
Updated:
zlib.x86_64 0:1.2.7-19.el7_9
# OpenSSL 安裝
OpenSSL 是一個(gè)強(qiáng)大的安全套接字層密碼庫,囊括主要的密碼算法、常用的密鑰和證書封裝管理功能及 SSL 協(xié)議,并提供豐富的應(yīng)用程序供測試或其它目的使用。
nginx 不僅支持 http 協(xié)議,還支持 https(即在ssl協(xié)議上傳輸http),所以需要在 Centos 安裝 OpenSSL 庫。
[root@localhost local]# yum install -y openssl openssl-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.ustc.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package openssl.x86_64 1:1.0.2k-16.el7 will be updated
---> Package openssl.x86_64 1:1.0.2k-24.el7_9 will be an update
--> Processing Dependency: openssl-libs(x86-64) = 1:1.0.2k-24.el7_9 for package: 1:openssl-1.0.2k-24.el7_9.x86_64
---> Package openssl-devel.x86_64 1:1.0.2k-24.el7_9 will be installed
--> Processing Dependency: krb5-devel(x86-64) for package: 1:openssl-devel-1.0.2k-24.el7_9.x86_64
--> Running transaction check
---> Package krb5-devel.x86_64 0:1.15.1-51.el7_9 will be installed
--> Processing Dependency: libkadm5(x86-64) = 1.15.1-51.el7_9 for package: krb5-devel-1.15.1-51.el7_9.x86_64--> Processing Dependency: krb5-libs(x86-64) = 1.15.1-51.el7_9 for package: krb5-devel-1.15.1-51.el7_9.x86_64
--> Processing Dependency: libverto-devel for package: krb5-devel-1.15.1-51.el7_9.x86_64
--> Processing Dependency: libselinux-devel for package: krb5-devel-1.15.1-51.el7_9.x86_64
--> Processing Dependency: libcom_err-devel for package: krb5-devel-1.15.1-51.el7_9.x86_64
--> Processing Dependency: keyutils-libs-devel for package: krb5-devel-1.15.1-51.el7_9.x86_64
---> Package openssl-libs.x86_64 1:1.0.2k-16.el7 will be updated
---> Package openssl-libs.x86_64 1:1.0.2k-24.el7_9 will be an update
--> Running transaction check
---> Package keyutils-libs-devel.x86_64 0:1.5.8-3.el7 will be installed
---> Package krb5-libs.x86_64 0:1.15.1-34.el7 will be updated
---> Package krb5-libs.x86_64 0:1.15.1-51.el7_9 will be an update
---> Package libcom_err-devel.x86_64 0:1.42.9-19.el7 will be installed
--> Processing Dependency: libcom_err(x86-64) = 1.42.9-19.el7 for package: libcom_err-devel-1.42.9-19.el7.x86_64
---> Package libkadm5.x86_64 0:1.15.1-51.el7_9 will be installed
---> Package libselinux-devel.x86_64 0:2.5-15.el7 will be installed
--> Processing Dependency: libselinux(x86-64) = 2.5-15.el7 for package: libselinux-devel-2.5-15.el7.x86_64
--> Processing Dependency: libsepol-devel(x86-64) >= 2.5-10 for package: libselinux-devel-2.5-15.el7.x86_64
--> Processing Dependency: pkgconfig(libsepol) for package: libselinux-devel-2.5-15.el7.x86_64
---> Package libverto-devel.x86_64 0:0.2.5-4.el7 will be installed
--> Running transaction check
---> Package libcom_err.x86_64 0:1.42.9-13.el7 will be updated
--> Processing Dependency: libcom_err(x86-64) = 1.42.9-13.el7 for package: e2fsprogs-1.42.9-13.el7.x86_64
--> Processing Dependency: libcom_err(x86-64) = 1.42.9-13.el7 for package: e2fsprogs-libs-1.42.9-13.el7.x86_64
--> Processing Dependency: libcom_err(x86-64) = 1.42.9-13.el7 for package: libss-1.42.9-13.el7.x86_64
---> Package libcom_err.x86_64 0:1.42.9-19.el7 will be an update
---> Package libselinux.x86_64 0:2.5-14.1.el7 will be updated
--> Processing Dependency: libselinux(x86-64) = 2.5-14.1.el7 for package: libselinux-python-2.5-14.1.el7.x86_64
--> Processing Dependency: libselinux(x86-64) = 2.5-14.1.el7 for package: libselinux-utils-2.5-14.1.el7.x86_64
---> Package libselinux.x86_64 0:2.5-15.el7 will be an update
---> Package libsepol-devel.x86_64 0:2.5-10.el7 will be installed
--> Running transaction check
---> Package e2fsprogs.x86_64 0:1.42.9-13.el7 will be updated
---> Package e2fsprogs.x86_64 0:1.42.9-19.el7 will be an update
---> Package e2fsprogs-libs.x86_64 0:1.42.9-13.el7 will be updated
---> Package e2fsprogs-libs.x86_64 0:1.42.9-19.el7 will be an update
---> Package libselinux-python.x86_64 0:2.5-14.1.el7 will be updated
---> Package libselinux-python.x86_64 0:2.5-15.el7 will be an update
---> Package libselinux-utils.x86_64 0:2.5-14.1.el7 will be updated
---> Package libselinux-utils.x86_64 0:2.5-15.el7 will be an update
---> Package libss.x86_64 0:1.42.9-13.el7 will be updated
---> Package libss.x86_64 0:1.42.9-19.el7 will be an update
--> Finished Dependency Resolution
Dependencies Resolved
============================================================================================================ Package Arch Version Repository Size
============================================================================================================Installing:
openssl-devel x86_64 1:1.0.2k-24.el7_9 updates 1.5 M
Updating:
openssl x86_64 1:1.0.2k-24.el7_9 updates 494 k
Installing for dependencies:
keyutils-libs-devel x86_64 1.5.8-3.el7 base 37 k
krb5-devel x86_64 1.15.1-51.el7_9 updates 273 k
libcom_err-devel x86_64 1.42.9-19.el7 base 32 k
libkadm5 x86_64 1.15.1-51.el7_9 updates 179 k
libselinux-devel x86_64 2.5-15.el7 base 187 k
libsepol-devel x86_64 2.5-10.el7 base 77 k
libverto-devel x86_64 0.2.5-4.el7 base 12 k
Updating for dependencies:
e2fsprogs x86_64 1.42.9-19.el7 base 701 k
e2fsprogs-libs x86_64 1.42.9-19.el7 base 168 k
krb5-libs x86_64 1.15.1-51.el7_9 updates 809 k
libcom_err x86_64 1.42.9-19.el7 base 42 k
libselinux x86_64 2.5-15.el7 base 162 k
libselinux-python x86_64 2.5-15.el7 base 236 k
libselinux-utils x86_64 2.5-15.el7 base 151 k
libss x86_64 1.42.9-19.el7 base 47 k
openssl-libs x86_64 1:1.0.2k-24.el7_9 updates 1.2 M
Transaction Summary
============================================================================================================Install 1 Package (+7 Dependent packages)
Upgrade 1 Package (+9 Dependent packages)
Total download size: 6.2 M
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/18): e2fsprogs-libs-1.42.9-19.el7.x86_64.rpm | 168 kB 00:00:00
(2/18): keyutils-libs-devel-1.5.8-3.el7.x86_64.rpm | 37 kB 00:00:00
(3/18): e2fsprogs-1.42.9-19.el7.x86_64.rpm | 701 kB 00:00:00
(4/18): libcom_err-1.42.9-19.el7.x86_64.rpm | 42 kB 00:00:00
(5/18): libcom_err-devel-1.42.9-19.el7.x86_64.rpm | 32 kB 00:00:00
(6/18): libselinux-2.5-15.el7.x86_64.rpm | 162 kB 00:00:00
(7/18): libselinux-python-2.5-15.el7.x86_64.rpm | 236 kB 00:00:00
(8/18): libselinux-utils-2.5-15.el7.x86_64.rpm | 151 kB 00:00:00
(9/18): libsepol-devel-2.5-10.el7.x86_64.rpm | 77 kB 00:00:00
(10/18): libss-1.42.9-19.el7.x86_64.rpm | 47 kB 00:00:00
(11/18): libverto-devel-0.2.5-4.el7.x86_64.rpm | 12 kB 00:00:00
(12/18): krb5-devel-1.15.1-51.el7_9.x86_64.rpm | 273 kB 00:00:00
(13/18): libkadm5-1.15.1-51.el7_9.x86_64.rpm | 179 kB 00:00:00
(14/18): openssl-1.0.2k-24.el7_9.x86_64.rpm | 494 kB 00:00:00
(15/18): libselinux-devel-2.5-15.el7.x86_64.rpm | 187 kB 00:00:00
(16/18): openssl-devel-1.0.2k-24.el7_9.x86_64.rpm | 1.5 MB 00:00:00
(17/18): krb5-libs-1.15.1-51.el7_9.x86_64.rpm | 809 kB 00:00:00
(18/18): openssl-libs-1.0.2k-24.el7_9.x86_64.rpm | 1.2 MB 00:00:00
------------------------------------------------------------------------------------------------------------Total 5.1 MB/s | 6.2 MB 00:00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Updating : libcom_err-1.42.9-19.el7.x86_64 1/28
Updating : libselinux-2.5-15.el7.x86_64 2/28
Updating : 1:openssl-libs-1.0.2k-24.el7_9.x86_64 3/28
Updating : krb5-libs-1.15.1-51.el7_9.x86_64 4/28
Installing : libkadm5-1.15.1-51.el7_9.x86_64 5/28
Updating : e2fsprogs-libs-1.42.9-19.el7.x86_64 6/28
Updating : libss-1.42.9-19.el7.x86_64 7/28
Installing : libcom_err-devel-1.42.9-19.el7.x86_64 8/28
Installing : libsepol-devel-2.5-10.el7.x86_64 9/28
Installing : libselinux-devel-2.5-15.el7.x86_64 10/28
Installing : libverto-devel-0.2.5-4.el7.x86_64 11/28
Installing : keyutils-libs-devel-1.5.8-3.el7.x86_64 12/28
Installing : krb5-devel-1.15.1-51.el7_9.x86_64 13/28
Installing : 1:openssl-devel-1.0.2k-24.el7_9.x86_64 14/28
Updating : e2fsprogs-1.42.9-19.el7.x86_64 15/28
Updating : 1:openssl-1.0.2k-24.el7_9.x86_64 16/28
Updating : libselinux-utils-2.5-15.el7.x86_64 17/28
Updating : libselinux-python-2.5-15.el7.x86_64 18/28
Cleanup : 1:openssl-1.0.2k-16.el7.x86_64 19/28
Cleanup : e2fsprogs-1.42.9-13.el7.x86_64 20/28
Cleanup : 1:openssl-libs-1.0.2k-16.el7.x86_64 21/28
Cleanup : krb5-libs-1.15.1-34.el7.x86_64 22/28
Cleanup : e2fsprogs-libs-1.42.9-13.el7.x86_64 23/28
Cleanup : libss-1.42.9-13.el7.x86_64 24/28
Cleanup : libselinux-python-2.5-14.1.el7.x86_64 25/28
Cleanup : libselinux-utils-2.5-14.1.el7.x86_64 26/28
Cleanup : libselinux-2.5-14.1.el7.x86_64 27/28
Cleanup : libcom_err-1.42.9-13.el7.x86_64 28/28
Verifying : libselinux-devel-2.5-15.el7.x86_64 1/28
Verifying : krb5-libs-1.15.1-51.el7_9.x86_64 2/28
Verifying : libselinux-2.5-15.el7.x86_64 3/28
Verifying : libcom_err-1.42.9-19.el7.x86_64 4/28
Verifying : e2fsprogs-1.42.9-19.el7.x86_64 5/28
Verifying : keyutils-libs-devel-1.5.8-3.el7.x86_64 6/28
Verifying : 1:openssl-devel-1.0.2k-24.el7_9.x86_64 7/28
Verifying : libverto-devel-0.2.5-4.el7.x86_64 8/28
Verifying : libselinux-utils-2.5-15.el7.x86_64 9/28
Verifying : 1:openssl-libs-1.0.2k-24.el7_9.x86_64 10/28
Verifying : 1:openssl-1.0.2k-24.el7_9.x86_64 11/28
Verifying : e2fsprogs-libs-1.42.9-19.el7.x86_64 12/28
Verifying : libselinux-python-2.5-15.el7.x86_64 13/28
Verifying : krb5-devel-1.15.1-51.el7_9.x86_64 14/28
Verifying : libkadm5-1.15.1-51.el7_9.x86_64 15/28
Verifying : libsepol-devel-2.5-10.el7.x86_64 16/28
Verifying : libss-1.42.9-19.el7.x86_64 17/28
Verifying : libcom_err-devel-1.42.9-19.el7.x86_64 18/28
Verifying : 1:openssl-libs-1.0.2k-16.el7.x86_64 19/28
Verifying : e2fsprogs-1.42.9-13.el7.x86_64 20/28
Verifying : 1:openssl-1.0.2k-16.el7.x86_64 21/28
Verifying : libss-1.42.9-13.el7.x86_64 22/28
Verifying : libselinux-python-2.5-14.1.el7.x86_64 23/28
Verifying : e2fsprogs-libs-1.42.9-13.el7.x86_64 24/28
Verifying : krb5-libs-1.15.1-34.el7.x86_64 25/28
Verifying : libselinux-utils-2.5-14.1.el7.x86_64 26/28
Verifying : libcom_err-1.42.9-13.el7.x86_64 27/28
Verifying : libselinux-2.5-14.1.el7.x86_64 28/28
Installed:
openssl-devel.x86_64 1:1.0.2k-24.el7_9
Dependency Installed:
keyutils-libs-devel.x86_64 0:1.5.8-3.el7 krb5-devel.x86_64 0:1.15.1-51.el7_9
libcom_err-devel.x86_64 0:1.42.9-19.el7 libkadm5.x86_64 0:1.15.1-51.el7_9
libselinux-devel.x86_64 0:2.5-15.el7 libsepol-devel.x86_64 0:2.5-10.el7
libverto-devel.x86_64 0:0.2.5-4.el7
Updated:
openssl.x86_64 1:1.0.2k-24.el7_9
Dependency Updated:
e2fsprogs.x86_64 0:1.42.9-19.el7 e2fsprogs-libs.x86_64 0:1.42.9-19.el7
krb5-libs.x86_64 0:1.15.1-51.el7_9 libcom_err.x86_64 0:1.42.9-19.el7
libselinux.x86_64 0:2.5-15.el7 libselinux-python.x86_64 0:2.5-15.el7
libselinux-utils.x86_64 0:2.5-15.el7 libss.x86_64 0:1.42.9-19.el7
openssl-libs.x86_64 1:1.0.2k-24.el7_9
Complete!
# 官網(wǎng)下載:直接下載.tar.gz安裝包,地址:https://nginx.org/en/download.html
# 使用wget命令下載(推薦)。確保系統(tǒng)已經(jīng)安裝了wget,如果沒有安裝,執(zhí)行 yum install wget 安裝
wget -c https://nginx.org/download/nginx-1.12.0.tar.gz
# 這里我們本地已經(jīng)下載了,所以直接上傳到linux服務(wù)器上
[root@localhost local]# rz
ZMODEM Session started e50
------------------------
Sent nginx-1.20.2.tar.gz
# 解壓
tar -zxvf nginx-1.12.0.tar.gz
cd nginx-1.12.0
# 配置
其實(shí)在 nginx-1.12.0 版本中你就不需要去配置相關(guān)東西,默認(rèn)就可以了。當(dāng)然,如果你要自己配置目錄也是可以的。
1.使用默認(rèn)配置
./configure
# 編譯安裝
make
make install
# 啟動(dòng)、停止 nginx
cd /usr/local/nginx/sbin/
./nginx
./nginx -s stop
./nginx -s quit
./nginx -s reload
# 查找安裝路徑:
whereis nginx
# 這時(shí)如果訪問不成功可能是防火墻的問題,就需要關(guān)閉放火墻
systemctl stop firewalld.service
[root@localhost sbin]# systemctl stop firewalld.service
[root@localhost sbin]#
# 防火墻
查看防火墻狀態(tài): systemctl status firewalld.service
綠的running表示防火墻開啟
執(zhí)行關(guān)閉命令: systemctl stop firewalld.service
再次執(zhí)行查看防火墻命令:systemctl status firewalld.service
執(zhí)行開機(jī)禁用防火墻自啟命令 : systemctl disable firewalld.service
啟動(dòng):systemctl start firewalld.service
防火墻隨系統(tǒng)開啟啟動(dòng) : systemctl enable firewalld.service
# 分享:這時(shí)如果在另外的虛擬機(jī)要使用Nginx,只需要將安裝好的Nginx目錄文件拷貝過去,執(zhí)行啟動(dòng)命令即可用!
# 啟動(dòng)、停止的幾個(gè)命令
# 進(jìn)入命令管理文件夾sbin
cd /usr/local/nginx/sbin
# 啟動(dòng)nginx
./nginx或./nginx -c /usr/local/nginx/conf/nginx.conf
# 徹底干掉nginx
pkill nginx
# 停止nginx(同kill,比較粗暴)
./nginx -s stop
# 停止nginx(等待進(jìn)程處理完畢進(jìn)行關(guān)閉)
./nginx -s quit
# 重啟nginx
./nginx -s reload
# 開機(jī)自啟動(dòng)
在rc.local 增加啟動(dòng)代碼就可以了 增加一行 /usr/local/nginx/sbin/nginx
[root@localhost sbin]# vi /etc/rc.local
[root@localhost sbin]# cat /etc/rc.local
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.
touch /var/lock/subsys/local
/usr/local/nginx/sbin/nginx
[root@localhost sbin]#
設(shè)置執(zhí)行權(quán)限:
chmod 755 rc.local
# 部署前端到 nginx 下面
[root@localhost ~]# whereis nginx
nginx: /usr/local/nginx
[root@localhost ~]# cd /usr/local/nginx
[root@localhost nginx]# ls
client_body_temp conf fastcgi_temp html logs proxy_temp sbin scgi_temp uwsgi_temp
[root@localhost nginx]# cd html
[root@localhost html]# ls
50x.html index.html
[root@localhost html]# rm index.html
rm: remove regular file ‘index.html’?
[root@localhost html]# ls
50x.html index.html
[root@localhost html]# rm -f index.html
[root@localhost html]# ls
50x.html
[root@localhost html]#
四、安裝mysql
# 安裝 wget
[root@localhost local]# yum -y install wget
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.ustc.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package wget.x86_64 0:1.14-18.el7_6.1 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
============================================================================================================ Package Arch Version Repository Size
============================================================================================================Installing:
wget x86_64 1.14-18.el7_6.1 base 547 k
Transaction Summary
============================================================================================================Install 1 Package
Total download size: 547 k
Installed size: 2.0 M
Downloading packages:
wget-1.14-18.el7_6.1.x86_64.rpm | 547 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : wget-1.14-18.el7_6.1.x86_64 1/1
Verifying : wget-1.14-18.el7_6.1.x86_64 1/1
Installed:
wget.x86_64 0:1.14-18.el7_6.1
Complete!
# 官網(wǎng)下載想要的版本(https://downloads.mysql.com/archives/community/)
wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
rpm -ivh mysql-community-release-el7-5.noarch.rpm
yum install mysql-community-server
#安裝后重啟mysql服務(wù)
service mysqld restart
172.18.188.228
#初次安裝mysql 沒有密碼
mysql -u root
#設(shè)置密碼
set password for 'root'@'localhost' =password('root');
#遠(yuǎn)程連接
GRANT ALL PRIVILEGES ON *.* TO root@"192.168.70.130" IDENTIFIED BY "root"
WITH GRANT OPTION;
use mysql;
update user set host = '%' where user = 'root';
flush privileges;
# 不區(qū)分大小寫
cd /etc/
vi my.cnf
#末尾添加
lower_case_table_names=1
#重啟mysql:
systemctl restart mysqld
五、.NET CORE 項(xiàng)目設(shè)置開機(jī)自啟動(dòng)
# 在 etc/systemd/system 下創(chuàng)建 xxfb.service (名字自己取)
例如:
vi /etc/systemd/system/xxfb.service
# 編輯 xxfb.service
[Service]
Type=simple
GuessMainPID=true
WorkingDirectory=/usr/local/XXFB/ //項(xiàng)目路徑
StandardOutput=journal
StandardError=journal
ExecStart=/usr/local/bin/dotnet WebApi.dll //啟動(dòng)指令
Restart=always
[Install]
WantedBy=multi-user.target
[root@localhost system]#
# 使自啟動(dòng)生效
systemctl enable xxfb.service
# 立即啟動(dòng)項(xiàng)目服務(wù)
systemctl start xxfb.service
systemctl stop myoacore.service
systemctl restart myoacore.service
systemctl list-units --type=service
# 項(xiàng)目路徑 和啟動(dòng)指令 可以通過下面方式獲得
[root@localhost XXFB]# dotnet WebApi.dll
Hosting environment: Production
Content root path: /usr/local/XXFB
Now listening on: http://192.168.70.130:5003
Application started. Press Ctrl+C to shut down.
^CApplication is shutting down...
[root@localhost XXFB]# whereis dotnet
dotnet: /usr/local/bin/dotnet
[root@localhost XXFB]#
# 啟動(dòng)報(bào)錯(cuò)
[root@localhost system]# systemctl start xxfb.service
[root@localhost system]# systemctl status xxfb.service
● xxfb.service - "xxfb Service"
Loaded: loaded (/etc/systemd/system/xxfb.service; enabled; vendor preset: disabled)
Active: failed (Result: start-limit) since Sat 2022-03-12 08:17:47 EST; 4s ago
Process: 16266 ExecStart=/usr/local/bin/dotnet /usr/local/XXFB/WebApi.dll //啟動(dòng)指令 (code=exited, status=200/CHDIR)
Main PID: 16266 (code=exited, status=200/CHDIR)
Mar 12 08:17:47 localhost.localdomain systemd[1]: xxfb.service: main process exited, code=exited, status=200/CHDIR
Mar 12 08:17:47 localhost.localdomain systemd[1]: Unit xxfb.service entered failed state.
Mar 12 08:17:47 localhost.localdomain systemd[1]: xxfb.service failed.
Mar 12 08:17:47 localhost.localdomain systemd[1]: xxfb.service holdoff time over, scheduling restart.
Mar 12 08:17:47 localhost.localdomain systemd[1]: Stopped "xxfb Service".
Mar 12 08:17:47 localhost.localdomain systemd[1]: start request repeated too quickly for xxfb.service
Mar 12 08:17:47 localhost.localdomain systemd[1]: Failed to start "xxfb Service".
Mar 12 08:17:47 localhost.localdomain systemd[1]: Unit xxfb.service entered failed state.
Mar 12 08:17:47 localhost.
# 原因
# 配置里面的注釋導(dǎo)致的,去掉 //項(xiàng)目路徑 // 啟動(dòng)指令
# 改用supervisor
# 使用python3 安排 pip3
wget wget --no-check-certificate https://pypi.python.org/packages/source/p/pip/pip-8.0.2.tar.gz#md5=3a73c4188f8dbad6a1e6f6d44d117eeb
六、安裝wget
# 情況
[root@localhost local]# wegt http://www.mondorescue.org/ftp/centos/7/x86_64/mondorescue.repo
-bash: wegt: command not found
[root@localhost local]#
# 說明沒有安裝wget
# 官網(wǎng)地址:http://mirrors.163.com/centos/7/os/x86_64/Packages/
wget-1.14-18.el7_6.1.x86_64.rpm
# 下載完成后放到local目錄下
# 安裝
[root@localhost local]# rpm -ivh wget-1.14-18.el7_6.1.x86_64.rpm
Preparing... ################################# [100%]
package wget-1.14-18.el7_6.1.x86_64 is already installed
[root@localhost local]#
# 查看 wget 是否安裝
[root@localhost local]# rpm -qa|grep "wget"
wget-1.14-18.el7_6.1.x86_64
# 查看 wget 版本
[root@localhost local]# wget -V
GNU Wget 1.14 built on linux-gnu.
+digest +https +ipv6 +iri +large-file +nls +ntlm +opie +ssl/openssl
Wgetrc:
/etc/wgetrc (system)
Locale: /usr/share/locale
Compile: gcc -DHAVE_CONFIG_H -DSYSTEM_WGETRC="/etc/wgetrc"
-DLOCALEDIR="/usr/share/locale" -I. -I../lib -I../lib -O2 -g -pipe
-Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong
--param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic
Link: gcc -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector-strong --param=ssp-buffer-size=4
-grecord-gcc-switches -m64 -mtune=generic -lssl -lcrypto
/usr/lib64/libssl.so /usr/lib64/libcrypto.so /usr/lib64/libz.so
-ldl -lz -lz -lidn -luuid -lpcre ftp-opie.o openssl.o http-ntlm.o
../lib/libgnu.a
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://www.gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Originally written by Hrvoje Niksic <hniksic@xemacs.org>.
Please send bug reports and questions to <bug-wget@gnu.org>.
[root@localhost local]#
七、安裝 Mondo Rescue
# 官網(wǎng):
wget http://www.mondorescue.org/ftp/centos/7/x86_64/mondorescue.repo
wget ftp://ftp.mondorescue.org//centos/7/x86_64/mondorescue.repo
# 把下載的mondorescue.repo 復(fù)制到/etc/yum.repos.d/目錄下
cp mondorescue.repo /etc/yum.repos.d/
# 安裝
yum install -y mondo
執(zhí)行安裝命令為 yum install mondo
第一次安裝時(shí)報(bào)錯(cuò)為
Public key for perl-IO-Interface-1.05-2.el7.x86_64.rpm is not installed
Failing package is: perl-IO-Interface-1.05-2.el7.x86_64
GPG Keys are configured as: ftp://ftp.mondorescue.org//centos/7/x86_64/mondorescue.pubkey
第二次安裝報(bào)錯(cuò)為
warning: /var/cache/yum/x86_64/7/mondorescue/packages/perl-IO-Interface-1.05-2.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 37db9883: NOKEY
Retrieving key from ftp://ftp.mondorescue.org//centos/7/x86_64/mondorescue.pubkey
The GPG keys listed for the "centos 7 x86_64 - mondorescue Vanilla Packages" repository are already installed but they are not correct for this package.
Check that the correct key URLs are configured for this repository.
Failing package is: perl-IO-Interface-1.05-2.el7.x86_64
GPG Keys are configured as: ftp://ftp.mondorescue.org//centos/7/x86_64/mondorescue.pubkey
解決方法
參考:yum 安裝報(bào)錯(cuò)The GPG keys listed for the “CentOS-7 - Base - 163.com“ repository are already installed but
我這使用通過參數(shù)指定不檢查數(shù)字簽名方式進(jìn)行安裝
yum install mondo --nogpgcheck
或修改repo文件,改為 gpgcheck=0
[mondorescue]
name=centos 7 x86_64 - mondorescue Vanilla Packages
baseurl=ftp://ftp.mondorescue.org//centos/7/x86_64
enabled=1
gpgcheck=0
gpgkey=ftp://ftp.mondorescue.org//centos/7/x86_64/mondorescue.pubkey
# 運(yùn)行
mondoarchive
#雖然生成了鏡像文件,但是無法安裝(虛擬機(jī)安裝找不到操作系統(tǒng))