vmware 安装centos7设置

2023-06-18  本文已影响0人  wayyyy

记录下每次安装虚拟机后需要进行的设置,以centos 7.9 mini 版本为例

centos 7 镜像下载

centos 7 镜像下载

vmware 安装,这里不再描述。

设置静态IP

参考:最详细的讲解,如何使用VMnet8模式给虚拟网络配置静态IP

配置DNS

编辑 /etc/resolv.conf,加入:

nameserver 8.8.8.8
配置主机名

如下命令配置主机名:

# hostnamectl --static set-hostname viros1
设置 /etc/hosts

编辑 /etc/hosts

192.168.48.20 viros1
192.168.48.21 viros2
192.168.48.22 viros3
关闭防火墙
# systemctl status firewalld.service
# systemctl stop firewalld.service
# systemctl disable firewalld.service
Disable SELinux

配置 SELINUX=disabled 在 /etc/selinux/config 文件:

image.png

然后重启系统,查看:

# getenforce
  Disabled
设置时区
# timedatectl set-timezone Asia/Shanghai  # 设置时区
# timedatectl set-local-rtc 0  # 将当前的 UTC 时间写入硬件时钟
# systemctl restart rsyslog  # 重启依赖时间的服务
# systemctl restart crond    # 重启依赖时间的服务
安装ssh服务
# yum install -y openssl openssh-server

更改配置文件,用vim 编辑 /etc/ssh/sshd_config

#PermitRootLogin yes    找到这一行,将行首的"#"掉,允许root用户登录
#PasswordAuthentication yes     找到这一行,将行首的"#"掉,允许密码登录

然后重启ssh服务

systemctl restart sshd
配置aliyun源

可以配置ali的yum源,安装软件更快捷。

# yum install -y wget
# cd /etc/yum.repos.d
# mv CentOS-Base.repo CentOS-Base.repo.bak
# wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo --no-check-certificate
# yum clean all && yum makecache

如果需要还原至官方的yum源

# rpm -Uvh --force http://mirror.centos.org/centos-7/7.9.2009/os/x86_64/Packages/centos-release-7-9.2009.0.el7.centos.x86_64.rpm
安装常用的软件

centos 7 安装gcc 7+ 的版本

# yum install centos-release-scl
# yum install devtoolset-8
# scl enable devtoolset-8 bash  # 可以将这个命令写入到 /etc/profile 文件中

centos 7 安装 cmake3

# yum install -y epel-release
# yum install -y cmake3

其他:

# yum install -y vim wget telnet curl net-tools bind-utils tree make autoconf automake
常用软件Proxy配置
上一篇 下一篇

猜你喜欢

热点阅读