用虚拟机配置Linux实验环境

我们平时经常需要利用VMware搭建Linux实验环境,下面我将搭建步骤整理了一下。

安装虚拟机

系统镜像:CentOS-7-x86_64-Everything-1708.iso

用VMware安装系统镜像,网络设置时建议配置NAT网卡模式。

关闭防火墙

systemctl stop firewalld
systemctl disable firewalld
systemctl status firewalld

配置主机名

vi /etc/hosts

设置免密码登录

ssh-keygen -t rsa
ssh-copy-id -i ~/.ssh/id_rsa.pub root@bigdata11

作业环境

作业环境就在/root目录下,文件夹tools和training。

安装JDK

tar -zxvf jdk-8u144-linux-x64.tar.gz -C ~/training/

配置环境变量:

vi ~/.bash_profile
JAVA_HOME=/root/training/jdk1.8.0_144
export JAVA_HOME

PATH=$JAVA_HOME/bin:$PATH
export PATH

使环境变量生效:

source ~/.bash_profile

配置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

(后者需要安装wget,建议用前者)

编辑CentOS-Base.repo,将$releasever替换为7,vi命令(注意:有冒号):

:%s/$releasever/7/g

生成缓存:

yum makecache

配置pip源

在root目录下新建.pip目录:

mkdir .pip

进入.pip目录,创建并修改pip.conf

vi pip.conf
[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host = mirrors.aliyun.com
posted @ 2019-06-21 10:34  Steven0325  阅读(436)  评论(0编辑  收藏  举报