vmware虚拟机 linux 本地yum源,网卡配置ens33,防火墙selinux vim
1、挂载镜像文件,CentOS-7-x86_64-DVD-1804.iso,并且要处于连接状态
#光盘挂载至/mnt
mount /dev/sr0 /mnt
#备份yum源文件
cd /etc/yum.repos.d/
mkdir -p ./bak
mv CentOS* ./bak
#编缉本地源
vim local.repo
[centos7]
name=CentOS7
baseurl=file:///mnt
enable=1
gpgcheck=0
配置公网阿里云和163源
1、查看看是否存在yum [root@localhost ~]# rpm -qa|grep yum yum-langpacks-0.4.2-7.el7.noarch yum-3.4.3-168.el7.centos.noarch PackageKit-yum-1.1.10-2.el7.centos.x86_64 yum-utils-1.1.31-54.el7_8.noarch yum-metadata-parser-1.1.4-10.el7.x86_64 yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch 2、备份/etc/yum.repos.d/CentOS-Base.repo mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak 3、下载新的 CentOS-Base.repo 到 /etc/yum.repos.d/ 阿里云yum(2024最新yum:https://developer.aliyun.com/mirror/) centos 7 wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo 或 curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo centos 8 wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo 或 curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo 网易yum(2024最新yum:http://mirrors.163.com/.help/) CentOS 7 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo CentOS 6 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS6-Base-163.repo CentOS 5 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS5-Base-163.repo 4、清除缓存 yum clean all 5、新建缓存 yum makecache 6、更新yum yum -y update 二、安装yum 注:请确认你是否能访问centos官网(https://vault.centos.org/7.2.1511/os/x86_64/Packages/ ),或者是否有 国内的yum安装包(国内的最新yum的安装包我暂时没找到,下述的安装包为centos官网的) 1、删除yum安装包 [root@localhost ~]# rpm -aq|grep yum|xargs rpm -e --nodeps 2、查看: [root@localhost opt]# rpm -qa|grep yum 4、进入centos官网 获取yum的安装包 (https://vault.centos.org/7.2.1511/os/x86_64/Packages/ ) wget https://vault.centos.org/7.2.1511/os/x86_64/Packages/yum-3.4.3-132.el7.centos.0.1.noarch.rpm wget https://vault.centos.org/7.2.1511/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm wget https://vault.centos.org/7.2.1511/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-34.el7.noarch.rpm [root@localhost opt]# ll (下载得如下文件) total 1304 -rw-r--r--. 1 root root 1272736 Dec 3 2015 yum-3.4.3-132.el7.centos.0.1.noarch.rpm -rw-r--r--. 1 root root 28348 Jul 3 2014 yum-metadata-parser-1.1.4-10.el7.x86_64.rpm -rw-r--r--. 1 root root 30600 Nov 25 2015 yum-plugin-fastestmirror-1.1.31-34.el7.noarch.rpm [root@localhost opt]# 5、解压安装yum安装包 [root@localhost opt]# rpm -ivh yum-* 6、确认安装完成 [root@localhost opt]# yum
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
#配置公网yun源
yum clean all
yum makecache
yum install -y epel-release
wget -O /etc/yum.repos.d/CentOS7-Base-163.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo
yum clean all
yum makecache
yum install -y epel-release
############################################33
关闭防火墙并设置开机不启动
firewall 服务开启与关闭
firewalld状态:# systemctl status firewalld.service
关闭 firewalld:# systemctl stop firewalld
开启firewalld:# systemctl start firewalld
开机自动关闭firewalld:# systemctl disable firewalld
开机自动启动firewalld:# systemctl enable firewalld
查看开机是否启动服务:# chkconfig --list|grepnetwork ##centos 6
临时关闭和永久关闭selinux
临时关闭selinux
# getenforce
Enforcing
# setenforce 0
setenforce: SELinux is disabled
永久关闭selinux
# vim /etc/selinux/config
改:SELINUX=enforcing
为:SELINUX=disabled
# reboot //重启系统生效
3、固定虚拟机的网卡
在linux操作系统终端执行如下命令:
#进入网卡所在目录
[root@localhost~]#cd /etc/sysconfig/network-scripts/
#安装vim编缉器
[root@localhostnetwork-scripts]#yum install vim -y(需要虚拟机可以上外网)
#编缉网卡,固定ip地址
[root@localhostnetwork-scripts]#vim ifcfg-ens33(修改网卡内容如下)
TYPE="Ethernet"
BOOTPROTO="none"
DEFROUTE="yes"
NAME="ens33"
DEVICE="ens33"
ONBOOT="yes"
IPADDR=192.168.100.200
NETMASK=255.255.255.0
GATEWAY=192.168.100.2
DNS1=114.114.114.114
#使用systemctl管理工具重启网卡
[root@localhostnetwork-scripts]#systemctl restart network
执行ipa,查看linuxip地址
在xshell软件里输入 reconnect是再连接
ctrl + v 进入visual模式下
按上下左右箭头连续选中多行空间
shift + i 进入insert模式
输入# 后,按esc键
------------------------------
删除多行开头#
ctrl + v 进入 visual模式
按上下光标键连续选中多行
按d键一并删除
reconnect再连接
reload
rpm -qa | wc -l 计系统下安装的软件包数量
rpm -ql 询软件细信息
rpm -qc 查询配置
rpm -e 删除软件
rpm -ivh 安装软件
2、写出以下命令的含义
yum list 列出所有yum可用安装软件包
yum search 查询yum安装包
yum install yum安装
yum clean 清空yum缓存
yum makecache fast 创建缓存
yum remove 删除软件