Linux explains the preparation before use

1. The difference between Linux and Windows

Compare Windows Linux
cost Charged and expensive Linux free or a small fee
Software and support The advantages of quantity and quality, but most of them are paid software; support and services are provided by Microsoft official Open source and free software, users can modify, customize and redistribute, because there is basically no financial support for free, some software quality and experience are lacking; all Linux developers and free software communities around the world provide support
safety After three days of patching and installing system security updates, there will still be virus and Trojan horses It is of course impossible to say that Linux has no security issues. The benevolent sees the benevolent and the wise sees the wisdom. Relatively speaking, it is definitely safer than the Windows platform.
usage habit Ordinary users are basically operating under a pure graphical interface, relying on the mouse and keyboard to complete all operations, and the user is easy to get started and simple; It has both graphical interface operation and complete command line operation. You can use the keyboard to complete all operations. It is difficult for novices to get started and requires some learning and guidance. Once proficient, it will be extremely efficient
Customizable Closed, the system is poorly customizable Open source, highly customizable
Application scenarios The desktop operating system mainly uses Windows It supports Baidu, Google, Taobao and other application software and services. It is a host of thousands of Linux servers in the background. Most of the software and services in the world run on Linux.

Two, Linux version

Linux kernel version

  • The kernel is the heart of the system. It is the core program for running programs and managing hardware devices such as disks and printers. It provides an abstraction layer between the bare device and the application.
  • Linux kernel version is divided into stable version and development version. The two versions are interrelated and circulate with each other.
  • Stable version: With industrial-grade strength, it can be widely used and deployed. Compared with the older ones, the new stable version only fixes some bugs or adds some new drivers
  • Development version: Due to the need to test various solutions, it changes quickly
  • Kernel source website: http://www.kernel.org
  • All modifications to the Linux source code from all over the world will eventually be summarized on this website, and the open source community led by Linus will screen and modify them and finally decide whether to enter the Linux mainline kernel source

Linux Distribution-Top Ten Linux Distributions

Linux distribution (also known as GNU/Linux distribution) usually includes application software including desktop environment, office suite, media player, database, etc. The common distributions are as follows:

  • Ubuntu

  • Redhat

  • Fedora

  • openSUSE

  • Linux Mint

  • Debian

  • Manjaro

  • Mageia

  • CentOS

  • Arch

Three, virtual machine overview:

Virtual Machine (Virtual Machine) refers to a complete computer system with complete hardware system functions that is simulated by software and runs in a completely isolated environment. The work that can be done in the physical computer can be realized in the virtual machine. When creating a virtual machine in a computer, part of the hard disk and memory capacity of the physical machine needs to be used as the hard disk and memory capacity of the virtual machine. Each virtual machine has its own CMOS, hard disk and operating system, and can operate the virtual machine just like a physical machine.

Linux virtual machine:

A virtual linux operating environment installed on Windows is called a linux virtual machine. It is actually just a file, it is a virtual linux environment, not a real operating system. But their actual effect is the same. So install it on a virtual machine and use it well. Install Linux under the windowsXP virtual machine vmware We create a virtual computer (virtual machine) in the actual Windows XP (host computer), and install the Linux system on it, so that you can safely and boldly perform various Linux exercises. No need to worry about the host system crashing due to improper operation. And you can draw inferences about it, turn a computer into three or four, and install other systems separately. (The operating system running the virtual machine software is called Host OS, and the operating system running in the virtual machine is called Guest OS).

Java virtual machine:

Java Virtual Machine (JVM) is the abbreviation of Java Virtual Machine. It is a fictitious computer that is realized by simulating various computer functions on an actual computer. The Java virtual machine has its own complete hardware architecture, such as processors, stacks, registers, etc., as well as corresponding instruction systems.

Fourth, VMware installation and uninstallation

Common virtual machine software includes VMware Workstation (VMware for short), VirtualBox, Microsoft Virtual PC, etc. Among them, VMware has the highest market share.
VMware allows you to run multiple operating systems simultaneously on a computer, such as Windows, Linux and Mac at the same time OS. Install multiple operating systems directly on the computer, and only one operating system can be run at the same time, and it can be switched after restarting; while Vmware can run multiple operating systems at the same time and can switch back and forth like Windows applications. From the user's perspective, the virtual machine system is the same as the real installed system, and it is even possible to connect several virtual machine systems to a local area network or to the Internet on one computer.
In the virtual machine system, each virtualized computer is called a "virtual machine", and the computer used to store all virtual machines is called a "host machine". For example, your Windows system is the host machine, and the Linux installed by VMware is the virtual machine.
Installation : Run the installer directly to install. After the installation is complete, click Network and Internet on the Windows control panel, click Network and Sharing Center, click Change adapter settings, and the virtual network card will appear: VMware Network Adapter VMnet8
Uninstall : Uninstall the software directly It is clean and requires the assistance of retrieval tools.

Five, Linux directory structure

Directory Structure Description
/bin It is the abbreviation of Binary, this directory stores the most frequently used commands
sbin s means Super User, the system management program used by system administrators is stored here
/home Store the home directory of ordinary users. In Linux, each user has its own directory. Generally, the directory is named after the user's account
/root This directory is the user home directory of the system administrator, also known as the super authority
/lib The most basic dynamic link shared library needed for system booting is similar to the DLL file in Windows. Almost all applications need to use these shared libraries
/etc All configuration files and subdirectories needed for system management
/usr This is a very important directory. Many users' applications and files are placed in this directory, similar to the program files directory under Windows.
/boot Stored here are some core files used when starting Linux, including some connection files and mirror files, don't put your own installation here
/proc This directory is a virtual directory, it is a mapping of system memory, we can directly access this directory to obtain system information
/srv The abbreviation of Servic, this directory stores some data that needs to be extracted after the service is started
/sys This is a big change in the Linux 2.6 kernel. A new file system sysfs in the 2.6 kernel is installed in this directory
/tmp This directory is used to store some temporary files
/dev Similar to the Windows device manager, all hardware is stored in the form of files
/media The Linux system will automatically recognize some devices, such as U disk, CD-ROM, etc., when recognized, Linux will mount the recognized device under this directory
/ mnt The system provides this directory to allow users to temporarily mount other file systems. We can mount the external storage on /mnt/, and then enter the directory to view the contents.
/opt This is the directory where additional software is installed on the host. For example, if you install a MySQL data, you can put it in this directory. The default is empty.
/where This directory contains things that are constantly expanding, and we are accustomed to placing those frequently modified directories in this directory. Include log files
/selinux Selinux is a safe self-system, which can control programs to only access specific files
/lost+found This directory is usually empty. When the system is shut down illegally, some files are stored here

6. Modify static IP and close firewall

6.1 Check the network IP and gateway
  
  1. View the virtual network editor, as shown in the figure below

在这里插入图片描述

	2.修改ip地址,如下图所示

在这里插入图片描述

	3.查看网关,如下图所示

在这里插入图片描述

	4.    查看windows环境的中VMnet8网络配置,如下图所示

在这里插入图片描述

6.2 Configure network ip address
  6.2.1 ifconfig configure network interface

 ifconfig :network interfaces configuring网络接口配置
	查看当前网络ip
 [root@hadoop100 桌面]# ifconfig
	6.2.2 ping 测试主机之间网络连通性

Case practice

 ping 目的主机      (功能描述:测试当前服务器是否可以连接目的主机)
例如:测试当前服务器是否可以连接百度
 [root@hadoop100 桌面]# ping www.baidu.com
	6.2.3 修改IP地址

		1. 修改IP地址,如下图所示
[root@hadoop100 桌面]#vim /etc/sysconfig/network-scripts/ifcfg-eth0

在这里插入图片描述

有值的按照下面的值修改,没有该项的要增加。

      DEVICE=eth0                #接口名(设备,网卡)

      HWADDR=00:0C:2x:6x:0x:xx   #MAC地址

      TYPE=Ethernet               #网络类型(通常是Ethemet)

      UUID=926a57ba-92c6-4231-bacb-f27e5e6a9f44  #随机id

      #系统启动的时候网络接口是否有效(yes/no)
      ONBOOT=yes                
      # IP的配置方法[none|static|bootp|dhcp](引导时不使用协议|静态分配IP|BOOTP协议|DHCP协议)
      BOOTPROTO=static     
      #IP地址
      IPADDR=192.168.1.100  
      #网关 
      GATEWAY=192.168.1.2     
      #域名解析器
      DNS1=114.114.114.114
      DNS2=8.8.8.8

After modification, it is shown in the figure below:
在这里插入图片描述

: Wq save and exit

		2. 执行service network restart,如下图所示

在这里插入图片描述

		3. 如果报错,reboot,重启虚拟机

6.3 Configure the host name
    6.3.1 hostname Display and set the host name of the system

查看当前服务器主机名称 [root@hadoop100 桌面]# hostname
		6.3.2 修改主机名称

	1. 修改linux的主机映射文件(hosts文件)

        (1)进入Linux系统查看本机的主机名。通过hostname命令查看

            [root@hadoop100 桌面]# hostname

            hadoop100

        (2)如果感觉此主机名不合适,我们可以进行修改。通过编辑/etc/sysconfig/network文件

            [root@hadoop100 桌面]# vi /etc/sysconfig/network

            文件中内容

              NETWORKING=yes

              NETWORKING_IPV6=no

              HOSTNAME= hadoop100

              注意:主机名称不要有“_”下划线

       (3)打开此文件后,可以看到主机名。修改此主机名为我们想要修改的主机名hadoop100。

       (4)保存退出,重启。

       (5)配置主机和IP的映射关系,打开/etc/hosts

          [root@hadoop100 桌面]# ·

            添加如下内容

              192.168.1.100 hadoop100

              192.168.1.101 hadoop101

              192.168.1.102 hadoop102

              192.168.1.103 hadoop103

              192.168.1.104 hadoop104

      (6)并重启设备,重启后,查看主机名,已经修改成功

    3. 修改window10的主机映射文件(hosts文件)

      (1)打开C:\Windows\System32\drivers\etc

      (2)添加如下内容

          192.168.1.100 hadoop100

               192.168.1.101 hadoop101

6.4 Turn off the firewall

 6.4.1 service 后台服务管理
      1.基本语法
          service  服务名 start                 (功能描述:开启服务)
			service  服务名 stop                 (功能描述:关闭服务)
			service  服务名 restart              (功能描述:重新启动服务)
			service  服务名 status               (功能描述:查看服务状态)

      2. 经验技巧

           查看服务的方法:/etc/init.d/服务名
				[root@hadoop100 init.d]# pwd
					/etc/init.d
			[root@hadoop100 init.d]# ls -al
      3. 案例实操

      (1)查看网络服务的状态
          [root@hadoop100 桌面]#service network status
      (2)停止网络服务
          [root@hadoop100 桌面]#service network stop
      (3)启动网络服务
          [root@hadoop100 桌面]#service network start
      (4)重启网络服务
          [root@hadoop100 桌面]#service network restart
      (5)查看系统中所有的后台服务
          [root@hadoop100 桌面]#service --status-all

  6.4.2 chkconfig 设置后台服务的自启配置
    1. 基本语法

      chkconfig                    (功能描述:查看所有服务器自启配置)

      chkconfig 服务名 off   (功能描述:关掉指定服务的自动启动)

      chkconfig 服务名 on   (功能描述:开启指定服务的自动启动)

      chkconfig 服务名 --list (功能描述:查看服务开机启动状态)

    2. 案例实操

      (1)关闭iptables服务的自动启动

          [root@hadoop100 桌面]#chkconfig iptables off

      (2)开启iptables服务的自动启动

          [root@hadoop100 桌面]#chkconfig iptables on

6.4.3 进程运行级别
    Linux进程运行级别,如下图所示

在这里插入图片描述

	6.4.4 关闭防火墙
1. 临时关闭防火墙

      (1)查看防火墙状态

        [root@hadoop100桌面]# service iptables status

      (2)临时关闭防火墙

        [root@hadoop100桌面]# service iptables stop

    2.开机启动时关闭防火墙

      (1)查看防火墙开机启动状态

          [root@hadoop100桌面]#chkconfig iptables --list 

      (2)设置开机时关闭防火墙

          [root@hadoop100桌面]#chkconfig iptables off

Guess you like

Origin blog.csdn.net/weixin_46122692/article/details/109215145