Centos6.9虚拟机环境搭建

原文链接:https://www.toutiao.com/i6481534700216123918/

一、准备工具

VMware Workstation

CentOS-6.9-x86_64-minimal.iso

SecureCRTPortabl

二、安装系统

1、图解虚拟机安装过程

 

   install or upgrade an existing system
 install system with basic vedio driver
 rescue install system
 第一项为正常安装
 第二项为基本显卡安装
 第三项为救援模式
 选择第一项

 

检查硬件 故障  disc found此项主要检查安装光盘有无问题。选择检查,选择ok

  

 

配置网络 : 需要点掉自动连接此项相当于开启网卡

 

重新启动

2、网络配置

使用root和密码登录到系统中

然后设置网卡

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

TYPE=Ethernet

BOOTPROTO=static//静态地址

DEFROUTE=yes

PEERDNS=yes

PEERROUTES=yes

IPV4_FAILURE_FATAL=no

IPV6INIT=yes

IPV6_AUTOCONF=yes

IPV6_DEFROUTE=yes

IPV6_PEERDNS=yes

IPV6_PEERROUTES=yes

IPV6_FAILURE_FATAL=no

NAME=eno16777736

DEVICE=eno16777736

ONBOOT=yes //启用网卡

IPADDR=192.168.225.104 //设置IP

NETMASK=255.255.255.0 //设置掩码

GATEWAY=192.168.225.2 //设置网关,就是记住的网关

DNS1=114.114.114.114    //设置DNS

DNS2=114.114.114.115 //设置备用DNS

使用SecureCRT连接

3、配置Yum源

http://mirrors.163.com/.help/centos.html

 

[root@wangmaster ~]# cd /etc/yum.repos.d/

[root@wangmaster yum.repos.d]# ls

CentOS7-Base-163.repo CentOS-Debuginfo.repo CentOS-Sources.repo

CentOS-Base.repo CentOS-fasttrack.repo CentOS-Vault.repo

CentOS-CR.repo CentOS-Media.repo

[root@wangmaster yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.bak //使原来的yum失效

[root@wangmaster yum.repos.d]# yum clean all //清除yum缓存

已加载插件:fastestmirror

正在清理软件源: base extras updates

Cleaning up everything

[root@wangmaster yum.repos.d]# yum repolist //更新yum库

已加载插件:fastestmirror

base | 3.6 kB 00:00

extras | 3.4 kB 00:00

updates | 3.4 kB 00:00

(1/4): base/7/x86_64/group_gz | 155 kB 00:00

(2/4): extras/7/x86_64/primary_db | 139 kB 00:00

(3/4): base/7/x86_64/primary_db | 5.6 MB 00:09

(4/4): updates/7/x86_64/primary_db | 3.9 MB 00:11

Determining fastest mirrors

源标识源名称状态

base/7/x86_64 CentOS-7 - Base - 163.com 9,363

extras/7/x86_64 CentOS-7 - Extras - 163.com 311

updates/7/x86_64 CentOS-7 - Updates - 163.com 1,126

repolist: 10,800

[root@wangmaster yum.repos.d]#

[root@wangmaster yum.repos.d]# yum install -y vim //安装VIM工具

 

 

4、关闭selinux

[root@wangmaster yum.repos.d]# vim /etc/selinux/config

# This file controls the state of SELinux on the system.

# SELINUX= can take one of these three values:

# enforcing - SELinux security policy is enforced.

# permissive - SELinux prints warnings instead of enforcing.

# disabled - No SELinux policy is loaded.

SELINUX=disabled

# SELINUXTYPE= can take one of three two values:

# targeted - Targeted processes are protected,

# minimum - Modification of targeted policy. Only selected processes are protected.

# mls - Multi Level Security protection.

SELINUXTYPE=targeted

 

5、停止防火墙

查询防火墙状态:
[root@localhost ~]# service   iptables status
停止防火墙:
[root@localhost ~]# service   iptables stop
启动防火墙:
[root@localhost ~]# service   iptables start
重启防火墙:
[root@localhost ~]# service   iptables restart
永久关闭防火墙:
[root@localhost ~]# chkconfig   iptables off
永久关闭后启用:
[root@localhost ~]# chkconfig   iptables on

 

6、安装JDK环境

上传JDK

 

tar -zxvf jdk1.8.tar.gz

修改/etc/profile文件,配置java环境

vim /etc/profile

JAVA_HOME=/usr/local/java/jdk1.8

JAVA_BIN=/usr/local/java/jdk1.8/bin

PATH=$PATH:$JAVA_HOME/bin

CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/jre/lib/rt.jar

export JAVA_HOME

export JAVA_BIN

export PATH

export CLASSPATH

source /etc/profile

三、安装过程出现的问题

(1)虚拟化性能计数器不兼容二进制转换。

 

 

解决办法:设置处理器时,关闭性能计数器

(2)linux获取 GPG 密钥失败

解决办法:

实质性问题就是自己系统没有yum的GPG密钥

  •    查看自己系统版本
  •    cat /etc/issue
  •    登陆mirrors.163.com 找到自己系统对应的密钥
  •    使用命令rpm --import进行导入
  •    Rpm --import http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6(把6改为你当前版本)
  •    再用 yum -y install tree 就可以了

 

 

posted on 2017-10-27 17:59  那山的狐狸  阅读(2993)  评论(0编辑  收藏  举报

导航