配置网络参数
1.可视化操作
nmtui 弹出窗口可视化操作 [root@myserver ~]# nmtui
然后按方向键以及回车确认操作如下:
2.命令行操作:配置IP地址 ONBOOT和BOOTPROTO的参数值
[root@myserver ~]# vim /etc/sysconfig/network-scripts/ifcfg-ens160
查看网络信息和网络状态
[root@myserver ~]# nmcli connection show
NAME UUID TYPE DEVICE
ens160 bca8cf78-5f6e-4012-8119-103893ca68bb ethernet ens160
virbr0 45d4b02e-7363-41a3-bc0b-91c67b310de9 bridge virbr0
[root@myserver ~]# nmcli connection show ens160
网卡绑定的模式信息
mode0(平衡负载模式):平时两块网卡均工作,且自动备援,但需要在与服务器本地网卡相连的交换机设备上进行端口聚合来支持绑定技术。
mode1(自动备援模式):平时只有一块网卡工作,在它故障后自动替换为另外的网卡。
mode6(平衡负载模式):平时两块网卡均工作,且自动备援,无须交换机设备提供辅助支持。
安全秘钥的生成
[root@myserver ~]# ssh-keygen
拷贝秘钥到远程主机
[root@myserver ~]# ssh-copy-id 192.168.1.78
管理远程回话
screen命令能做的事情非常多:可以用-S参数创建会话窗口;用-d参数将指定会话进行离线处理;用-r参数恢复指定会话;用-x参数一次性恢复所有的会话;用-ls参数显示当前已有的会话;以及用-wipe参数把目前无法使用的会话删除,等等。
screen是一款能够实现多窗口远程控制的开源服务程序,简单来说就是为了解决网络异常中断或为了同时控制多个远程终端窗口而设计的程序。用户还可以使用screen服务程序同时在多个远程会话中自由切换,能够做到实现如下功能。
会话恢复:即便网络中断,也可让会话随时恢复,确保用户不会失去对远程会话的控制。
多窗口:每个会话都是独立运行的,拥有各自独立的输入输出终端窗口,终端窗口内显示过的信息也将被分开隔离保存,以便下次使用时依然能看到之前的操作记录。
会话共享:当多个用户同时登录到远程服务器时,便可以使用会话共享功能让用户之间的输入输出信息共享。
下载screen
[root@myserver yum.repos.d]# yum install -y screen
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Extra Packages for Enterprise Linux 8 - x86_64 3.1 kB/s | 6.3 kB 00:01
Extra Packages for Enterprise Linux 8 - x86_64 369 kB/s | 8.8 MB 00:24
Last metadata expiration check: 0:00:04 ago on Sat 30 Jan 2021 12:27:18 AM CST.
Dependencies resolved.
=========================================================================================================
Package Arch Version Repository Size
=========================================================================================================
Installing:
screen x86_64 4.6.2-10.el8 epel 582 k
Transaction Summary
=========================================================================================================
Install 1 Package
Total download size: 582 k
Installed size: 971 k
Downloading Packages:
screen-4.6.2-10.el8.x86_64.rpm 105 kB/s | 582 kB 00:05
---------------------------------------------------------------------------------------------------------
Total 37 kB/s | 582 kB 00:15
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Running scriptlet: screen-4.6.2-10.el8.x86_64 1/1
Installing : screen-4.6.2-10.el8.x86_64 1/1
Running scriptlet: screen-4.6.2-10.el8.x86_64 1/1
Verifying : screen-4.6.2-10.el8.x86_64 1/1
Installed products updated.
Installed:
screen-4.6.2-10.el8.x86_64
Complete!
[root@myserver yum.repos.d]#
终端共享
查看终端进程信息
screen -x 33592
配置本地yum仓库
[root@myserver ~]# vim /etc/yum.repos.d/redhat.repo
#
# Certificate-Based Repositories
# Managed by (rhsm) subscription-manager
#
# *** This file is auto-generated. Changes made here will be over-written. ***
# *** Use "subscription-manager repo-override --help" if you wish to make changes. ***
#
# If this file is empty and this system is subscribed consider
# a "yum repolist" to refresh available repos
#
[BaseOS]
name=localhost8
baseurl=file:///media/BaseOS
enabled=1
gpgcheck=0
[APPStream]
name=localhost8_app
baseurl=file:///media/AppStream
enabled=1
gpgcheck=0
安装Apache
[root@myserver ~]# yum install -y httpd
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Last metadata expiration check: 0:06:56 ago on Sat 30 Jan 2021 12:40:08 AM CST.
Dependencies resolved.
=========================================================================================================
Package Arch Version Repository Size
=========================================================================================================
Installing:
httpd x86_64 2.4.37-10.module+el8+2764+7127e69e APPStream 1.4 M
Installing dependencies:
apr x86_64 1.6.3-9.el8 APPStream 125 k
apr-util x86_64 1.6.1-6.el8 APPStream 105 k
httpd-filesystem noarch 2.4.37-10.module+el8+2764+7127e69e APPStream 34 k
httpd-tools x86_64 2.4.37-10.module+el8+2764+7127e69e APPStream 101 k
mod_http2 x86_64 1.11.3-1.module+el8+2443+605475b7 APPStream 156 k
redhat-logos-httpd noarch 80.7-1.el8 BaseOS 25 k
Installing weak dependencies:
apr-util-bdb x86_64 1.6.1-6.el8 APPStream 25 k
apr-util-openssl x86_64 1.6.1-6.el8 APPStream 27 k
Transaction Summary
=========================================================================================================
Install 9 Packages
Total size: 2.0 M
Installed size: 5.4 M
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : apr-1.6.3-9.el8.x86_64 1/9
Running scriptlet: apr-1.6.3-9.el8.x86_64 1/9
Installing : apr-util-bdb-1.6.1-6.el8.x86_64 2/9
Installing : apr-util-openssl-1.6.1-6.el8.x86_64 3/9
Installing : apr-util-1.6.1-6.el8.x86_64 4/9
Running scriptlet: apr-util-1.6.1-6.el8.x86_64 4/9
Installing : httpd-tools-2.4.37-10.module+el8+2764+7127e69e.x86_64 5/9
Installing : redhat-logos-httpd-80.7-1.el8.noarch 6/9
Running scriptlet: httpd-filesystem-2.4.37-10.module+el8+2764+7127e69e.noarch 7/9
Installing : httpd-filesystem-2.4.37-10.module+el8+2764+7127e69e.noarch 7/9
Installing : mod_http2-1.11.3-1.module+el8+2443+605475b7.x86_64 8/9
Installing : httpd-2.4.37-10.module+el8+2764+7127e69e.x86_64 9/9
Running scriptlet: httpd-2.4.37-10.module+el8+2764+7127e69e.x86_64 9/9
Verifying : apr-1.6.3-9.el8.x86_64 1/9
Verifying : apr-util-1.6.1-6.el8.x86_64 2/9
Verifying : apr-util-bdb-1.6.1-6.el8.x86_64 3/9
Verifying : apr-util-openssl-1.6.1-6.el8.x86_64 4/9
Verifying : httpd-2.4.37-10.module+el8+2764+7127e69e.x86_64 5/9
Verifying : httpd-filesystem-2.4.37-10.module+el8+2764+7127e69e.noarch 6/9
Verifying : httpd-tools-2.4.37-10.module+el8+2764+7127e69e.x86_64 7/9
Verifying : mod_http2-1.11.3-1.module+el8+2443+605475b7.x86_64 8/9
Verifying : redhat-logos-httpd-80.7-1.el8.noarch 9/9
Installed products updated.
Installed:
httpd-2.4.37-10.module+el8+2764+7127e69e.x86_64
apr-util-bdb-1.6.1-6.el8.x86_64
apr-util-openssl-1.6.1-6.el8.x86_64
apr-1.6.3-9.el8.x86_64
apr-util-1.6.1-6.el8.x86_64
httpd-filesystem-2.4.37-10.module+el8+2764+7127e69e.noarch
httpd-tools-2.4.37-10.module+el8+2764+7127e69e.x86_64
mod_http2-1.11.3-1.module+el8+2443+605475b7.x86_64
redhat-logos-httpd-80.7-1.el8.noarch
Complete!
[root@myserver ~]#
启动服务并设置开机自起
查看是否能访问apache的默认页面
配置服务文件参数
在Linux系统中配置服务,其实就是修改服务的配置文件,因此,还需要知道这些配置文件的所在位置以及用途,httpd服务程序的主要配置文件。
服务目录 | /etc/httpd |
主配置文件 | /etc/httpd/conf/httpd.conf |
网站数据目录 | /var/www/html |
访问日志 | /var/log/httpd/access_log |
错误日志 | /var/log/httpd/error_log |
ServerRoot | 服务目录 |
ServerAdmin | 管理员邮箱 |
User | 运行服务的用户 |
Group | 运行服务的用户组 |
ServerName | 网站服务器的域名 |
DocumentRoot | 网站数据目录 |
Listen | 监听的IP地址与端口号 |
DirectoryIndex | 默认的索引页页面 |
ErrorLog | 错误日志文件 |
CustomLog | 访问日志文件 |
Timeout | 网页超时时间,默认为300秒 |
自定也页面 测试