Centos系统初始化和shell简单命令
centos系统初始化:
主机重命名
hostnamectl set-hostname server1
bash—刷新可查看更改后的主机名
1.设置IP地址
wq保存最后设置
vi /etc/sysconfig/network-scripts/ifcfg-ens33
按i 进入插入模式
BOOTPROTO=static
IPADDR=20.0.0.10
NETMASK=255.255.255.0
GATEWAY=20.0.0.2
DNS=20.0.0.2
ONBOOT=yes
:wq 对配置进行保存
对网卡进行重启 systemctl restart network
查看网卡地址的命令: ifconfig
ip addr
上网:vi /etc/resolv.conf
nameserver 20.0.0.2
2.关闭防火墙,关闭核心防护
临时关闭
systemctl stop firewalld
setenforce 0
3.光盘挂载
这里需要先连接光盘再配置终端
临时挂载:mount /dev/cdrom /mnt
永久挂载: vi /etc/fstab
/dev/cdrom /mnt iso9660 defaults 0 0
4.yum源配置
[[email protected] ~]# vi /etc/yum.repos.d/
[[email protected] ~]# cd /etc/yum.repos.d/
[r[email protected] yum.repos.d]# ls
CentOS-Base.repo CentOS-fasttrack.repo CentOS-Vault.repo
CentOS-CR.repo CentOS-Media.repo
CentOS-Debuginfo.repo CentOS-Sources.repo
[[email protected] yum.repos.d]# mkdir backup
[[email protected] yum.repos.d]# mv C* backup
[[email protected] yum.repos.d]# cp backup/CentOS-Base.repo local.repo
shell简单命令
shell:Linux系统中运行的一种特殊程序
在用户和内核之间充当翻译官 内核—面向硬件
用户登录Linux系统时,自动加载的一个shell程序 外壳—面向用户
Linux常用shell种类
bash
bash shell是Bourne shell的一个免费版本,它是最早的Unix shell,包括许多附加的特点。Bash有可编辑的命令行,可以回查历史命令,支持tab键补齐以使用户避免输入长的文件名。
csh
C shell使用的是“类C”的语法,借鉴了Bourne shell的许多特点,只是内部shell命令集有所不同。
ksh
Korn shell的语法与Bourne shell相同,同时具备了C shell的易用特点。许多安装脚本都使用ksh,即使不把它作为主shell,也应该在系统中安装它。
tcsh
TC shell是C shell的一个增强版本,与C shell完全兼容。
zsh
Z shell是Korn shell的一个增强版本,具备bash shell的许多特色。