Crazy God said Linux overview and environment construction 01

Crazy God said Linux overview and environment construction 01

Station B link: https://www.bilibili.com/video/BV187411y7hF?p=2

Getting started overview

Why should we learn Linux

Linux has been born for so many years. Before, it was still shouting how to replace the windows system. Now this slogan is much smaller. The development of everything has its limitations and its ceiling. Just like building another social software to replace Tencent in China, it’s basically impossible to think about it, because users are accustomed to using WeChat to communicate. It’s not that they don’t understand technically but that the people are used to it and want them to use it, even if they don’t. It’s something that you don’t need relatives or friends or you have to use it.

It is basically impossible for everyone to switch to another operating system after getting used to the windows operating system. It is too difficult to change a person's habit. No way to penetrate into the lives of ordinary people does not mean that Linux is useless. On the server side, Linux is becoming more and more popular in the development field. Many programmers feel embarrassed if they don't understand a little bit of Linux. The status of Linux in the open source community remains untouched.

Especially as a back-end programmer, you must master Linux, because this has become the basic threshold for you to find a job, so you have to learn!

Introduction to Linux

The Linux kernel was originally written by Finn Linus Torvalds out of personal hobbies when he was studying at the University of Helsinki.

Linux is a free-to-use and freely spread Unix-like operating system. It is a multi-user, multi-task, multi-thread and multi-CPU operating system based on POSIX (Portable Operating System Interface) and UNIX.

Linux can run major UNIX tools, software, applications, and network protocols. It supports 32-bit and 64-bit hardware. Linux inherits Unix's network-centric design philosophy and is a multi-user network operating system with stable performance.

Linux distribution

The simple point of the Linux distribution is to package the Linux kernel and application software.

At present, the more well-known distributions on the market are: Ubuntu, RedHat, CentOS, Debian, Fedora, SuSE, OpenSUSE, Arch Linux, SolusOS, etc.

Linux application areas

Today, various Linux distributions are used in various occasions, from embedded devices to supercomputers, and have established a position in the server field. Usually the server uses LAMP (Linux + Apache + MySQL + PHP) or LNMP (Linux + Nginx + MySQL + PHP) combination.

At present, Linux is not only used in homes and businesses, but also very popular in the government.

  • The Brazilian Federal Government is world-renowned for supporting Linux.

  • There are news reports that the Linux distribution version made by the Russian army itself has achieved results as a GHost project.

  • The Kerala Federation of India plans to promote the use of Linux in high schools throughout the Federation.

  • In order to achieve technological independence, the People's Republic of China uses Linux exclusively in the Loongson processor.

  • It has developed its own Linux distribution in some regions of Spain and is widely used in the government and education fields, such as gnuLinEx in the Extremadura region and Guadalinex in the Andalusia region.

  • Portugal also uses its own Linux distribution Caixa Mágica for Magalhées laptops and e-escola government software.

  • France and Germany have also begun to gradually adopt Linux.

 

Linux vs Windows

 

Environment setup

Linux installation, the installation steps are relatively cumbersome. Nowadays, cloud servers are quite common and the price is also cheap. If you don't want to build it directly, you can buy one for learning and use!

Install CentOS (virtual machine installation, resource consumption)

1. It can be installed by mirroring!

2. You can use the mirror image that I have made! This method is explained in the video!

3. Install VMware virtual machine software, and then open our mirror to use!

 

Purchase a cloud server (recommended)

After the virtual machine is installed, it will take up space and there will be some lag. As programmers, we can actually choose to buy our own server, which is closer to real online work;

1. Alibaba Cloud purchase server: https://www.aliyun.com/minisite/goods?userCode=0phtycgr

2. After the purchase is completed, obtain the server's ip address, reset the server password, and then you can log in remotely

3. Download the xShell tool and use it for remote connection! The effect of successful connection is as follows:

Precautions:

If you want to open the port, you need to open the corresponding access rules in the security group panel of Alibaba Cloud, otherwise it will be blocked by Alibaba!

 

If it is not easy to operate in the early stage, you can recommend installing the pagoda panel, a fool management server

Installation tutorial: https://www.bt.cn/bbs/thread-19376-1-1.html

1. Open the corresponding port

2. One-click installation

3. After installation, you will get the address, account number, and password of the remote panel, and you can log in

4. After logging in, you can visualize the installation environment and deploy the website!

About domain names

If your website wants to go online, you must purchase a domain name and file it;

It takes some authentication and time for the record. After the preparation is complete, you can resolve to your own website. At this time, you can use the domain name to access the server!

 

Approaching the Linux system

Power on login

Open the opportunity to start many programs. They are called "services" in Windows and "daemons" in Linux.

After the boot is successful, it will display a text login interface. This interface is the login interface we often see. In this login interface, the user will be prompted to enter a user name, and the user entered by the user will be passed as a parameter to the login program to verify the user The password is not displayed, just press Enter after entering!

Generally speaking, there are three ways for users to log in:

  • Command line login

  • ssh login

  • Graphical interface login

The highest authority account is root, which can operate everything!

Shut down

It is mostly used on servers in the linux field, and it rarely encounters shutdown operations. After all, there is no end to running a service on the server, unless under special circumstances, it will be shut down as a last resort.

The shutdown command is: shutdown;

sync # 将数据由内存同步到硬盘中。

shutdown # 关机指令,你可以man shutdown 来看一下帮助文档。例如你可以运行如下命令关机:

shutdown –h 10 # 这个命令告诉大家,计算机将在10分钟后关机

shutdown –h now # 立马关机

shutdown –h 20:25 # 系统会在今天20:25关机

shutdown –h +10 # 十分钟后关机

shutdown –r now # 系统立马重启

shutdown –r +10 # 系统十分钟后重启

reboot # 就是重启,等同于 shutdown –r now

halt # 关闭系统,等同于shutdown –h now 和 poweroff

Finally, to summarize, whether you are restarting the system or shutting down the system, you must first run the sync command to write the data in the memory to the disk.

System directory structure

After logging in to the system, enter the command in the current command window:

ls /

You will see as shown below:

Tree-like directory structure: (All Linux resources are mounted under this / root node)

The following is an explanation of these directories:

  • /bin : bin is the abbreviation of Binary, this directory stores the most frequently used commands.

  • /boot: Stored here are some core files used when starting Linux, including some connection files and mirror files.

  • /dev: dev is the abbreviation of Device, which stores the external devices of Linux. The way of accessing the device in Linux is the same as that of accessing the file.

  • /etc: This directory is used to store all configuration files and subdirectories needed for system management.

  • /home : The user's home directory. In Linux, each user has his own directory. Generally, the name of the directory is named after the user's account.

  • /lib : This directory stores the most basic dynamic link shared libraries of the system, and its function is similar to DLL files in Windows.

  • /lost+found : This directory is generally empty. When the system is shut down illegally, some files are stored here.

  • /media : Linux system will automatically recognize some devices, such as U disk, CD-ROM, etc., after recognition, linux will mount the recognized device to this directory.

  • /mnt : The system provides this directory to allow users to temporarily mount other file systems. We can mount the CD-ROM drive on /mnt/, and then enter the directory to view the contents of the CD-ROM drive.

  • /opt : This is the directory where additional software is installed on the host. For example, if you install an ORACLE database, you can put it in this directory. The default is empty.

  • /proc : This directory is a virtual directory, which is a mapping of system memory. We can directly access this directory to obtain system information.

  • /root : This directory is the home directory of the system administrator, also known as the user's home directory of the super authority.

  • /sbin : s stands for Super User, and the system management program used by the system administrator is stored here.

  • /srv : This directory stores some data that needs to be extracted after the service is started.

  • /sys : This is a big change in the linux2.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.

  • /usr : This is a very important directory. Many user applications and files are placed in this directory, similar to the program files directory under windows.

  • /usr/bin: Application programs used by system users.

  • /usr/sbin: The more advanced management programs and system daemons used by super users.

  • /usr/src: The default storage directory of the kernel source code.

  • /var : This directory contains things that are constantly expanding. We are accustomed to placing those frequently modified directories in this directory. Including various log files.

  • /run : is a temporary file system that stores information since the system was started. When the system restarts, the files in this directory should be deleted or cleared.

  • The content of the notes comes from the B station Crazy God Talk

Guess you like

Origin blog.csdn.net/weixin_45442617/article/details/109739678