virtual machine setting

Posted by moloach on 2018-10-22

新建一台虚拟机

1. 在虚拟机管理平台选择硬件

存储

文件保存的硬盘

虚拟机

显示的是已经创建的虚拟机及其状态

创建新的虚拟机

  1. 点击“创建/注册虚拟机” -> “创建新虚拟机”
  2. 填写虚拟机唯一名称 -> 选择对应的操作系统
  3. 选择存储的位置
  4. 选择对应的硬件
    • 一般只要选择CPU, 内存, 硬盘大小即可,其他设置无需改动
    • 选择对应的系统镜像文件
  5. 记得选择相应的Network Adapter

系统安装

创建好虚拟机之后,刷新页面即可显示新建的虚拟机, 点击播放即可进入,第一次需要进行安装

系统初始化设置

  1. 设置时区,选择东八区“shanghai”,语言选择英语
  2. 设置硬盘分区, 自定义分区,分成三个区 分别为
    • /
    • swap
    • /boot
  3. 系统会默认分区,注意分配的磁盘是否全部用完
  4. 选择最小化安装,并且加上对应的开发工作
  5. 在系统安装的时候设置对应的root用户及普通用户(此处需要勾选普通用户有管理员权限)
  6. 安装完成后重启系统

系统设置

完成之后打开对应的控制台,输入设置的帐号和密码即可进入系统

设置固定ip

1. 临时性设置ip

1
2
3
ifconfig #查看网卡信息,此处网卡假设为ens160
ifconfig ens160 <ipaddress>
ifcfg ens160 add <ipaddress>

注意,这只能临时性更改IP

2. 配置静态IP文件

配置文件位置:/etc/sysconfig/network-scripts/ifcfg-ens160

1
2
3
4
5
6
7
BOOTPROTO=static
ONBOOT=yes
IPADDR=10.134.149.135
GATEWAY=10.134.149.1
NETMASK=255.255.255.0
DNS1=10.130.136.111
DNS2=10.134.248.35

设置http代理

1. yum 代理

配置文件: /etc/yum.conf

1
proxy=http://10.134.149.32:8118

2. 全局代理

配置文件: /etc/profile

1
2
3
4
http_proxy="http://10.134.149.32:8118"
export http_proxy
https_proxy="https://10.134.149.32:8118"
export https_proxy

3. sssh远程执行代理配置

配置文件:~/.bashrc

1
2
3
4
http_proxy="http://10.134.149.32:8118"
export http_proxy
https_proxy="https://10.134.149.32:8118"
export https_proxy

设置 ntp时间校准服务配置

1.安装 ntp ntpdate ntp-doc

1
sudo yum install ntp ntpdate ntp-doc -y

2.ntp server配置

配置文件: /etc/ntp.conf

1
2
3
4
5
6
7
8
9
10
#配置上级ntp同步地址
server 10.191.131.131
server 10.191.130.130

#将时间服务器配置为本地时间
server 127.127.1.0
fudge 127.127.1.0 stratum 0

#允许客户端连接这台服务器以同步时间 单不允许修改配置
restrict 0.0.0.0 mask 0.0.0.0 nomodify notrap

时间同步
1
2
3
4
5
#测试时间服务器是否可用
#ntpdate -q 10.134.149.135
ntpdate -q 10.191.131.131
#与服务器同步
ntpdate 10.191.131.131
启动
1
2
3
4
5
6
7
systemctl start ntpd
systemctl enable ntpd #开机启动
systemctl status ntpd

ntpq -p #查看时间服务器状态ntpda

timedatectl #查看同步状态
ntp客户端配置
时区设置
1
2
3
4
5
6

#查看支持的时区
timedatectl list-timezones

#设置时区
timedatectl set-timezone Asia/Shanghai
防火墙配置

开放123端口的udp连接

1
2
firewall-cmd --add-service=ntp --permanent
firewall-cmd --reload

安装rpm包

1
rpm   -ivh   package.ix86.rpm