sequence
I haven’t seen you for a long time, I miss you so much.
During this period of time, school has started, I have been busy for a while, and I haven’t updated my blog for a long time.
In the textbook, I saw such a book (above), called “Linux Network Operating System Application Basic Course”. At first glance, the cover looks good, and this simple color scheme makes this book have a high-level sense… However, after turning over a few pages, I found that this is a basic book.
For a person who has been using Arch for two years and doesn’t like reading books, the content in this book should be learned quickly.
With the attitude of trying it out, I want to finish this book in one day.
full book catalog
First look at the catalog and almost laughed.
Obviously, this is really some basic content. Most of them have also been exposed in two years of Arch experience.
It seems to be some concepts + foundation + practical operation
Conceptual content
It is probably the content of 2.1 of Project 1 to Project 2, which talks about the case, history, and popular distributions of Linux.
There is no Arch in the book, bad review.
But it also describes that Linux can be used to run various services, such as DNS ( Domain Name System ) services, Web servers (Apache Nginx, which provide web services based on HTTP protocol), mail servers based on SMTP protocol, and FTP protocol files Transport server, file sharing server based on Samba protocol, DHCP server and VPN server.
In short, it talks about what Linux can do, the advantages of Linux, etc. These can be found through search engines, so I won’t go into details.
practical content
In the future, it will be some operational content, such as Linux installation and building various services, etc.
Install the Linux operating system
The book talks about installing a CentOS virtual machine with VMware.
In high school it will, skip it.
Linux basic operation
Regarding basic operations, I wrote a few notes on basic commands when I was in junior high school.
The book also introduces two ways to open the terminal, one is to open the terminal in the graphical interface, and the other is to switch tty by pressing Ctrl
+ Alt
+ (F1 ~F6)
.
Then there are the commands, most of which are Chinese translations after adding the -h
parameter. For those who are not very good at English, it is also a good thing to read them when needed.
In addition, I need to add some commands that were not written in the article sent by the junior high school.
cat
Output the content of a file, the usage written in the book is
|
|
But our general usage is
|
|
This is nothing to say and is commonly used, but it is not very good when encountering too long text.
less and more
I have hardly seen anyone using more, the commands are used in the same way, but the effect may be different.
|
|
|
|
Usually we don’t add any options…
head and tail
There is nothing to say about this, the parameter usage is the same, but The former looks at the head, the latter looks at the butt .
|
|
|
|
parameter options
- -n num display the last num lines of the specified file
- -c num Display the last num characters of the specified file.
rmdir
Used to delete a directory. With this, the deleted directory must be empty.
Otherwise, an error will be reported. Like mkdir
, you can add -p
for recursive deletion.
What does recursion mean? It is to delete one level at a time.
|
|
However, I usually don’t like to use this, I like to use rm -r
or rm -rfv
.
touch
The touch command can generate a normal file.
|
|
grep
This is used to view the lines in the file that contain the specified string, commonly used.
|
|
tar
I usually use this tar to decompress.
|
|
However, this is a packing command, which is equivalent to compressing a file.
|
|
- -c generate archive file
- -v list the detailed process of unarchiving the archive
- -f specifies the archive file name
- -r append the file to the end of the archive
- -z compress or decompress in gzip format
- -j compress or decompress in bzip2 format
- -d compare archive with files in current directory
- -x unzip archive
You can use man
to see more information about tar
.
|
|
rpm
Offline package installer for rpm-based distributions. At least that’s how I understand it.
|
|
The name of the package refers to a file name, and some files ending with .rpm
suffix are rpm-based software packages.
The installation looks like this
|
|
other parameters
- -v install process show details
- -h Show progress bar with
#
during installation - -e remove package
- -q to see if the package is already installed
You can also read the manual through man
|
|
Now we use package managers such as yum
or dnf
directly, and use remote repositories to install and manage packages.
document editing
As for document editing, you need to use vi
or vim
.
This is also common
|
|
Quote a link to a rookie tutorial
I usually use i
to edit documents, ESC
to exit edit mode, :w
to save, and :q
to quit.
Sometimes it is necessary to add a !
Enforcement.
Save and exit is :wq
If there are other needs I will use man
to look at the documentation.
|
|
User and group management
The thing to do when installing Arch is to add users with useradd
.
Desktop systems often do not use the root user and add one or more regular users.
Some collaboratively deployed servers also take advantage of the multi-user nature of Linux.
Every file in a GNU/Linux system belongs to a user (owner) and a user group (owner). In addition, there are three types of access rights: read, write, and execute. We can set the corresponding access permissions for the owner and group of the file.
—— Excerpted from && see ArchWiki
useradd
This command is used to add users
|
|
Paste the parameter usage first
-
-m
/--create-home
Create user home directory/home/[用户名]
; within its own home directory, even non-root users can read and write files, install programs, etc. -
-G
/--groups
List of additional groups the user wants to join; use commas to separate multiple groups, do not add spaces; if not set, the user only joins the initial group. -
-s
/--shell
The path of the user’s default login shell; after the startup process is over, the default login shell is set here; please make sure that the shell used has been installed, the default is Bash.
Use useradd --defaults
to view the shell defaults. The default is Bash. Additional values can be set with the -s
/ --shell
option. /etc/shells
records the login shells that can be used.
– Excerpted from ArchWiki
For example, if I want to create a user on a new machine, the user name is weepingdogel
and I need to create the user’s home directory /home/weepingdogel
, and add it to the wheel
group , and the default shell is set to Bash .
I will execute this command:
|
|
What if I want zsh
?
|
|
Just like this~
- The new user cannot be the same as the user name of the existing user;
- After the user is created, the user name or group must be included in the
/etc/sudoers
file, otherwise the root authority cannot be invoked usingsudo
; Don’t create a bunch of useless users- Make sure the shell you are using is installed, the default is Bash. Uninstalled shells cannot be used, and users cannot create them.
userdel
This command is used to delete a user
|
|
Add the -r
option to delete the user’s home directory
|
|
Not much to say, see man userdel for details.
groups
This command is used to see which groups a user belongs to.
|
|
Of course, we can also view all groups by looking at /etc/group
.
|
|
id
This command can display some additional information about the user, such as UID
, GID
, etc.
|
|
groupadd and groupdel
The former is to create a new group, the latter is to delete a group.
Create a new group:
|
|
Delete a user group:
|
|
groupmod
Often used to change the name of the group to which the user belongs, but not the GID
.
|
|
gpasswd
Often used to change which group a user belongs to.
For example to add a user to a group:
|
|
Or remove a user from a group:
|
|
Other usage can also refer to man gpasswd
A list of some related documents
-
/etc/shadow
holds user security information -
/etc/passwd
user account information -
/etc/gshadow
holds security information for group accounts -
/etc/group
defines the group to which the user belongs -
/etc/sudoers
Users who can run sudo -
/home/*
home directory
Remember them well.
Basic Disk Management
Of course, it also involves disk management, which can be touched a lot when installing Arch.
View partition status
When Linux recognizes the disk, it allocates it as a block device, which in the system is a file, such as /dev/sda
, /dev/nvme0n1
, or /dev/mmcblk0
. You can use lsblk
or fdisk
to view:
|
|
/dev/sd*X
, while the hard disk using NVME will be displayed as /dev/nvme*n*
Create edit section
You can go to the search engine to find instructions for fdisk
, follow it to create and edit partitions, you can use simple cfdisk
.
You can even use the graphical partitioning tools that come with some distributions.
format
After the partition is created, it is necessary to select the appropriate file system for formatting.
What are the file systems? Please refer to this page for details
Linux often uses EXT4
use mkfs
|
|
mount partition
|
|
Of course, you can also write /etc/fstab
for automatic mounting, details can be found here
resource sharing service
FTP
Build an FTP server
First install vsftpd
using the package manager
deb
|
|
centos
|
|
Configure by editing /etc/vsftpd.conf
Such as allowing anonymous login, and allowing passwordless login
|
|
Then start via systemd
|
|
connect via client
Refer to the Arch Wiki , the configuration can be adjusted according to the actual situation.
Samba
Don’t do this stuff, it’s too dangerous.
DHCP server
Install dhcpd directly
deb
|
|
centos
|
|
pacman
|
|
Write the configuration file /etc/dhcpd.conf
:
|
|
Then start the service through systemd
|
|
DNS server
I’m too lazy to do it, it’s not difficult
Reference https://wiki.archlinux.org/title/BIND_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)
Apache server
this simple
deb
|
|
pacman
|
|
rpm
|
|
Start the service directly
|
|
Then visit http://127.0.0.1:80
.
Summarize
What a rubbish book!
Simple, but too old to keep up with the times.
Or find information on the Internet by yourself.
This article is reprinted from: http://weepingdogel.github.io/posts/%E4%B8%80%E5%A4%A9%E5%88%B7%E5%AE%8Clinux%E7%BD%91%E7%BB% 9C%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F%E5%BA%94%E7%94%A8%E5%9F%BA%E7%A1%80% E6%95%99%E7%A8%8B%E8%BF%99%E6%9C%AC%E4%B9%A6/
This site is for inclusion only, and the copyright belongs to the original author.