vmware安装centos7图文教程

原文链接:https://blog.csdn.net/hellboy0621/article/details/80392273

1、VMware创建虚拟机

2、安装CentOS7

选择系统语言

磁盘分区规划,选择默认自动分区,也可手动分区:

设置网络和主机名:

这里设置主机名为:centos7,打开网络连接,其他网络参数等待系统安装完成后再设置;

设置日期和时间:

开始系统安装:

设置root用户密码,如果密码过于简单,需要连续点击左上角Done两次;

等待系统安装完成

系统安装完成,重启

3、配置

3.1 配置网络

在最小化安装的CentOS7中,ifconfig是不能使用的,查看网卡信息的命令是

ip addr

其中“ens33”为网卡名称,修改IP地址等信息

vi /etc/sysconfig/network-scripts/ifcfg-ens33

根据实际情况修改内容:

TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static #启用静态ip地址
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=8d497804-9ffa-4edc-951a-5ddd8d2ed504
DEVICE=ens33
ONBOOT=yes #自动启用网络连接
IPADDR0=192.168.0.201 #IP地址
PREFIXO0=24 #子网掩码
GATEWAY0=192.168.0.1 #网关
DNS1=192.168.0.1 #DNS

修改好后保存退出,并重启网络,测试网络是否连接正常:

[[email protected] ~]# service network restart
Restarting network (via systemctl):                        [  OK  ]
[[email protected] ~]# ping www.baidu.com
PING www.a.shifen.com (220.181.111.188) 56(84) bytes of data.
64 bytes from 220.181.111.188 (220.181.111.188): icmp_seq=1 ttl=55 time=27.6 ms
64 bytes from 220.181.111.188 (220.181.111.188): icmp_seq=2 ttl=55 time=89.3 ms
64 bytes from 220.181.111.188 (220.181.111.188): icmp_seq=3 ttl=55 time=27.1 ms
64 bytes from 220.181.111.188 (220.181.111.188): icmp_seq=4 ttl=55 time=26.2 ms
^C
--- www.a.shifen.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3005ms
rtt min/avg/max/mdev = 26.254/42.606/89.358/26.997 ms

3.2 安装ifconfig命令

查看哪个组件包含了ifconfig命令

yum provides ifconfig
或
yum whatprovides ifconfig

ifconfig命令依赖于net-tools的,安装

yum install -y net-tools

3.3 安装vim编辑器

yum install -y vim-enhanced

3.4 安装wget

yum install -y wget

3.5 关闭SELinux

编辑SELinux配置文件

vim /etc/selinux/config

注释掉2行代码,并在最后添加1行代码

#SELINUX=enforcing
#SELINUXTYPE=targeted
SELINUX=disabled

保存并关闭,使设置启用,最好重启一下系统,也可以稍后重启

setenforce 0

3.6 关闭CentOS自带firewall防火墙,启用iptables

# 停止firewall
[[email protected] /]# systemctl stop firewalld
# 关闭firewall自动启动
[[email protected] /]# systemctl disable firewalld.service
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.

安装iptables防火墙

yum install -y iptables-services

使用iptables默认配置文件,可以在此配置文件中增加规则

[[email protected] ~]# vim /etc/sysconfig/iptables

# sample configuration for iptables service
# you can edit this manually or use system-config-firewall
# please do not ask us to add additional ports/services to this default configuration
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT

重启iptables,并添加到开机自启项中,查看iptables状态

[[email protected] ~]# systemctl restart iptables.service
[[email protected] ~]# systemctl enable iptables.service
Created symlink from /etc/systemd/system/basic.target.wants/iptables.service to /usr/lib/systemd/system/iptables.service.
[[email protected] ~]# service iptables status
Redirecting to /bin/systemctl status iptables.service
● iptables.service - IPv4 firewall with iptables
   Loaded: loaded (/usr/lib/systemd/system/iptables.service; enabled; vendor preset: disabled)
   Active: active (exited) since Mon 2018-05-21 18:09:28 CST; 18s ago
 Main PID: 1195 (code=exited, status=0/SUCCESS)

May 21 18:09:27 centos7 systemd[1]: Starting IPv4 firewall with iptables...
May 21 18:09:28 centos7 iptables.init[1195]: iptables: Applying firewall rules: [  OK  ]
May 21 18:09:28 centos7 systemd[1]: Started IPv4 firewall with iptables.

3.7 配置国内yum源和epel源

3.7.1 配置yum源

1)新建文件夹,保存系统中原来的repo文件

[[email protected] ~]# cd /etc/yum.repos.d/
[[email protected] yum.repos.d]# mkdir repo_bak
[[email protected] yum.repos.d]# mv *.repo repo_bak/

2)下载阿里云和网易对应系统的repo文件

[[email protected] yum.repos.d]# wget http://mirrors.aliyun.com/repo/Centos-7.repo
[[email protected] yum.repos.d]# wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
[[email protected] yum.repos.d]# ll
total 8
-rw-r--r-- 1 root root 1572 Dec  1  2016 CentOS7-Base-163.repo
-rw-r--r-- 1 root root 2573 Nov 21  2014 Centos-7.repo
drwxr-xr-x 2 root root  187 May 21 18:25 repo_bak

3)清楚系统yum缓存,并生成新的yum缓存

[[email protected] yum.repos.d]# yum clean all
Loaded plugins: fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Cleaning repos: base extras updates
Cleaning up everything
Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos
Cleaning up list of fastest mirrors

[[email protected] yum.repos.d]# yum makecache
Loaded plugins: fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Determining fastest mirrors
base                                                                                   | 3.6 kB  00:00:00
extras                                                                                 | 3.4 kB  00:00:00
updates                                                                                | 3.4 kB  00:00:00
(1/12): base/7/x86_64/group_gz                                                         | 166 kB  00:00:00
(2/12): base/7/x86_64/primary_db                                                       | 5.9 MB  00:00:01
(3/12): extras/7/x86_64/prestodelta                                                    |  47 kB  00:00:00
(4/12): base/7/x86_64/other_db                                                         | 2.5 MB  00:00:00
(5/12): extras/7/x86_64/primary_db                                                     | 143 kB  00:00:00
(6/12): extras/7/x86_64/filelists_db                                                   | 517 kB  00:00:00
(7/12): extras/7/x86_64/other_db                                                       |  91 kB  00:00:00
(8/12): updates/7/x86_64/prestodelta                                                   | 180 kB  00:00:00
(9/12): updates/7/x86_64/filelists_db                                                  | 875 kB  00:00:00
(10/12): updates/7/x86_64/other_db                                                     | 201 kB  00:00:00
(11/12): updates/7/x86_64/primary_db                                                   | 1.2 MB  00:00:00
(12/12): base/7/x86_64/filelists_db                                                    | 6.9 MB  00:00:04
Metadata Cache Created

3.7.2 配置epel源

1)安装epel-release,安装成功后,会自动生成epel.repo和epel-testing.repo两个文件

[[email protected] yum.repos.d]# yum list | grep epel-release
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
epel-release.noarch                         7-11                       extras

[[email protected] yum.repos.d]# yum install -y epel-release
Loaded plugins: fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:7-11 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================================================
 Package                       Arch                    Version                  Repository               Size
==============================================================================================================
Installing:
 epel-release                  noarch                  7-11                     extras                   15 k

Transaction Summary
==============================================================================================================
Install  1 Package

Total download size: 15 k
Installed size: 24 k
Downloading packages:
epel-release-7-11.noarch.rpm                                                           |  15 kB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : epel-release-7-11.noarch                                                                   1/1
  Verifying  : epel-release-7-11.noarch                                                                   1/1

Installed:
  epel-release.noarch 0:7-11

Complete!

[[email protected] yum.repos.d]# ll
total 16
-rw-r--r-- 1 root root 1572 Dec  1  2016 CentOS7-Base-163.repo
-rw-r--r-- 1 root root 2573 Nov 21  2014 Centos-7.repo
-rw-r--r-- 1 root root  951 Oct  3  2017 epel.repo
-rw-r--r-- 1 root root 1050 Oct  3  2017 epel-testing.repo
drwxr-xr-x 2 root root  187 May 21 18:25 repo_bak

2)下载阿里云开源镜像的epel源文件

[[email protected] yum.repos.d]# wget -O /etc/yum.repos.d/epel-7.repo http://mirrors.aliyun.com/repo/epel-7.repo
--2018-05-21 18:35:24--  http://mirrors.aliyun.com/repo/epel-7.repo
Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 1.81.1.230, 1.81.1.223, 1.81.1.224, ...
Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|1.81.1.230|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 664 [application/octet-stream]
Saving to: ‘/etc/yum.repos.d/epel-7.repo’

100%[====================================================================>] 664         --.-K/s   in 0s

2018-05-21 18:35:24 (148 MB/s) - ‘/etc/yum.repos.d/epel-7.repo’ saved [664/664]

[[email protected] yum.repos.d]# ll
total 20
-rw-r--r-- 1 root root 1572 Dec  1  2016 CentOS7-Base-163.repo
-rw-r--r-- 1 root root 2573 Nov 21  2014 Centos-7.repo
-rw-r--r-- 1 root root  664 May 11 11:35 epel-7.repo
-rw-r--r-- 1 root root  951 Oct  3  2017 epel.repo
-rw-r--r-- 1 root root 1050 Oct  3  2017 epel-testing.repo
drwxr-xr-x 2 root root  187 May 21 18:25 repo_bak

3)再次清除系统yum缓存,并重新生成yum缓存

[[email protected] yum.repos.d]# yum clean all
Loaded plugins: fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository epel is listed more than once in the configuration
Repository epel-debuginfo is listed more than once in the configuration
Repository epel-source is listed more than once in the configuration
Cleaning repos: base epel extras updates
Cleaning up everything
Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos
Cleaning up list of fastest mirrors

[[email protected] yum.repos.d]# yum makecache
Loaded plugins: fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository epel is listed more than once in the configuration
Repository epel-debuginfo is listed more than once in the configuration
Repository epel-source is listed more than once in the configuration
Determining fastest mirrors
base                                                                                   | 3.6 kB  00:00:00
epel                                                                                   | 4.7 kB  00:00:00
extras                                                                                 | 3.4 kB  00:00:00
updates                                                                                | 3.4 kB  00:00:00
(1/18): base/7/x86_64/group_gz                                                         | 166 kB  00:00:00
(2/18): base/7/x86_64/primary_db                                                       | 5.9 MB  00:00:01
(3/18): base/7/x86_64/other_db                                                         | 2.5 MB  00:00:00
(4/18): epel/x86_64/group_gz                                                           |  88 kB  00:00:01
(5/18): epel/x86_64/updateinfo                                                         | 923 kB  00:00:00
(6/18): epel/x86_64/prestodelta                                                        | 2.8 kB  00:00:00
(7/18): epel/x86_64/primary_db                                                         | 6.4 MB  00:00:02
(8/18): epel/x86_64/filelists_db                                                       |  10 MB  00:00:03
(9/18): extras/7/x86_64/filelists_db                                                   | 517 kB  00:00:00
(10/18): extras/7/x86_64/primary_db                                                    | 143 kB  00:00:00
(11/18): extras/7/x86_64/other_db                                                      |  91 kB  00:00:00
(12/18): extras/7/x86_64/prestodelta                                                   |  47 kB  00:00:00
(13/18): updates/7/x86_64/prestodelta                                                  | 180 kB  00:00:00
(14/18): updates/7/x86_64/primary_db                                                   | 1.2 MB  00:00:00
(15/18): updates/7/x86_64/other_db                                                     | 201 kB  00:00:00
(16/18): epel/x86_64/other_db                                                          | 3.1 MB  00:00:01
(17/18): updates/7/x86_64/filelists_db                                                 | 875 kB  00:00:00
(18/18): base/7/x86_64/filelists_db                                                    | 6.9 MB  00:00:09
Metadata Cache Created

3.7.3 查看系统可用的yum源和所有的yum源

[[email protected] yum.repos.d]# yum repolist enabled
Loaded plugins: fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository epel is listed more than once in the configuration
Repository epel-debuginfo is listed more than once in the configuration
Repository epel-source is listed more than once in the configuration
Loading mirror speeds from cached hostfile
repo id                              repo name                                                          status
base/7/x86_64                        CentOS-7 - Base - 163.com                                           9,911
epel/x86_64                          Extra Packages for Enterprise Linux 7 - x86_64                     12,542
extras/7/x86_64                      CentOS-7 - Extras - 163.com                                           291
updates/7/x86_64                     CentOS-7 - Updates - 163.com                                          539
repolist: 23,283
[[email protected] yum.repos.d]#
[[email protected] yum.repos.d]# yum repolist all
Loaded plugins: fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository epel is listed more than once in the configuration
Repository epel-debuginfo is listed more than once in the configuration
Repository epel-source is listed more than once in the configuration
Loading mirror speeds from cached hostfile
repo id                       repo name                                                        status
base/7/x86_64                 CentOS-7 - Base - 163.com                                        enabled:  9,911
centosplus/7/x86_64           CentOS-7 - Plus - 163.com                                        disabled
contrib/7/x86_64              CentOS-7 - Contrib - mirrors.aliyun.com                          disabled
epel/x86_64                   Extra Packages for Enterprise Linux 7 - x86_64                   enabled: 12,542
epel-debuginfo/x86_64         Extra Packages for Enterprise Linux 7 - x86_64 - Debug           disabled
epel-source                   Extra Packages for Enterprise Linux 7 - x86_64 - Source          disabled
epel-testing/x86_64           Extra Packages for Enterprise Linux 7 - Testing - x86_64         disabled
epel-testing-debuginfo/x86_64 Extra Packages for Enterprise Linux 7 - Testing - x86_64 - Debug disabled
epel-testing-source/x86_64    Extra Packages for Enterprise Linux 7 - Testing - x86_64 - Sourc disabled
extras/7/x86_64               CentOS-7 - Extras - 163.com                                      enabled:    291
updates/7/x86_64              CentOS-7 - Updates - 163.com                                     enabled:    539
repolist: 23,283

3.8 修改hostname主机名

3.8.1 hostnamectl

  1. [[email protected] ~]# hostnamectl

  2.  

    Static hostname: localhost.localdomain

  3.  

    Icon name: computer-vm

  4.  

    Chassis: vm

  5.  

    Machine ID: 8dbe281bfa3d4b3c9390c26f494db334

  6.  

    Boot ID: b629ca855d3e4406ab886fe709d2f917

  7.  

    Virtualization: vmware

  8.  

    Operating System: CentOS Linux 7 (Core)

  9.  

    CPE OS Name: cpe:/o:centos:centos:7

  10.  

    Kernel: Linux 3.10.0-514.el7.x86_64

  11.  

    Architecture: x86-64

  1. [[email protected] ~]# hostnamectl set-hostname CentOS

  2.  

    [[email protected] ~]# hostnamectl

  3.  

    Static hostname: centos

  4.  

    Pretty hostname: CentOS

  5.  

    Icon name: computer-vm

  6.  

    Chassis: vm

  7.  

    Machine ID: 8dbe281bfa3d4b3c9390c26f494db334

  8.  

    Boot ID: b629ca855d3e4406ab886fe709d2f917

  9.  

    Virtualization: vmware

  10.  

    Operating System: CentOS Linux 7 (Core)

  11.  

    CPE OS Name: cpe:/o:centos:centos:7

  12.  

    Kernel: Linux 3.10.0-514.el7.x86_64

  13.  

    Architecture: x86-64

  14.  

    [[email protected] ~]# hostname

  15.  

    centos

3.8.2 修改主机名文件

[[email protected] ~]# vi /etc/hostname

原文地址:https://www.cnblogs.com/sunshine171/p/11665539.html

时间: 2024-10-08 12:33:30

vmware安装centos7图文教程的相关文章

VMware虚拟机安装Centos7图文教程

CentOS 是一个工业标准的 Linux 发行版,是红帽企业版 Linux 的衍生版本.你安装完后马上就可以使用,但是为了更好地使用你的系统,你需要进行一些升级.安装新的软件包.配置特定服务和应用程序等操作. 这篇文章主要介绍了如何在VMware安装centos7系统! 1. 下载centos 地址:https://www.centos.org/download/ 简单介绍下个版本区别: DVD:标准安装版,一般下载这个就可以了 Everything:对完整版安装盘的软件进行补充,集成所有软件

VMware安装CentOS 图文教程

工具/原料 VMware_8.0.4.744019_Lite_XiaZaiBa.7z <CentOS.5.6>.x86.光盘镜像].CentOS-5.6-i386-bin-DVD.iso 方法/步骤 1 设置安装向导 打开 WMware Workstation 8,然后选择新建虚拟机 2 新建虚拟机向导 选择 自定义(高级)(C)然后点击[下一步]按钮 3 选择虚拟机硬件兼容性 选择 workstation 8.0 然后点击[下一步]按钮 4 安装客户机操作系统 注意点:此处选择 我以后安装操

VMware安装Centos7超详细过程(图文)

VMware安装Centos7超详细过程(图文) 原文:https://www.jianshu.com/p/ce08cdbc4ddb?utm_source=tuicool&utm_medium=referral 本篇文章主要介绍了VMware安装Centos7超详细过程(图文),具有一定的参考价值,感兴趣的小伙伴们可以参考一下 1.软硬件准备 软件:推荐使用VMwear,我用的是VMwear 12 镜像:CentOS7 ,如果没有镜像可以在官网下载 :http://isoredirect.cen

Oracle 11g R2安装手册(图文教程)For Windows

1.Oracle 11g R2安装手册(图文教程)For Windows 1.下载Oracle 11g R2 for Windows版本,下载地址如下 官方网站: http://download.oracle.com/otn/nt/oracle11g/112010/win32_11gR2_database_1of2.zip http://download.oracle.com/otn/nt/oracle11g/112010/win32_11gR2_database_2of2.zip 2.解压两个

eclipse下配置安装ssm图文教程(web版)

eclipse下配置安装ssm图文教程(web版) 一.安装所需jar包 1.1  mybatis安装包 可以进入GitHub的https://github.com/mybatis/mybatis-3/releases下载所需版本,本文版本是mybatis-3.4.2 Mybatis实现缓存的jar包: 1.2  spring安装包 补充:spring配置aop的aspect包 可以进入spring官网的http://projects.spring.io/spring-framework/ 下载

分布式进阶(二)Ubuntu 14.04下安装Dockr图文教程(一)

当前,完全硬件虚拟化技术(KVM.Xen.Hyper-V 等)能在一个物理主机上很好地运行多个互相独立的操作系统,但这也带来一些问题:性能不佳,资源浪费,系统反应迟缓等.有时候对用户来说,完全的硬件虚拟化并不是最好的选择. 一种替代方案是使用轻量级虚拟化技术 -- 所谓的 LinuX Container 容器 (LXC),它提供的是系统级虚拟化.与跑虚拟机相比,LXC 可以在一个轻量级沙箱容器里面跑多个 Linux 操作系统.当你需要设置一些易于克隆的开发环境.测试环境,或想在安全沙盒里安装应用

真正从零开始,TensorFlow详细安装入门图文教程!(linux)

读懂智能&未来 首页 专栏 专题 公开课   AI慕课学院 爱搞机 极客购 申请专栏作者 业界人工智能智能驾驶AI+Fintech未来医疗网络安全AR/VR机器人开发者智能硬件物联网GAIR 业界正文 13 真正从零开始,TensorFlow详细安装入门图文教程! 本文作者:黄鑫 2016-06-11 21:32 导语:帮你完成那个最难的从0到1 AI这个概念好像突然就火起来了,年初大比分战胜李世石的AlphaGo成功的吸引了大量的关注,但其实看看你的手机上的语音助手,相机上的人脸识别,今日头条

Windows下安装jmeter图文教程(来源于网络)

这篇文章主要介绍了Windows下安装jmeter图文教程,JMeter是Apache软件基金会的产品,用于对静态的和动态的资源性能进行测试,需要的朋友可以参考下 JMeter是Apache软件基金会的产品,用于对静态的和动态的资源(文件,Servlet,Perl脚本,Java 对象,数据库和查询,FTP服务器等等)的性能进行测试.是一款很方便的测试软件.系统:windows xp 需要的软件包:jdk-6u34-windows-i586.exe apache-jmeter-2.7.zip1.下

VMware 安装 Centos7 超详细过程

VMware 安装 Centos7 超详细过程 分类 编程技术 1.软硬件准备 软件:推荐使用 VMware,我用的是 VMware 12 镜像:CentOS6 ,如果没有镜像可以在阿里云下载 https://mirrors.aliyun.com/centos/ 硬件:因为是在宿主机上运行虚拟化软件安装centos,所以对宿主机的配置有一定的要求.最起码I5CPU双核.硬盘500G.内存4G以上. 2.虚拟机准备 1.打开VMware选择新建虚拟机 2.典型安装与自定义安装 典型安装:VMwar