windows上安装安装Vmware,安装centos7
作者:隆海
发表于:2020-07-11
阅读次数:26
字数:695
阅读时间:~2分钟
在公司的电脑使用的是windows系统,有时候需要测试一些东西,可以使用自己购买的服务器,如果需要几台来测试那就需要安装虚拟机来安装操作系统
安装Vmware
安装和激活Vmvare
下载centos7
下载地址:http://isoredirect.centos.org/centos/7/isos/x86_64/
使用国内下载点:https://mirrors.aliyun.com/centos/7/isos/x86_64/下载CentOS-7-x86_64-DVD-2009.iso
下载安装这里就不详细介绍
网络配置
找到自己电脑的ip地址,按网段分配一个没有使用的IP给centos的系统ip
进入网络配置目录
[rh@localhost ~]$ cd /etc/sysconfig/network-scripts/
[rh@localhost network-scripts]$ ls
ifcfg-ens33 ifdown-eth ifdown-post ifdown-Team ifup-aliases ifup-ipv6 ifup-post ifup-Team init.ipv6-global
ifcfg-lo ifdown-ippp ifdown-ppp ifdown-TeamPort ifup-bnep ifup-isdn ifup-ppp ifup-TeamPort network-functions
ifdown ifdown-ipv6 ifdown-routes ifdown-tunnel ifup-eth ifup-plip ifup-routes ifup-tunnel network-functions-ipv6
ifdown-bnep ifdown-isdn ifdown-sit ifup ifup-ippp ifup-plusb ifup-sit ifup-wireless
更改配置
[rh@localhost network-scripts]$ sudo vi ifcfg-ens33
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static #dhcp更改
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=0c8758ef-1d63-4957-ab77-b8c05e4f278d
DEVICE=ens33
ONBOOT=yes #开机启动no改为yes,增加以下配置
IPADDR=192.168.2.138
GATEWAY=192.168.2.1
NETMASK=255.255.255.0
DNS1=8.8.8.8
DNS2=8.8.4.4
重启网络
[rh@localhost network-scripts]$ sudo systemctl restart network
测试网络
[rh@localhost network-scripts]$ ping www.baidu.com
PING www.a.shifen.com (183.2.172.185) 56(84) bytes of data.
64 bytes from 183.2.172.185 (183.2.172.185): icmp_seq=1 ttl=51 time=40.5 ms
64 bytes from 183.2.172.185 (183.2.172.185): icmp_seq=2 ttl=51 time=30.5 ms
64 bytes from 183.2.172.185 (183.2.172.185): icmp_seq=3 ttl=51 time=29.7 ms
64 bytes from 183.2.172.185 (183.2.172.185): icmp_seq=4 ttl=51 time=29.7 ms
64 bytes from 183.2.172.185 (183.2.172.185): icmp_seq=5 ttl=51 time=29.7 ms
配置阿里源
官方地址:https://developer.aliyun.com/mirror/centos/
备份
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
下载新的 CentOS-Base.repo 到 /etc/yum.repos.d/
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
运行 yum makecache 生成缓存
系统初始化
关闭selinux
- 查看状态
bash
getenforce
- 临时关闭
bash
setenforce 0
- 永久关闭
bash
vi /etc/selinux/config
# 设置为disabled
SELINUX=disabled
防火墙
- 查看防火墙
bash
systemctl status firewalld
- 关闭防火墙
bash
systemctl stop firewalld
- 永久关闭埅
bash
systemctl disable firewalld
ssh
默认是开启了的,如果没有安装ssh
yum install openssh-server -y
systemctl start sshd.service
systemctl enable sshd.service
常用工具安装
yum install -y bash-completion vim lrzsz wget expect net-tools nc nmap tree dos2unix htopiftop iotop unzip telnet sl psmisc nethogs glances bc ntpdate openldap-devel
官方安装文档 :https://docs.docker.com/desktop/install/linux-install/