Getting Started with Linux Server Administration

I. Introduction

This part is         written mainly to avoid the detection of the CSDN posting assistant, so it can be ignored . Below is a description of some related concepts.

        Linux: The full name is GNU/Linux. It is a free-to-use and freely disseminated UNIX-like operating system. Its kernel was first released by Linus Benedict Torvalds on October 5, 1991. It is mainly influenced by Inspired by Minix and Unix ideas, it is a POSIX-based multi-user, multi-tasking, multi-threading and multi-CPU operating system. It can run major Unix utilities, applications and network protocols. It supports 32-bit and 64-bit hardware. Linux inherits Unix's network-centric design idea and is a multi-user network operating system with stable performance.

        Linux distribution: There are hundreds of different distributions of Linux, such as debian and archlinux based on community development, and Red Hat Enterprise Linux, SUSE, Oracle Linux, etc. based on commercial development. The more famous one in China is deepin, and the user interface is very good. There is also elementory os, which is also a Linux distribution, and the interface is also very good-looking, more like mac.

        Linux desktop version: mainly refers to a Linux distribution with a desktop environment. The desktop environment generally refers to an intuitive visual environment composed of the background picture of the desktop, the application software on the desktop, the shortcuts on the desktop, and the DIY widgets on the desktop. A desktop environment may be nothing more than a simple window manager, or it may be a complete suite of desktop applications like KDE or GNOME.

        Linux Server Edition: mainly refers to the Linux distribution with server environment. A server is a type of computer that runs faster, loads more, and is more expensive than a normal computer. The server provides computing or application services for other clients (such as PCs, smart phones, ATMs and other terminals or even large-scale equipment such as train systems) in the network. The server has high-speed CPU computing capability, long-term reliable operation, powerful I/O external data throughput and better scalability.

        The difference between Linux and Windows: Linux is an open source operating system, while Windows is a commercial operating system. Linux has access to the source code and changes the code according to the user's needs, while Windows does not have access to the source code. Linux distributions do not collect user data, while Windows collects all user details causing privacy protection. Linux is more secure because it is easy to identify errors and fix them, while Windows has a large user base and is an easy target for virus and malware developers. The Linux user interface is not as good as the Windows user interface, and there are far fewer gaming software for Linux than Windows.

2. The reason for writing this blog

        Some time ago, the server in the laboratory hung up and couldn't be started, and then no one went to repair it. After two months, I needed to use the server for scientific experiments. So took over this server. During the period, from reinstallation to some basic management, everything was learned from scratch. I hope to record this blog to help myself and those in need jump over some pitfalls.

        Oh, by the way, before the reinstallation, two colleagues from the laboratory helped me step on a pit, that is: the server reinstallation system does not support the U disk/mobile hard disk system boot disk. Then they speculated that they could use a DVD system boot disk to reinstall, so I bought a few DVDs from the Internet and made a boot disk to try to reinstall the server system.

        During the period, because I didn’t know how to use DVD to make a boot disk, I wasted a DVD disc (copy the files in the system image to the disc, and then the disc is not erasable, so it is directly discarded). Later, I checked the information and found that the computer software "UltraISO" can create a DVD boot disk. The specific tutorial is to make a DVD system boot disk . The download address of this software is UltraISO download .

        The process of reinstalling is quite simple, just insert the DVD into the driver of the server, and then it is similar to reinstalling with an ordinary U disk. The situation at that time was that I entered the system (with a system interface) in the DVD after booting up, and then there was an icon such as "install", I double-clicked, and then tapped to reinstall. After the reinstallation was successful, the server automatically played the CD-ROM for me. Finally, the server started, entered the user interface of the system, and reinstalled successfully. Note: DVD reinstallation, because the reading and writing is too slow, so the reinstallation process will take a long time, don't think that the reinstallation failed, just wait patiently. Below is a picture of the reinstallation process (I installed Ubuntu18.04):

3. Some sorting out of Linux server entry management operations

        1. Modify the Linux administrator username and password

        Since a password was randomly set during installation, for safety reasons, it is better to reset a more complex password. The command to modify the administrator password (need to switch to root first) is

第一步
sudo su
第二步
sudo passwd 用户名

        Refer to https://www.cnblogs.com/mojiejushi/p/15342283.html .

        2. Create a common Linux user

        Since I am not the only one in the laboratory, I need to create some common users for the same door of the laboratory. It is recommended to use the "adduser" command here, because this command can automatically create a directory corresponding to the user for ordinary users, such as user u1, this command will automatically create the directory /home/u1 for u1, and this directory is the exclusive directory of u1. Please check the blog for details: https://blog.csdn.net/wuguangbin1230/article/details/123084915 .

        3. Open ssh

        Since the server is in the computer room, and we are usually in the laboratory, it is impossible to always go to the computer room and do experiments together in the computer room. Therefore, opening ssh to connect to the server through the LAN is the best solution. The method to open is also very simple, you can refer to this blog: https://blog.csdn.net/B_X_Z/article/details/113832357 (it only takes a few steps, very simple). But please note that this ssh can only be connected in the LAN. After ssh is opened, the service will be automatically started after booting. So you don't need to worry about not being able to connect when the server restarts.

        4. Open remote desktop

        It is a good choice to run the experiment locally on the server through the remote desktop. It can overcome the problem of unstable ssh connection in the campus network environment. It takes a few days to run, and you will definitely feel very angry or sad when you encounter this problem). Below is a collection of useful blogs that I have collected.

安装远程桌面:https://zhuanlan.zhihu.com/p/93438433
管理员用户无法远程:https://blog.csdn.net/weixin_43315707/article/details/107518380
卸载远程桌面:https://blog.csdn.net/sereasuesue/article/details/122429762

        Matters needing special attention: It is recommended not to use the root user or administrator user to debug whether the remote desktop is successful, but to create an ordinary user, and then use the ordinary user to try to connect to the remote desktop. I just tried the root user to try to connect to the remote desktop, but I couldn't connect for most of the day, and a blue screen or crash occurred.

        5. Switch language to English

        When reinstalling, I accidentally selected [Chinese] as the default language and input method of the system, resulting in the names of some directories being in Chinese. Worried about problems in subsequent experiments, I specifically studied the operation of switching from [Chinese] to [English] on Ubuntu. You can refer to:

https://blog.csdn.net/c_hnie/article/details/87114379

        Of course, when reinstalling the system, it is recommended that you first select the language as "English", so as to avoid unnecessary troubles.

        6. Mount/use data disk

        After reinstalling the system, I found that there is no such data disk, unlike Windows, which has D disk, E disk and so on. Then after I inquired about relevant information, I found that the data disk needs to be mounted to the Linux root directory before it can be used, for example, mounted to /data, and data is a directory you created.

查看数据盘和系统盘:https://www.jianshu.com/p/147ef14133ef
创建挂载目录+挂载:http://www.zzvips.com/article/224105.html

        7. Create/view files

        This is relatively simple.

创建文件(使用tough命令):https://www.php.cn/linux-470728.html
查看文件(使用cat命令):cat <文件名>

        8. Modify file/directory permissions

        This is also relatively simple.

文件权限说明:https://www.cnblogs.com/nvyuan/p/15107114.html
修改权限:https://blog.csdn.net/qq_41602468/article/details/117967231

        9. Create a public anaconda environment

        This step is more complicated. Idea: Download anaconda, then install anaconda through root, then set the file permissions of the anaconda directory, and add relevant bashrc settings for ordinary users.

Anaconda源:https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/?C=M&O=D
下载命令(下载到当前目录):wget 下载连接
安装:https://blog.csdn.net/youban_47/article/details/125420758

        other instructions

文件权限rws:https://zhidao.baidu.com/question/459853054.html
查看用户所在的组:https://m.php.cn/article/485070.html
创建环境:conda create -n <环境名> python=<python版本号>
删除环境(不能在该环境下执行该命令):conda remove -n <环境名> --all
查看环境列表:conda info –envs
查看环境列表(通过安装目录,这里/usr/local/anaconda3为安装目录):ls -l /usr/local/anaconda3/envs

        Note: If the permissions of the anaconda installation directory and its subdirectories and subfiles are set to 770, users will experience exceptions when creating the environment, such as being unable to query the list just created through the "conda info --envs" command, or they can create, But the terminal output is abnormal.

Fourth, write at the end

        The above summarizes a lot of good blogs. Although they are good blogs, there are actually many pitfalls. You may have to test them through your own practical ability. But so far, I have been able to solve my main problems through these blogs. If you have any questions, please leave a message, and then we can communicate together.

Guess you like

Origin blog.csdn.net/qq_36158230/article/details/127660153