Linux basic installation and use

1, Linux basic installation and use
Linux Installation idea: VM virtual machine installation system, not graphical interface. The system version is CentOS7. Basically, the next step can be completed in turn.

1. Change IP address
Note that the network uses bridging (not copying the physical network), so that the virtual machine and the physical machine are under the same network. After installation, the IP address is manually (customized according to the environment)

vim /etc/sysconfig/network-scripts/ifcfg-ens33	
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.1.100
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS1=202.106.0.20
DNS2=202.106.196.115

restart

service network restart

2. Replace the local source
Because the speed of foreign mirror source is slow, change the domestic source
Download wget tools

yum install -y wget

Change source – back up local yum source – get domestic yum source (one of Ali and 163)

cd /etc/yum.repos.d/
mv CentOS-Base.repo CentOS-Base.repo_bak
wget -O CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
wget -O CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo

Clean cache using yum – # rebuild cache – upgrade Linux system

 yum clean all 
 yum makecache 
 yum -y update 

3. Basic operation of Linux (basic, it's not difficult to knock several times)
see:
pwd ls cat grep find awk sed more ifconfig top ps iftop atop
uname – a view the kernel version; cat /proc/version to view the system version; cat /proc/cpuinfo cpu information; hostname host name;
Ifconfig network information; fdisk – l hard disk entity, which can also be partitioned; df – k (disk free -kb) available disks;
Free – m memory;
iptables – L firewall; Natstat – lntp listening port; netstat – antp view connected
ps – ef view process; ps – ef |grep java filters out javar processes;
top real-time process user; w active users; last login log;
touch test.c creates a new file; vi edit text: i insert mode ESC exit mode wq save exit;

Search:
Find files with c extension in the current directory and subdirectories:

find -type f -name "*.c"      
find ./ -type f –name "*.c"

All files in the current directory and subdirectories:

find –type f  

View the files modified by / usr in the last 7 days and copy them to / dir (wipe, no success, see later)

find /usr –type f –mtime -7 –exec cp {} /dir \  (-type –f File directory d   Block device b  ;  -exec ...... \ 

operation
cd enters the directory cd... The upper directory mv cp
vi or vim file operation: important

Understand:
Wildcard: * any character? Any character other than any character [!] within a single character []
File system: - file d folder l hard connection

User and group management:
su root switches users; Passwd or passwd sam change password
groupadd group1 ; groupadd –g 101 group2 ; groupdel group2
Groupmod – g 102 group2 modify the group label;
useradd chmod chown

Remote connection: ssh root@192.168.1.100

Directory system
bin Store binary executable(ls,cat,mkdir etc.)
boot Store various files used for system boot
dev Used to store equipment files
etc Store system configuration files
home The root directory where all user files are stored
lib Store shared libraries and kernel modules required for running programs in the file system
mnt The system administrator installs the mount point for the temporary file system
opt Where additional installed optional application packages are placed
proc Virtual file system, which stores the mapping of current memory
root Superuser directory
sbin Store binary executable files, only root To access
tmp It is used to store various temporary documents
usr It is an important directory for storing system applications/usr/local Local administrator software installation directory
var Files used to store data that needs to be changed at run time

5. Auxiliary tools
CRT or Xshell remote software: after the virtual machine is powered on, it basically minimizes the operation and uses the Yun Cheng connection software to operate
Winscp FTP software: remote upload and download
Openssh transport link service: allow remote root: VIM / etc / SSH / sshd.conf g  permitrotlogin yes restart service sshd reload
SQLyog database remote software: used to connect to the database remotely
Sublime lightweight front end software
PyCharm python development and project
VS code operating software:

use sftp Upload and download synchronization: select a local folder to synchronize with the shipment file
 Extended search chinese,sftp Installation, ctrl+shift+p call out json window
	{
	    "name": "My Server",
	    "host": "localhost",
	    "protocol": "sftp",
	    "port": 22,
	    "username": "username",
	    "remotePath": "/",
	    "uploadOnSave": true
	}
stay vscode In terminal ssh root@192.168.100  Input password. use sync local-remote Or reverse sync files

IntelliJ IDEA java development and project packaging
To be continued

Tags: Linux CentOS network

Posted on Wed, 24 Nov 2021 09:34:52 -0500 by DapperDanMan