Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What must be done after RHEL/CentOS minimizes installation

2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the relevant knowledge of "what must be done after RHEL/CentOS minimization installation". The editor shows you the operation process through an actual case, the operation method is simple and fast, and it is practical. I hope this article "what must be done after RHEL/CentOS minimization installation" can help you solve the problem.

1. Register and enable Red Hat subscription

After the RHEL 7 minimization installation is complete, you should register and enable the system Red Hat subscription library and perform a complete system update. This is only useful if you have a Red Hat subscription available. You need to register to enable the official Red Hat system library and update the operating system from time to time. Note: this step only applies to Red Hat Enterprise Linux with a valid subscription. If you are using a CentOS server, please see the following chapter.

two。 Configure the network with a static IP address

The first thing you need to do is configure your CentOS server with static IP addresses, routes, and DNS. We will use the ip command instead of the ifconfig command. Of course, the ifconfig command is available for most Linux distributions and can be installed from the default library.

# yum install net-tools [it provides ifconfig tools, and if you are not used to the ip command, you can use it]

But as I said earlier, we will use the ip command to configure a static IP address. So, make sure you check the current IP address first.

# ip addr show

Now open and edit the file / etc/sysconfig/network-scripts/ifcfg-enp0s3 with your editor. Here, I use the vi editor, and you have to make sure you are a root user to save changes.

# vi / etc/sysconfig/network-scripts/ifcfg-enp0s3

We will edit four places in the file. Pay attention to the four places below and promise not to touch anything else. Also keep the double quotation marks and enter your data between them.

IPADDR = "[enter your static IP]" GATEWAY = "[enter your default gateway]" DNS1 = "[your DNS1]" DNS2 = "[your DNS2]"

After changing the 'ifcfg-enp0s3', it looks like the picture below. Note that your IP, gateway and DNS may change. Please check with your ISP. Save and exit.

Restart the network service and check that the IP is the same as assigned. If all goes well, use Ping to check the network status.

# service network restart

After rebooting the network, verify that the IP address and network status are checked.

# ip addr show# ping-c4 google.com

3. Set the host name of the server

The next step is to change the host name of the CentOS server. View the currently assigned host name.

# echo $HOSTNAME

To set the new host name, we need to edit the'/ etc/hostsname' file and replace the old host name with the desired name.

# vi / etc/hostname

After you have set the host name, be sure to log out and log back in to confirm the host name. Check the new host name after logging in.

$echo $HOSTNAME

You can also use the 'hostname' command to see your current hostname.

$hostname

4. Update or upgrade minimally installed CentOS

This will not install any new software except to update and install the latest version of the existing software and security upgrades. Generally speaking, update (update) and upgrade (upgrade) are the same, except that in fact upgrade = update + update is discarded.

# yum update & & yum upgrade

Important: you can also run the following command, which does not pop up a prompt for a software update, and you do not need to type'y'to accept the change. However, it's always a good idea to see what happens on the server, especially in production. Therefore, using the following command can automatically update and upgrade for you, but it is not recommended.

# yum-y update & & yum-y upgrade

5. Install the command line Web browser

In most cases, especially in production environments, we usually install CentOS on a command line without GUI, in which case we must have a command-line browsing tool that can view the website through the terminal. To achieve this, we intend to install a famous tool called 'links'.

# yum install links

6. Install the Apache HTTP server

No matter what reason you use the server, in most cases you need a HTTP server to run websites, multimedia, client-side scripts, and many other things.

# yum install httpd

If you want to change the default port number (80) of the Apache HTTP server to another port, you need to edit the configuration file'/ etc/httpd/conf/httpd.conf' and find the line that starts with the following:

LISTEN 80

Change the port number '80' to any other port (for example, 3221), save and exit.

Increase the port just assigned to Apache through the firewall, and then reload the firewall.

Allow the http service to pass through the firewall (permanent).

# firewall-cmd-add-service=http

Allow port 3221 to pass through the firewall (permanent).

# firewall-cmd-permanent-add-port=3221/tcp

Reload the firewall.

# firewall-cmd-reload

With all of the above done, it's time to restart the Apache HTTP server before the new port number takes effect.

# systemctl restart httpd.service

Now add the Apache service to the system layer to start it automatically with the system.

# systemctl start httpd.service# systemctl enable httpd.service

Use the links command line tool to validate the Apache HTTP server, as shown in the following figure.

# links 127.0.0.1, that's all for "what must be done after RHEL/CentOS installation is minimized". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report