CentOS 7 CentOS 7 部署 .net core
2022-03-20 本文已影响0人
Rinaloving
一、系统版本
# 系统镜像安装包版本:
CentOS-7-x86_64-Minimal-1810.iso
# 安装 net-tools 工具
yum install net-tools
# 查看系统 ip
[root@localhost ~]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.70.130 netmask 255.255.255.0 broadcast 192.168.70.255
inet6 fe80::1162:db4a:c71e:9f46 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:0b:11:9d txqueuelen 1000 (Ethernet)
RX packets 16215 bytes 22806531 (21.7 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 7228 bytes 443052 (432.6 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
# 系统版本
[root@localhost ~]# cat /etc/system-release
CentOS Linux release 7.6.1810 (Core)
二、安装 .NET CORE 2.1 环境
# 方式一:(手动安装包安装)
# 官网下载 .net core 2.1 安装包
# 官网地址:https://dotnet.microsoft.com/en-us/download/dotnet/2.1
dotnet-sdk-2.1.526-linux-x64.tar
# 如不想使用xftp上传,可以进行如下操作
[root@localhost ~]# yum install lrzsz -y
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 lrzsz.x86_64 0:0.12.20-36.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
============================================================================================================ Package Arch Version Repository Size
============================================================================================================Installing:
lrzsz x86_64 0.12.20-36.el7 base 78 k
Transaction Summary
============================================================================================================Install 1 Package
Total download size: 78 k
Installed size: 181 k
Downloading packages:
lrzsz-0.12.20-36.el7.x86_64.rpm | 78 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : lrzsz-0.12.20-36.el7.x86_64 1/1
Verifying : lrzsz-0.12.20-36.el7.x86_64 1/1
Installed:
lrzsz.x86_64 0:0.12.20-36.el7
Complete!
# 进入 /usr/local 目录
[root@localhost local]# rz
ZMODEM Session started e50
------------------------
Sent dotnet-sdk-2.1.526-linux-x64.tar.gz
# 创建 SDK 文件夹&将sdk 解压到指定文件夹中
[root@localhost local]# sudo mkdir -p /usr/dotnet/dotnet-2.1 && sudo tar zxf dotnet-sdk-2.1.526-linux-x64.tar.gz -C /usr/dotnet/dotnet-2.1
[root@localhost local]#
# 安装基础依赖
[root@localhost local]# yum -y install libicu
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 libicu.x86_64 0:50.2-4.el7_7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
============================================================================================================ Package Arch Version Repository Size
============================================================================================================Installing:
libicu x86_64 50.2-4.el7_7 base 6.9 M
Transaction Summary
============================================================================================================Install 1 Package
Total download size: 6.9 M
Installed size: 24 M
Downloading packages:
libicu-50.2-4.el7_7.x86_64.rpm | 6.9 MB 00:00:03
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : libicu-50.2-4.el7_7.x86_64 1/1
Verifying : libicu-50.2-4.el7_7.x86_64 1/1
Installed:
libicu.x86_64 0:50.2-4.el7_7
Complete!
# 创建软链接
[root@localhost local]# sudo ln -s /usr/dotnet/dotnet-2.1/dotnet /usr/local/bin
[root@localhost local]#
# 校验是否安装成功
[root@localhost local]# dotnet --version
2.1.526
# 方式二(RPM 包安装):
# 导入rpm源
sudo rpm -Uvh https://packages.microsoft.com/config/rhel/7/packages-microsoft-prod.rpm
# 更新软件包
sudo yum -y update
# 安装sdk
sudo yum -y install dotnet-sdk-2.1
# 校验是否安装成功
dotnet --version
三、安装 Nginx
# 安装所需环境
# Nginx 是 C语言开发
# gcc 安装
安装 nginx 需要先将官网下载的源码进行编译,编译依赖gcc环境,如果没有gcc环境,则需要安装:
[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) 是一个Perl库,包括 perl 兼容的正则表达式库。nginx 的 http 模块使用 pcre 来解析正则表达式,所以需要在 linux 上安装 pcre 库,pcre-devel 是使用 pcre 开发的一个二次开发库。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 包的内容进行 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 是一个强大的安全套接字层密码库,囊括主要的密码算法、常用的密钥和证书封装管理功能及 SSL 协议,并提供丰富的应用程序供测试或其它目的使用。
nginx 不仅支持 http 协议,还支持 https(即在ssl协议上传输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!
# 官网下载:直接下载.tar.gz安装包,地址:https://nginx.org/en/download.html
# 使用wget命令下载(推荐)。确保系统已经安装了wget,如果没有安装,执行 yum install wget 安装
wget -c https://nginx.org/download/nginx-1.12.0.tar.gz
# 这里我们本地已经下载了,所以直接上传到linux服务器上
[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
# 配置
其实在 nginx-1.12.0 版本中你就不需要去配置相关东西,默认就可以了。当然,如果你要自己配置目录也是可以的。
1.使用默认配置
./configure
# 编译安装
make
make install
# 启动、停止 nginx
cd /usr/local/nginx/sbin/
./nginx
./nginx -s stop
./nginx -s quit
./nginx -s reload
# 查找安装路径:
whereis nginx
# 这时如果访问不成功可能是防火墙的问题,就需要关闭放火墙
systemctl stop firewalld.service
[root@localhost sbin]# systemctl stop firewalld.service
[root@localhost sbin]#
# 防火墙
查看防火墙状态: systemctl status firewalld.service
绿的running表示防火墙开启
执行关闭命令: systemctl stop firewalld.service
再次执行查看防火墙命令:systemctl status firewalld.service
执行开机禁用防火墙自启命令 : systemctl disable firewalld.service
启动:systemctl start firewalld.service
防火墙随系统开启启动 : systemctl enable firewalld.service
# 分享:这时如果在另外的虚拟机要使用Nginx,只需要将安装好的Nginx目录文件拷贝过去,执行启动命令即可用!
# 启动、停止的几个命令
# 进入命令管理文件夹sbin
cd /usr/local/nginx/sbin
# 启动nginx
./nginx或./nginx -c /usr/local/nginx/conf/nginx.conf
# 彻底干掉nginx
pkill nginx
# 停止nginx(同kill,比较粗暴)
./nginx -s stop
# 停止nginx(等待进程处理完毕进行关闭)
./nginx -s quit
# 重启nginx
./nginx -s reload
# 开机自启动
在rc.local 增加启动代码就可以了 增加一行 /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]#
设置执行权限:
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!
# 官网下载想要的版本(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服务
service mysqld restart
172.18.188.228
#初次安装mysql 没有密码
mysql -u root
#设置密码
set password for 'root'@'localhost' =password('root');
#远程连接
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;
# 不区分大小写
cd /etc/
vi my.cnf
#末尾添加
lower_case_table_names=1
#重启mysql:
systemctl restart mysqld
五、.NET CORE 项目设置开机自启动
# 在 etc/systemd/system 下创建 xxfb.service (名字自己取)
例如:
vi /etc/systemd/system/xxfb.service
# 编辑 xxfb.service
[Service]
Type=simple
GuessMainPID=true
WorkingDirectory=/usr/local/XXFB/ //项目路径
StandardOutput=journal
StandardError=journal
ExecStart=/usr/local/bin/dotnet WebApi.dll //启动指令
Restart=always
[Install]
WantedBy=multi-user.target
[root@localhost system]#
# 使自启动生效
systemctl enable xxfb.service
# 立即启动项目服务
systemctl start xxfb.service
systemctl stop myoacore.service
systemctl restart myoacore.service
systemctl list-units --type=service
# 项目路径 和启动指令 可以通过下面方式获得
[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]#
# 启动报错
[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 //启动指令 (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.
# 原因
# 配置里面的注释导致的,去掉 //项目路径 // 启动指令
# 改用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
# 官网地址: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
# 官网:
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 复制到/etc/yum.repos.d/目录下
cp mondorescue.repo /etc/yum.repos.d/
# 安装
yum install -y mondo
执行安装命令为 yum install mondo
第一次安装时报错为
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
第二次安装报错为
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 安装报错The GPG keys listed for the “CentOS-7 - Base - 163.com“ repository are already installed but
我这使用通过参数指定不检查数字签名方式进行安装
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
# 运行
mondoarchive
#虽然生成了镜像文件,但是无法安装(虚拟机安装找不到操作系统)
八、Clonezilla再生龙
# 官网地址:http://www.clonezilla.org/