yum
hosts
nohup
-
yum:相当于python里面的pip
-
基本使用
-
安装:yum install 包名
yum install telnet
-
卸载:需要借助rpm进行卸载
-
-
换源
参考https://developer.aliyun.com/mirror/centos?spm=a2c6h.13651102.0.0.3e221b115Ci1Y6
-
备份原有的源配置文件
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
-
从阿里官方网站下载对应系统版本的源配置文件
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
-
由于我们是非ECS用户,所以源配置文件中包含aliyuncs.com地址访问不了
-
故对其进行移除
sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
-
重新构建本地缓存
yum makecache
-
-
-
systemctl
管理系统以及用户的服务
NetworkManager
network
防火墙:firewalld
系统服务都在:/usr/lib/systemd/system该目录中,都是以xxx.service形式存在
- 启动:
systemctl start firewalld
- 停止:
systemctl stop firewalld
- 重启:
systemctl restart firewalld
- 查看状态:
systemctl status firewalld
- 开机自启:
systemctl enable firewalld
- 取消开机自启:
systemctl disable firewalld
- 启动:
-
修改主机名
便于区分不同的虚拟机(主机)
修改完之后需要重新连接即可生效,不需要重启系统
hostnamectl set-hostname zs # 修改文件的方式 需要重启 vim /etc/hostname # 将原内容删除后 修改为自己的主机名 master
-
修改hosts
配置IP地址和名称的映射关系
后续如果要使用IP地址的时候,则可以直接使用名称代替
vim /etc/hosts # 增加内容 192.168.xxx.100 master 192.168.xxx.101 node1
-
同样在Windows中也能修改hosts
进入C:\Windows\System32\drivers\etc目录
-
-
修改环境变量
环境变量:本质上是很多路径
当系统执行命令时,会去环境变量中的路径里查找有无该命令,有即执行,没有就会提示命令找不到
配置环境变量就是告诉系统去哪些位置找我们需要的命令
vim /etc/profile # 一般配置在文件的尾部 先配置一个XXX_HOME,然后再将其HOME下的bin目录配置在环境变量PATH中 MY_SCRIPTS_HOME=/root/scripts export PATH=$MY_SCRIPTS_HOME/bin:$PATH # 配置完之后记得source 才能生效 source /etc/profile
-
安装JDK环境
- 上传到虚拟机
# 如果不能直接拖进去 yum install lrzsz
-
解压
mkdir /usr/local/soft tar -zxvf jdk-8u171-linux-x64.tar.gz -C /usr/local/soft
-
修改环境变量
vim /etc/profile # 在文件尾部加入以下内容 JAVA_HOME=/usr/local/soft/jdk1.8.0_171 [HADOOP_HOME=location] export PATH=$JAVA_HOME/bin:[$HADOOP/bin:$HADOOP/sbin:]$PATH # 保存退出之后 记得source source /etc/profile
-
修改配置文件(省略)
-
进行初始化工作(省略)
-
测试
# 查看当前系统中运行了哪些JAVA进程 jps # 查看JAVA的版本号 java -version # 输出 java version "1.8.0_171" Java(TM) SE Runtime Environment (build 1.8.0_171-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)
-
nohup
后台运行
nohup sh demo13.sh > a.log 2>&1 nohup command > file 2>&1