Configure network parameters
1. Visual operation
Visualized operation of nmtui pop-up window [root@myserver ~]# nmtui
Then press the arrow keys and press Enter to confirm the operation as follows:
2. Command line operation: configure the parameter values of the IP address ONBOOT and BOOTPROTO
[root@myserver ~]# vim /etc/sysconfig/network-scripts/ifcfg-ens160
View network information and network status
[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
NIC binding mode information
mode0 (balanced load mode): Normally, both network cards work and are automatically backed up, but it is necessary to perform port aggregation on the switch device connected to the server's local network card to support the binding technology.
Mode1 (automatic backup mode): Usually only one network card works, and it is automatically replaced with another network card after it fails.
Mode6 (balanced load mode): Normally, both network cards are working, and they are automatically backed up, without the need for auxiliary support from switch equipment.
Security key generation
[root@myserver ~]# ssh-keygen
Copy the secret key to the remote host
[root@myserver ~]# ssh-copy-id 192.168.1.78
Manage remote calls
The screen command can do many things: you can use the -S parameter to create a session window; use the -d parameter to process the specified session offline; use the -r parameter to restore the specified session; use the -x parameter to restore all sessions at once; use- The ls parameter displays the currently existing sessions; and uses the -wipe parameter to delete the currently unavailable sessions, and so on.
Screen is an open source service program that can realize multi-window remote control. Simply put, it is a program designed to solve abnormal network interruption or to control multiple remote terminal windows at the same time. Users can also use the screen service program to freely switch between multiple remote sessions at the same time, which can achieve the following functions.
Session resume : Even if the network is interrupted, the session can be resumed at any time to ensure that the user will not lose control of the remote session.
Multi-window : Each session runs independently and has its own independent input and output terminal window. The information displayed in the terminal window will also be stored separately, so that the previous operation record can still be seen when it is used next time.
Session sharing : When multiple users log on to the remote server at the same time, the session sharing function can be used to share input and output information between users.
Download 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]#
Terminal sharing
View terminal process information
screen -x 33592
Configure local yum warehouse
[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
Install 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 ~]#
Start the service and set it to start at boot
Check if you can access the default page of apache
Configure service file parameters
Configuring a service in a Linux system is actually modifying the configuration file of the service. Therefore, you also need to know the location and purpose of these configuration files, as well as the main configuration file of the httpd service program.
Service catalog | /etc/httpd |
Main configuration file | /etc/httpd/conf/httpd.conf |
Website Data Directory | / var / www / html |
Access log | /var/log/httpd/access_log |
Error log | /var/log/httpd/error_log |
ServerRoot | Service catalog |
ServerAdmin | Administrator mailbox |
User | The user who runs the service |
Group | User group running the service |
ServerName | The domain name of the web server |
DocumentRoot | Website Data Directory |
Listen | Listening IP address and port number |
DirectoryIndex | Default index page page |
ErrorLog | Error log file |
CustomLog | Access log file |
Timeout | Web page timeout period, the default is 300 seconds |
Custom page test