In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
What will be done immediately when logging into the Linux server for the first time? for this question, this article introduces in detail the corresponding analysis and solutions, hoping to help more partners who want to solve this problem to find a more simple and feasible way.
Before putting the newly configured server to work, make sure you know what you are using.
When I test software on Linux (which is a regular part of my job), I need to use multiple servers running different architectures of Linux. I prepare the machine, install the required software packages, run my tests, collect the results, and return the machine to the warehouse so that others can use it for testing.
Because I do this often (or even many times a day), the first 10 minutes of my first login to the Linux server has become a daily ritual. When I log in to the Linux server for the first time, I use commands to gather the information I need to find something. I will introduce my process in this article, but please note that in most cases, I only give the name of the command, so you need to determine the specific options for these commands to get the information you need. Reading the manual pages of commands is a good place to start.
1. First contact
When I log in to a server, the first thing I do is check to see if it has the operating system, kernel, and hardware architecture needed for the tests I'm going to run. I often check how long a server has been running. Although this is not important to the test system because it will be rebooted many times, I still find this information very helpful.
Use the following command to get this information. I mainly use Red Hat Linux for testing, so if you use another Linux distribution, use *-release instead of redhat-release in the filename:
Cat / etc/redhat-releaseuname-ahostnamectluptime
2. Is there anyone logged on?
Once I know that this machine meets my testing requirements, I need to make sure that no one else logs in to the system at the same time to run their own tests. Although it's unlikely that the backup system will help me deal with this problem, it's good to check it once in a while-especially when I log in to the server for the first time. I also check to see if any other users (except root) can access the system.
Use the following command to find this information. The last command is to find users in the / etc/passwd file with shell access; it skips other services in the file that do not have shell access or whose shell is set to nologin:
Whowho-Hugrep sh$ / etc/passwd
3. Physical machine or virtual machine
Now that I have my own machine, I need to determine whether it is a physical machine or a virtual machine (VM). If I prepared this machine myself, I can be sure that this is what I asked for. However, if you are using a machine that is not your own, you should check whether the machine is a physical machine or a virtual machine.
Use the following command to identify this information. If it is a physical system, you will see the name of the vendor (such as HP, IBM, etc.) and the brand and model of the server, while in the virtual machine, you should see KVM, VirtualBox, etc., depending on what virtualization software is used to create the virtual machine:
Dmidecode-s system-manufacturerdmidecode-s system-product-namelshw-c system | grep product | head-1cat / sys/class/dmi/id/product_namecat / sys/class/dmi/id/sys_vendor
4. Hardware
Because I often test the hardware connected to the Linux machine, I usually use a physical server instead of a virtual machine. On the physical machine, my next step is to determine the hardware capabilities of the server-- for example, what type of CPU is running, how many cores it has, what flags are enabled, and how much memory is available to run tests. If I am running a network test, I check the type and capacity of Ethernet or other network devices connected to the server.
Use the following command to display the hardware connected to the Linux server. Some of these commands may be deprecated in the new operating system version, but you can still install them from the yum repository or switch to their equivalent new commands:
Lscpu or cat / proc/cpuinfolsmem or cat / proc/meminfoifconfig-aethtool lshwlspcidmidecode
5. Installed software
Testing software always requires the installation of additional dependency packages, libraries, etc. However, before installing anything, I check what is installed (including what version) and which repositories are configured so that I know where the software comes from and can debug any package installation problems.
Use the following command to determine what software is installed:
Rpm-qarpm-qa | grep rpm-qi yum repolistyum repoinfoyum install ls-l / etc/yum.repos.d/
6. Running processes and services
After checking the installed software, it is natural to check which processes are running on the system. This is critical when running performance tests on your system-- if a running process, daemon, test software, and so on takes up most of the CPU/RAM, it makes sense to stop the process before running the test. This can also check whether the process or daemon required for the test is up and running. For example, if the test requires httpd to run, the service that starts the daemon may not be running even if the package is installed.
Use the following command to identify the running processes and enabled services on the system:
Pstree-pa 1ps-efps auxfsystemctl
7. Network connection
Today's machines are highly networked, and they need to communicate with other machines or services on the network. I will identify which ports on the server are open, whether there is any network connection to the test machine, whether the firewall is enabled, whether any ports are blocked, and which DNS servers the machine is talking to.
Use the following command to identify information about network services. If an obsolete command is not available, install it from the yum repository or use the equivalent new command:
Netstat-tulpnnetstat-anplsof-issiptables-L-ncat / etc/resolv.conf
8. Kernel
During system testing, I found it helpful to know kernel-related information, such as the kernel version and which kernel modules were loaded. I will also list any adjustable kernel parameters and their settings, and check the options used when starting a running kernel.
Use the following command to identify this information:
Uname-rcat / proc/cmdlinelsmodmodinfo sysctl-acat / boot/grub2/grub.cfg
9. Log
Now, I have a good understanding of the server, including what software is installed and which processes are running. One more thing I can't avoid is log files-I need to know where to view constantly updated information.
Use the following command to view the log of the system:
Dmesgtail-f / var/log/messagesjournalctl
The next steps
Although commands and utilities change, the basic information they display remains roughly the same. Before you can focus on which commands to master, you need to have a macro view of the information you are looking for and what category it belongs to.
Because Linux keeps most of the information in a file, these commands basically read the information from the file and present it in a way that is easy to understand. The next good thing to do is to find the file that each command uses to get the information displayed. A hint: the way to find this information is the strace command.
What is Linux system Linux is a free-to-use and free-spread UNIX-like operating system, is a POSIX-based multi-user, multi-task, multi-threaded and multi-CPU operating system, using Linux can run major Unix tools, applications and network protocols.
This is the answer to the question about what you are about to do when you log on to the Linux server for the first time. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel to learn more about it.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.